Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 // ViESyncModule is responsible for synchronization audio and video for a given | 11 // ViESyncModule is responsible for synchronization audio and video for a given |
| 12 // VoE and ViE channel couple. | 12 // VoE and ViE channel couple. |
| 13 | 13 |
| 14 #ifndef WEBRTC_VIDEO_VIE_SYNC_MODULE_H_ | 14 #ifndef WEBRTC_VIDEO_VIE_SYNC_MODULE_H_ |
| 15 #define WEBRTC_VIDEO_VIE_SYNC_MODULE_H_ | 15 #define WEBRTC_VIDEO_VIE_SYNC_MODULE_H_ |
| 16 | 16 |
| 17 #include "webrtc/base/criticalsection.h" | 17 #include "webrtc/base/criticalsection.h" |
| 18 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
| 19 #include "webrtc/modules/include/module.h" | 19 #include "webrtc/modules/include/module.h" |
| 20 #include "webrtc/system_wrappers/include/tick_util.h" | 20 #include "webrtc/system_wrappers/include/tick_util.h" |
| 21 #include "webrtc/video/stream_synchronization.h" | 21 #include "webrtc/video/stream_synchronization.h" |
| 22 #include "webrtc/voice_engine/include/voe_video_sync.h" | 22 #include "webrtc/voice_engine/include/voe_video_sync.h" |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 | 25 |
| 26 class Clock; | |
| 26 class RtpRtcp; | 27 class RtpRtcp; |
| 27 class VideoCodingModule; | 28 class VideoCodingModule; |
| 29 class VideoFrame; | |
| 28 class ViEChannel; | 30 class ViEChannel; |
| 29 class VoEVideoSync; | 31 class VoEVideoSync; |
| 30 | 32 |
| 31 class ViESyncModule : public Module { | 33 class ViESyncModule : public Module { |
| 32 public: | 34 public: |
| 33 explicit ViESyncModule(VideoCodingModule* vcm); | 35 explicit ViESyncModule(VideoCodingModule* vcm); |
| 34 ~ViESyncModule(); | 36 ~ViESyncModule(); |
| 35 | 37 |
| 36 void ConfigureSync(int voe_channel_id, | 38 void ConfigureSync(int voe_channel_id, |
| 37 VoEVideoSync* voe_sync_interface, | 39 VoEVideoSync* voe_sync_interface, |
| 38 RtpRtcp* video_rtcp_module, | 40 RtpRtcp* video_rtcp_module, |
| 39 RtpReceiver* video_receiver); | 41 RtpReceiver* video_receiver); |
| 40 | 42 |
| 41 // Implements Module. | 43 // Implements Module. |
| 42 int64_t TimeUntilNextProcess() override; | 44 int64_t TimeUntilNextProcess() override; |
| 43 void Process() override; | 45 void Process() override; |
| 44 | 46 |
| 47 // Returns the absolute value of the sync offset between the video |frame| and | |
| 48 // the current played out audio frame (or -1 on error). | |
|
pbos-webrtc
2016/03/04 14:34:27
-1 if not configured/in use?
åsapersson
2016/03/09 15:44:35
Done.
| |
| 49 int64_t GetStreamSyncOffsetInMs(const VideoFrame& frame); | |
|
stefan-webrtc
2016/03/04 14:32:17
Would it be reasonable to request a unittest here
åsapersson
2016/03/09 15:44:35
I will look into adding unittest for this class. M
stefan-webrtc
2016/03/09 15:59:30
Sure no problem.
| |
| 50 | |
| 45 private: | 51 private: |
| 46 rtc::CriticalSection data_cs_; | 52 rtc::CriticalSection data_cs_; |
| 47 VideoCodingModule* const vcm_; | 53 VideoCodingModule* const vcm_; |
| 54 Clock* const clock_; | |
| 48 RtpReceiver* video_receiver_; | 55 RtpReceiver* video_receiver_; |
| 49 RtpRtcp* video_rtp_rtcp_; | 56 RtpRtcp* video_rtp_rtcp_; |
| 50 int voe_channel_id_; | 57 int voe_channel_id_; |
| 51 VoEVideoSync* voe_sync_interface_; | 58 VoEVideoSync* voe_sync_interface_; |
| 52 TickTime last_sync_time_; | 59 TickTime last_sync_time_; |
| 53 rtc::scoped_ptr<StreamSynchronization> sync_; | 60 rtc::scoped_ptr<StreamSynchronization> sync_; |
| 54 StreamSynchronization::Measurements audio_measurement_; | 61 StreamSynchronization::Measurements audio_measurement_; |
| 55 StreamSynchronization::Measurements video_measurement_; | 62 StreamSynchronization::Measurements video_measurement_; |
| 56 }; | 63 }; |
| 57 | 64 |
| 58 } // namespace webrtc | 65 } // namespace webrtc |
| 59 | 66 |
| 60 #endif // WEBRTC_VIDEO_VIE_SYNC_MODULE_H_ | 67 #endif // WEBRTC_VIDEO_VIE_SYNC_MODULE_H_ |
| OLD | NEW |