blob: e16d3f2a87f4700e651452ebcfdc7be258616ede [file] [log] [blame]
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +00001/*
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 "modules/interface/module.h"
18#include "system_wrappers/interface/scoped_ptr.h"
19#include "system_wrappers/interface/tick_util.h"
20#include "video_engine/stream_synchronization.h"
21#include "voice_engine/include/voe_video_sync.h"
22
23namespace webrtc {
24
25class CriticalSectionWrapper;
26class RtpRtcp;
27class VideoCodingModule;
28class ViEChannel;
29class VoEVideoSync;
30
31class 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
41 int VoiceChannel();
42
mikhal@webrtc.org4db69af2013-02-15 23:22:18 +000043 // Set target delay for buffering mode (0 = real-time mode).
mikhal@webrtc.orgace08232013-03-06 23:29:33 +000044 int SetTargetBufferingDelay(int target_delay_ms);
mikhal@webrtc.org4db69af2013-02-15 23:22:18 +000045
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000046 // Implements Module.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +000047 virtual int32_t TimeUntilNextProcess();
48 virtual int32_t Process();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000049
50 private:
51 scoped_ptr<CriticalSectionWrapper> data_cs_;
52 VideoCodingModule* vcm_;
53 ViEChannel* vie_channel_;
54 RtpRtcp* video_rtp_rtcp_;
55 int voe_channel_id_;
56 VoEVideoSync* voe_sync_interface_;
57 TickTime last_sync_time_;
58 scoped_ptr<StreamSynchronization> sync_;
59 StreamSynchronization::Measurements audio_measurement_;
60 StreamSynchronization::Measurements video_measurement_;
61};
62
63} // namespace webrtc
64
65#endif // WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_