From ead8a5bbdcdf3ac429c23af04d4a91f3de334f28 Mon Sep 17 00:00:00 2001 From: "turaj@webrtc.org" Date: Tue, 12 Feb 2013 21:42:18 +0000 Subject: Implement initial delay. This CL allows clients of VoE to set an initial delay. Playout of audio is delayed and the extra playout delay is maintained during the call. While packets are buffered (in NetEq) to acheive the desired delay. ACM will playout silence (zeros). Initial delay has to be set before any packet is pushed into ACM. TEST=ACM unit test is added, also a manual integration test is writen. Review URL: https://webrtc-codereview.appspot.com/1097009 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@3506 4adac7df-926f-26a2-2b94-8c16560cd09d --- voice_engine/voe_video_sync_impl.cc | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'voice_engine/voe_video_sync_impl.cc') diff --git a/voice_engine/voe_video_sync_impl.cc b/voice_engine/voe_video_sync_impl.cc index 2a7ff7d8..b0910c31 100644 --- a/voice_engine/voe_video_sync_impl.cc +++ b/voice_engine/voe_video_sync_impl.cc @@ -10,11 +10,11 @@ #include "voe_video_sync_impl.h" -#include "channel.h" -#include "critical_section_wrapper.h" -#include "trace.h" -#include "voe_errors.h" -#include "voice_engine_impl.h" +#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/voice_engine/channel.h" +#include "webrtc/voice_engine/include/voe_errors.h" +#include "webrtc/voice_engine/voice_engine_impl.h" namespace webrtc { @@ -144,6 +144,30 @@ int VoEVideoSyncImpl::SetMinimumPlayoutDelay(int channel,int delayMs) return channelPtr->SetMinimumPlayoutDelay(delayMs); } +int VoEVideoSyncImpl::SetInitialPlayoutDelay(int channel, int delay_ms) +{ + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "SetInitialPlayoutDelay(channel=%d, delay_ms=%d)", + channel, delay_ms); + ANDROID_NOT_SUPPORTED(_shared->statistics()); + IPHONE_NOT_SUPPORTED(_shared->statistics()); + + if (!_shared->statistics().Initialized()) + { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } + voe::ScopedChannel sc(_shared->channel_manager(), channel); + voe::Channel* channel_ptr = sc.ChannelPtr(); + if (channel_ptr == NULL) + { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "SetInitialPlayoutDelay() failed to locate channel"); + return -1; + } + return channel_ptr->SetInitialPlayoutDelay(delay_ms); +} + int VoEVideoSyncImpl::GetDelayEstimate(int channel, int& delayMs) { WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), -- cgit v1.2.3