| OLD | NEW |
| (Empty) |
| 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_VIE_SYNC_MODULE_H_ | |
| 15 #define WEBRTC_VIDEO_VIE_SYNC_MODULE_H_ | |
| 16 | |
| 17 #include <memory> | |
| 18 | |
| 19 #include "webrtc/base/criticalsection.h" | |
| 20 #include "webrtc/modules/include/module.h" | |
| 21 #include "webrtc/video/stream_synchronization.h" | |
| 22 #include "webrtc/voice_engine/include/voe_video_sync.h" | |
| 23 | |
| 24 namespace webrtc { | |
| 25 | |
| 26 class Clock; | |
| 27 class RtpRtcp; | |
| 28 class VideoFrame; | |
| 29 class ViEChannel; | |
| 30 class VoEVideoSync; | |
| 31 | |
| 32 namespace vcm { | |
| 33 class VideoReceiver; | |
| 34 } // namespace vcm | |
| 35 | |
| 36 class ViESyncModule : public Module { | |
| 37 public: | |
| 38 explicit ViESyncModule(vcm::VideoReceiver* vcm); | |
| 39 ~ViESyncModule(); | |
| 40 | |
| 41 void ConfigureSync(int voe_channel_id, | |
| 42 VoEVideoSync* voe_sync_interface, | |
| 43 RtpRtcp* video_rtcp_module, | |
| 44 RtpReceiver* rtp_receiver); | |
| 45 | |
| 46 // Implements Module. | |
| 47 int64_t TimeUntilNextProcess() override; | |
| 48 void Process() override; | |
| 49 | |
| 50 // Gets the sync offset between the current played out audio frame and the | |
| 51 // video |frame|. Returns true on success, false otherwise. | |
| 52 bool GetStreamSyncOffsetInMs(const VideoFrame& frame, | |
| 53 int64_t* stream_offset_ms) const; | |
| 54 | |
| 55 private: | |
| 56 rtc::CriticalSection data_cs_; | |
| 57 vcm::VideoReceiver* const video_receiver_; | |
| 58 Clock* const clock_; | |
| 59 RtpReceiver* rtp_receiver_; | |
| 60 RtpRtcp* video_rtp_rtcp_; | |
| 61 int voe_channel_id_; | |
| 62 VoEVideoSync* voe_sync_interface_; | |
| 63 int64_t last_sync_time_; | |
| 64 std::unique_ptr<StreamSynchronization> sync_; | |
| 65 StreamSynchronization::Measurements audio_measurement_; | |
| 66 StreamSynchronization::Measurements video_measurement_; | |
| 67 }; | |
| 68 | |
| 69 } // namespace webrtc | |
| 70 | |
| 71 #endif // WEBRTC_VIDEO_VIE_SYNC_MODULE_H_ | |
| OLD | NEW |