stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame^] | 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 | #ifndef WEBRTC_VIDEO_ENGINE_STREAM_SYNCHRONIZATION_H_ |
| 12 | #define WEBRTC_VIDEO_ENGINE_STREAM_SYNCHRONIZATION_H_ |
| 13 | |
| 14 | #include "typedefs.h" |
| 15 | |
| 16 | namespace webrtc { |
| 17 | |
| 18 | struct ViESyncDelay; |
| 19 | |
| 20 | class StreamSynchronization { |
| 21 | public: |
| 22 | struct Measurements { |
| 23 | Measurements() |
| 24 | : received_ntp_secs(0), |
| 25 | received_ntp_frac(0), |
| 26 | rtcp_arrivaltime_secs(0), |
| 27 | rtcp_arrivaltime_frac(0) {} |
| 28 | uint32_t received_ntp_secs; |
| 29 | uint32_t received_ntp_frac; |
| 30 | uint32_t rtcp_arrivaltime_secs; |
| 31 | uint32_t rtcp_arrivaltime_frac; |
| 32 | }; |
| 33 | |
| 34 | StreamSynchronization(int audio_channel_id, int video_channel_id); |
| 35 | ~StreamSynchronization(); |
| 36 | |
| 37 | int ComputeDelays(const Measurements& audio, |
| 38 | int current_audio_delay_ms, |
| 39 | int* extra_audio_delay_ms, |
| 40 | const Measurements& video, |
| 41 | int* total_video_delay_target_ms); |
| 42 | |
| 43 | private: |
| 44 | ViESyncDelay* channel_delay_; |
| 45 | int audio_channel_id_; |
| 46 | int video_channel_id_; |
| 47 | }; |
| 48 | |
| 49 | } // namespace webrtc |
| 50 | |
| 51 | #endif // WEBRTC_VIDEO_ENGINE_STREAM_SYNCHRONIZATION_H_ |