Wire up pading.
Review URL: https://webrtc-codereview.appspot.com/509002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2094 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
		| @@ -516,12 +516,34 @@ RTPSender::SendOutgoingData(const FrameType frameType, | ||||
|         return _audio->SendAudio(frameType, payloadType, captureTimeStamp, payloadData, payloadSize,fragmentation); | ||||
|     } else | ||||
|     { | ||||
|         // assert audio frameTypes | ||||
|         assert(frameType == kVideoFrameKey || | ||||
|                frameType == kVideoFrameDelta || | ||||
|                frameType == kVideoFrameGolden || | ||||
|                frameType == kVideoFrameAltRef); | ||||
|         // Assert on audio frameTypes. | ||||
|         assert(frameType != kAudioFrameSpeech && | ||||
|                frameType != kAudioFrameCN); | ||||
|  | ||||
|         // If the encoder generate an empty frame send pading. | ||||
|         if (frameType == kFrameEmpty) { | ||||
|           // Current bitrate since last estimate(1 second) averaged with the | ||||
|           // estimate since then, to get the most up to date bitrate. | ||||
|           uint32_t current_bitrate = BitrateNow(); | ||||
|           int bitrate_diff = _targetSendBitrate * 1000 - current_bitrate; | ||||
|           if (bitrate_diff > 0) { | ||||
|             int bytes = 0; | ||||
|             if (current_bitrate == 0) { | ||||
|               // Start up phase. Send one 33.3 ms batch to start with. | ||||
|               bytes = (bitrate_diff / 8) / 30; | ||||
|             } else { | ||||
|               bytes = (bitrate_diff / 8); | ||||
|               // Cap at 200 ms of target send data. | ||||
|               int bytes_cap = _targetSendBitrate * 25;  // 1000 / 8 / 5 | ||||
|               if (bytes_cap > bytes) { | ||||
|                 bytes = bytes_cap; | ||||
|               } | ||||
|             } | ||||
|             // Send pading data. | ||||
|             return SendPadData(payloadType, captureTimeStamp, bytes); | ||||
|           } | ||||
|           return 0; | ||||
|         } | ||||
|         return _video->SendVideo(videoType, | ||||
|                                  frameType, | ||||
|                                  payloadType, | ||||
| @@ -818,9 +840,8 @@ void RTPSender::UpdateNACKBitRate(const WebRtc_UWord32 bytes, | ||||
|   } | ||||
| } | ||||
|  | ||||
| // Function triggered by timer. | ||||
| void RTPSender::ProcessSendToNetwork() { | ||||
|  | ||||
|   // triggered by timer | ||||
|   WebRtc_UWord32 delta_time_ms; | ||||
|   { | ||||
|     CriticalSectionScoped cs(_sendCritsect); | ||||
| @@ -828,12 +849,10 @@ void RTPSender::ProcessSendToNetwork() { | ||||
|     if (!_transmissionSmoothing) { | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|     WebRtc_UWord32 now = _clock.GetTimeInMS(); | ||||
|     delta_time_ms = now - _timeLastSendToNetworkUpdate; | ||||
|     _timeLastSendToNetworkUpdate = now; | ||||
|   } | ||||
|  | ||||
|   _sendBucket.UpdateBytesPerInterval(delta_time_ms, _targetSendBitrate); | ||||
|  | ||||
|   while (!_sendBucket.Empty()) { | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | ||||
|  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | ||||
|  * | ||||
|  *  Use of this source code is governed by a BSD-style license | ||||
|  *  that can be found in the LICENSE file in the root of the source | ||||
| @@ -216,6 +216,10 @@ webrtc::FrameType VCMEncodedFrame::ConvertFrameType(VideoFrameType frameType) | ||||
|         { | ||||
|             return kVideoFrameAltRef; | ||||
|         } | ||||
|     case kSkipFrame: | ||||
|         { | ||||
|             return kFrameEmpty; | ||||
|         } | ||||
|     default: | ||||
|         { | ||||
|             return kVideoFrameDelta; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 pwestin@webrtc.org
					pwestin@webrtc.org