Log current and target AV delay in ViESyncModule

R=mikhal@webrtc.org, wu@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4229 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
hclam@chromium.org
2013-06-14 23:30:58 +00:00
parent 63e988856e
commit 9b23ecb939

View File

@ -103,10 +103,9 @@ int32_t ViESyncModule::Process() {
CriticalSectionScoped cs(data_cs_.get()); CriticalSectionScoped cs(data_cs_.get());
last_sync_time_ = TickTime::Now(); last_sync_time_ = TickTime::Now();
int total_video_delay_target_ms = vcm_->Delay(); const int current_video_delay_ms = vcm_->Delay();
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(), WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(),
"Video delay (JB + decoder) is %d ms", "Video delay (JB + decoder) is %d ms", current_video_delay_ms);
total_video_delay_target_ms);
if (voe_channel_id_ == -1) { if (voe_channel_id_ == -1) {
return 0; return 0;
@ -126,6 +125,8 @@ int32_t ViESyncModule::Process() {
__FUNCTION__, voe_channel_id_); __FUNCTION__, voe_channel_id_);
return 0; return 0;
} }
const int current_audio_delay_ms = audio_jitter_buffer_delay_ms +
playout_buffer_delay_ms;
RtpRtcp* voice_rtp_rtcp = NULL; RtpRtcp* voice_rtp_rtcp = NULL;
if (0 != voe_sync_interface_->GetRtpRtcp(voe_channel_id_, voice_rtp_rtcp)) { if (0 != voe_sync_interface_->GetRtpRtcp(voe_channel_id_, voice_rtp_rtcp)) {
@ -148,35 +149,31 @@ int32_t ViESyncModule::Process() {
return 0; return 0;
} }
TRACE_COUNTER1("webrtc", "SyncCurrentVideoDelay", TRACE_COUNTER1("webrtc", "SyncCurrentVideoDelay", current_video_delay_ms);
total_video_delay_target_ms); TRACE_COUNTER1("webrtc", "SyncCurrentAudioDelay", current_audio_delay_ms);
TRACE_COUNTER1("webrtc", "SyncCurrentAudioDelay",
audio_jitter_buffer_delay_ms);
TRACE_COUNTER1("webrtc", "SyncRelativeDelay", relative_delay_ms); TRACE_COUNTER1("webrtc", "SyncRelativeDelay", relative_delay_ms);
int total_audio_delay_target_ms = 0; int target_audio_delay_ms = 0;
int target_video_delay_ms = 0;
// Calculate the necessary extra audio delay and desired total video // Calculate the necessary extra audio delay and desired total video
// delay to get the streams in sync. // delay to get the streams in sync.
int current_audio_delay = audio_jitter_buffer_delay_ms +
playout_buffer_delay_ms;
if (!sync_->ComputeDelays(relative_delay_ms, if (!sync_->ComputeDelays(relative_delay_ms,
current_audio_delay, current_audio_delay_ms,
&total_audio_delay_target_ms, &target_audio_delay_ms,
&total_video_delay_target_ms)) { &target_video_delay_ms)) {
return 0; return 0;
} }
TRACE_COUNTER1("webrtc", "SyncTotalAudioDelayTarget", WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(),
total_audio_delay_target_ms); "Set delay current(a=%d v=%d rel=%d) target(a=%d v=%d)",
TRACE_COUNTER1("webrtc", "SyncTotalVideoDelayTarget", current_audio_delay_ms, current_video_delay_ms,
total_video_delay_target_ms); relative_delay_ms,
target_audio_delay_ms, target_video_delay_ms);
if (voe_sync_interface_->SetMinimumPlayoutDelay( if (voe_sync_interface_->SetMinimumPlayoutDelay(
voe_channel_id_, total_audio_delay_target_ms) == -1) { voe_channel_id_, target_audio_delay_ms) == -1) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, vie_channel_->Id(), WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, vie_channel_->Id(),
"Error setting voice delay"); "Error setting voice delay");
} }
vcm_->SetMinimumPlayoutDelay(total_video_delay_target_ms); vcm_->SetMinimumPlayoutDelay(target_video_delay_ms);
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(),
"New Video delay target is: %d", total_video_delay_target_ms);
return 0; return 0;
} }