1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 // ViESyncModule is responsible for synchronization audio and video for a given 12 // VoE and ViE channel couple. 13 14 #ifndef WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_ 15 #define WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_ 16 17 #include "webrtc/modules/interface/module.h" 18 #include "webrtc/system_wrappers/interface/scoped_ptr.h" 19 #include "webrtc/system_wrappers/interface/tick_util.h" 20 #include "webrtc/video_engine/stream_synchronization.h" 21 #include "webrtc/voice_engine/include/voe_video_sync.h" 22 23 namespace webrtc { 24 25 class CriticalSectionWrapper; 26 class RtpRtcp; 27 class VideoCodingModule; 28 class ViEChannel; 29 class VoEVideoSync; 30 31 class ViESyncModule : public Module { 32 public: 33 ViESyncModule(VideoCodingModule* vcm, 34 ViEChannel* vie_channel); 35 ~ViESyncModule(); 36 37 int ConfigureSync(int voe_channel_id, 38 VoEVideoSync* voe_sync_interface, 39 RtpRtcp* video_rtcp_module, 40 RtpReceiver* video_receiver); 41 42 int VoiceChannel(); 43 44 // Set target delay for buffering mode (0 = real-time mode). 45 int SetTargetBufferingDelay(int target_delay_ms); 46 47 // Implements Module. 48 virtual int32_t TimeUntilNextProcess() OVERRIDE; 49 virtual int32_t Process() OVERRIDE; 50 51 private: 52 scoped_ptr<CriticalSectionWrapper> data_cs_; 53 VideoCodingModule* vcm_; 54 ViEChannel* vie_channel_; 55 RtpReceiver* video_receiver_; 56 RtpRtcp* video_rtp_rtcp_; 57 int voe_channel_id_; 58 VoEVideoSync* voe_sync_interface_; 59 TickTime last_sync_time_; 60 scoped_ptr<StreamSynchronization> sync_; 61 StreamSynchronization::Measurements audio_measurement_; 62 StreamSynchronization::Measurements video_measurement_; 63 }; 64 65 } // namespace webrtc 66 67 #endif // WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_ 68