Adding playout buffer status to the voe video sync

Review URL: https://webrtc-codereview.appspot.com/1311004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3835 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org
2013-04-11 20:23:35 +00:00
parent 9da751715f
commit 1de01354e6
7 changed files with 196 additions and 229 deletions

View File

@ -114,24 +114,19 @@ int32_t ViESyncModule::Process() {
assert(video_rtp_rtcp_ && voe_sync_interface_);
assert(sync_.get());
int current_audio_delay_ms = 0;
int audio_jitter_buffer_delay_ms = 0;
int playout_buffer_delay_ms = 0;
if (voe_sync_interface_->GetDelayEstimate(voe_channel_id_,
current_audio_delay_ms) != 0) {
// Could not get VoE delay value, probably not a valid channel Id.
&audio_jitter_buffer_delay_ms,
&playout_buffer_delay_ms) != 0) {
// Could not get VoE delay value, probably not a valid channel Id or
// the channel have not received enough packets.
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceVideo, vie_channel_->Id(),
"%s: VE_GetDelayEstimate error for voice_channel %d",
__FUNCTION__, voe_channel_id_);
return 0;
}
// VoiceEngine report delay estimates even when not started, ignore if the
// reported value is lower than 40 ms.
if (current_audio_delay_ms < 40) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(),
"A/V Sync: Audio delay < 40, skipping.");
return 0;
}
RtpRtcp* voice_rtp_rtcp = NULL;
if (0 != voe_sync_interface_->GetRtpRtcp(voe_channel_id_, voice_rtp_rtcp)) {
return 0;
@ -153,14 +148,16 @@ int32_t ViESyncModule::Process() {
return 0;
}
TRACE_COUNTER1("webrtc", "SyncCurrentVideoDelay", total_video_delay_target_ms);
TRACE_COUNTER1("webrtc", "SyncCurrentAudioDelay", current_audio_delay_ms);
TRACE_COUNTER1("webrtc", "SyncCurrentVideoDelay",
total_video_delay_target_ms);
TRACE_COUNTER1("webrtc", "SyncCurrentAudioDelay",
audio_jitter_buffer_delay_ms);
TRACE_COUNTER1("webrtc", "SyncRelativeDelay", relative_delay_ms);
int extra_audio_delay_ms = 0;
// Calculate the necessary extra audio delay and desired total video
// delay to get the streams in sync.
if (!sync_->ComputeDelays(relative_delay_ms,
current_audio_delay_ms,
audio_jitter_buffer_delay_ms,
&extra_audio_delay_ms,
&total_video_delay_target_ms)) {
return 0;