blob: e16d3f2a87f4700e651452ebcfdc7be258616ede [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
leozwang@webrtc.org39e96592012-03-01 18:22:48 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000011// ViESyncModule is responsible for synchronization audio and video for a given
12// VoE and ViE channel couple.
niklase@google.com470e71d2011-07-07 08:21:25 +000013
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000014#ifndef WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_
15#define WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000016
stefan@webrtc.org5f284982012-06-28 07:51:16 +000017#include "modules/interface/module.h"
mflodman@webrtc.orgd32c4472011-12-22 14:17:53 +000018#include "system_wrappers/interface/scoped_ptr.h"
stefan@webrtc.org5f284982012-06-28 07:51:16 +000019#include "system_wrappers/interface/tick_util.h"
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000020#include "video_engine/stream_synchronization.h"
21#include "voice_engine/include/voe_video_sync.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000022
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000023namespace webrtc {
24
niklase@google.com470e71d2011-07-07 08:21:25 +000025class CriticalSectionWrapper;
26class RtpRtcp;
27class VideoCodingModule;
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000028class ViEChannel;
niklase@google.com470e71d2011-07-07 08:21:25 +000029class VoEVideoSync;
30
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000031class ViESyncModule : public Module {
32 public:
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000033 ViESyncModule(VideoCodingModule* vcm,
34 ViEChannel* vie_channel);
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000035 ~ViESyncModule();
niklase@google.com470e71d2011-07-07 08:21:25 +000036
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000037 int ConfigureSync(int voe_channel_id,
38 VoEVideoSync* voe_sync_interface,
39 RtpRtcp* video_rtcp_module);
40
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000041 int VoiceChannel();
niklase@google.com470e71d2011-07-07 08:21:25 +000042
mikhal@webrtc.orgef9f76a2013-02-15 23:22:18 +000043 // Set target delay for buffering mode (0 = real-time mode).
mikhal@webrtc.orgefe4edb2013-03-06 23:29:33 +000044 int SetTargetBufferingDelay(int target_delay_ms);
mikhal@webrtc.orgef9f76a2013-02-15 23:22:18 +000045
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000046 // Implements Module.
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000047 virtual int32_t TimeUntilNextProcess();
48 virtual int32_t Process();
niklase@google.com470e71d2011-07-07 08:21:25 +000049
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000050 private:
mflodman@webrtc.orgd32c4472011-12-22 14:17:53 +000051 scoped_ptr<CriticalSectionWrapper> data_cs_;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000052 VideoCodingModule* vcm_;
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000053 ViEChannel* vie_channel_;
54 RtpRtcp* video_rtp_rtcp_;
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000055 int voe_channel_id_;
56 VoEVideoSync* voe_sync_interface_;
57 TickTime last_sync_time_;
stefan@webrtc.org5f284982012-06-28 07:51:16 +000058 scoped_ptr<StreamSynchronization> sync_;
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000059 StreamSynchronization::Measurements audio_measurement_;
60 StreamSynchronization::Measurements video_measurement_;
niklase@google.com470e71d2011-07-07 08:21:25 +000061};
mflodman@webrtc.org511f82e2011-11-30 18:31:36 +000062
63} // namespace webrtc
64
65#endif // WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_