| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 base_target_delay_ms_(0), | 33 base_target_delay_ms_(0), |
| 34 avg_diff_ms_(0) { | 34 avg_diff_ms_(0) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool StreamSynchronization::ComputeRelativeDelay( | 37 bool StreamSynchronization::ComputeRelativeDelay( |
| 38 const Measurements& audio_measurement, | 38 const Measurements& audio_measurement, |
| 39 const Measurements& video_measurement, | 39 const Measurements& video_measurement, |
| 40 int* relative_delay_ms) { | 40 int* relative_delay_ms) { |
| 41 assert(relative_delay_ms); | 41 assert(relative_delay_ms); |
| 42 int64_t audio_last_capture_time_ms; | 42 int64_t audio_last_capture_time_ms; |
| 43 if (!RtpToNtpMs(audio_measurement.latest_timestamp, | 43 if (!audio_measurement.rtp_to_ntp.Estimate(audio_measurement.latest_timestamp, |
| 44 audio_measurement.rtcp, | 44 &audio_last_capture_time_ms)) { |
| 45 &audio_last_capture_time_ms)) { | |
| 46 return false; | 45 return false; |
| 47 } | 46 } |
| 48 int64_t video_last_capture_time_ms; | 47 int64_t video_last_capture_time_ms; |
| 49 if (!RtpToNtpMs(video_measurement.latest_timestamp, | 48 if (!video_measurement.rtp_to_ntp.Estimate(video_measurement.latest_timestamp, |
| 50 video_measurement.rtcp, | 49 &video_last_capture_time_ms)) { |
| 51 &video_last_capture_time_ms)) { | |
| 52 return false; | 50 return false; |
| 53 } | 51 } |
| 54 if (video_last_capture_time_ms < 0) { | 52 if (video_last_capture_time_ms < 0) { |
| 55 return false; | 53 return false; |
| 56 } | 54 } |
| 57 // Positive diff means that video_measurement is behind audio_measurement. | 55 // Positive diff means that video_measurement is behind audio_measurement. |
| 58 *relative_delay_ms = video_measurement.latest_receive_time_ms - | 56 *relative_delay_ms = video_measurement.latest_receive_time_ms - |
| 59 audio_measurement.latest_receive_time_ms - | 57 audio_measurement.latest_receive_time_ms - |
| 60 (video_last_capture_time_ms - audio_last_capture_time_ms); | 58 (video_last_capture_time_ms - audio_last_capture_time_ms); |
| 61 if (*relative_delay_ms > kMaxDeltaDelayMs || | 59 if (*relative_delay_ms > kMaxDeltaDelayMs || |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 target_delay_ms - base_target_delay_ms_; | 189 target_delay_ms - base_target_delay_ms_; |
| 192 | 190 |
| 193 channel_delay_.extra_video_delay_ms += | 191 channel_delay_.extra_video_delay_ms += |
| 194 target_delay_ms - base_target_delay_ms_; | 192 target_delay_ms - base_target_delay_ms_; |
| 195 | 193 |
| 196 // Video is already delayed by the desired amount. | 194 // Video is already delayed by the desired amount. |
| 197 base_target_delay_ms_ = target_delay_ms; | 195 base_target_delay_ms_ = target_delay_ms; |
| 198 } | 196 } |
| 199 | 197 |
| 200 } // namespace webrtc | 198 } // namespace webrtc |
| OLD | NEW |