2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-03-01 18:22:48 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
// ViESyncModule is responsible for synchronization audio and video for a given
|
|
|
|
|
// VoE and ViE channel couple.
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
#ifndef WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_
|
|
|
|
|
#define WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
#include "module.h"
|
2011-12-22 14:17:53 +00:00
|
|
|
#include "system_wrappers/interface/scoped_ptr.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
#include "tick_util.h"
|
|
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
namespace webrtc {
|
|
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
class CriticalSectionWrapper;
|
|
|
|
|
class RtpRtcp;
|
|
|
|
|
class VideoCodingModule;
|
|
|
|
|
class VoEVideoSync;
|
|
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
class ViESyncModule : public Module {
|
|
|
|
|
public:
|
2012-05-10 23:01:04 +00:00
|
|
|
ViESyncModule(int id, VideoCodingModule& vcm, RtpRtcp& rtcp_module);
|
2011-11-30 18:31:36 +00:00
|
|
|
~ViESyncModule();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-05-10 23:01:04 +00:00
|
|
|
int SetVoiceChannel(int voe_channel_id, VoEVideoSync* voe_sync_interface);
|
2012-05-10 12:33:50 +00:00
|
|
|
int VoiceChannel();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-05-10 23:01:04 +00:00
|
|
|
// Set how long time, in ms, voice is ahead of video when received on the
|
|
|
|
|
// network. Positive value means audio is ahead of video.
|
|
|
|
|
void SetNetworkDelay(int network_delay);
|
|
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
// Implements Module.
|
2012-05-10 23:01:04 +00:00
|
|
|
virtual WebRtc_Word32 Version(char* version,
|
|
|
|
|
WebRtc_UWord32& remaining_buffer_in_bytes,
|
|
|
|
|
WebRtc_UWord32& position) const;
|
|
|
|
|
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
|
2011-11-30 18:31:36 +00:00
|
|
|
virtual WebRtc_Word32 TimeUntilNextProcess();
|
|
|
|
|
virtual WebRtc_Word32 Process();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
private:
|
2011-12-22 14:17:53 +00:00
|
|
|
scoped_ptr<CriticalSectionWrapper> data_cs_;
|
2012-05-10 23:01:04 +00:00
|
|
|
int id_;
|
|
|
|
|
VideoCodingModule& vcm_;
|
|
|
|
|
RtpRtcp& rtcp_module_;
|
2011-11-30 18:31:36 +00:00
|
|
|
int voe_channel_id_;
|
|
|
|
|
VoEVideoSync* voe_sync_interface_;
|
|
|
|
|
TickTime last_sync_time_;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
struct ViESyncDelay {
|
|
|
|
|
ViESyncDelay() {
|
|
|
|
|
extra_video_delay_ms = 0;
|
|
|
|
|
last_video_delay_ms = 0;
|
|
|
|
|
extra_audio_delay_ms = 0;
|
|
|
|
|
last_sync_delay = 0;
|
|
|
|
|
network_delay = 120;
|
|
|
|
|
}
|
|
|
|
|
int extra_video_delay_ms;
|
|
|
|
|
int last_video_delay_ms;
|
|
|
|
|
int extra_audio_delay_ms;
|
|
|
|
|
int last_sync_delay;
|
|
|
|
|
int network_delay;
|
|
|
|
|
};
|
|
|
|
|
ViESyncDelay channel_delay_;
|
|
|
|
|
};
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
} // namespace webrtc
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-11-30 18:31:36 +00:00
|
|
|
#endif // WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_
|