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 | |
pbos@webrtc.org | f5d4cb1 | 2013-05-17 13:44:48 +0000 | [diff] [blame] | 11 | #include <math.h> |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 12 | |
kjellander@webrtc.org | 0fcaf99 | 2015-11-26 15:24:52 +0100 | [diff] [blame] | 13 | #include <algorithm> |
| 14 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 15 | #include "test/gtest.h" |
| 16 | #include "video/stream_synchronization.h" |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | |
| 20 | // These correspond to the same constants defined in vie_sync_module.cc. |
| 21 | enum { kMaxVideoDiffMs = 80 }; |
| 22 | enum { kMaxAudioDiffMs = 80 }; |
| 23 | enum { kMaxDelay = 1500 }; |
| 24 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 25 | // Test constants. |
| 26 | enum { kDefaultAudioFrequency = 8000 }; |
| 27 | enum { kDefaultVideoFrequency = 90000 }; |
| 28 | const double kNtpFracPerMs = 4.294967296E6; |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 29 | static const int kSmoothingFilter = 4 * 2; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 30 | |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 31 | class Time { |
| 32 | public: |
| 33 | explicit Time(int64_t offset) |
| 34 | : kNtpJan1970(2208988800UL), |
| 35 | time_now_ms_(offset) {} |
| 36 | |
asapersson | b7e7b49 | 2016-11-17 02:27:14 -0800 | [diff] [blame] | 37 | NtpTime GetNowNtp() const { |
| 38 | uint32_t ntp_secs = time_now_ms_ / 1000 + kNtpJan1970; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 39 | int64_t remainder_ms = time_now_ms_ % 1000; |
asapersson | b7e7b49 | 2016-11-17 02:27:14 -0800 | [diff] [blame] | 40 | uint32_t ntp_frac = static_cast<uint32_t>( |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 41 | static_cast<double>(remainder_ms) * kNtpFracPerMs + 0.5); |
asapersson | b7e7b49 | 2016-11-17 02:27:14 -0800 | [diff] [blame] | 42 | return NtpTime(ntp_secs, ntp_frac); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 43 | } |
| 44 | |
asapersson | b7e7b49 | 2016-11-17 02:27:14 -0800 | [diff] [blame] | 45 | uint32_t GetNowRtp(int frequency, uint32_t offset) const { |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 46 | return frequency * time_now_ms_ / 1000 + offset; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | void IncreaseTimeMs(int64_t inc) { |
| 50 | time_now_ms_ += inc; |
| 51 | } |
| 52 | |
| 53 | int64_t time_now_ms() const { |
| 54 | return time_now_ms_; |
| 55 | } |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 56 | |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 57 | private: |
| 58 | // January 1970, in NTP seconds. |
| 59 | const uint32_t kNtpJan1970; |
| 60 | int64_t time_now_ms_; |
| 61 | }; |
| 62 | |
| 63 | class StreamSynchronizationTest : public ::testing::Test { |
| 64 | protected: |
| 65 | virtual void SetUp() { |
| 66 | sync_ = new StreamSynchronization(0, 0); |
| 67 | send_time_ = new Time(kSendTimeOffsetMs); |
| 68 | receive_time_ = new Time(kReceiveTimeOffsetMs); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 69 | audio_clock_drift_ = 1.0; |
| 70 | video_clock_drift_ = 1.0; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | virtual void TearDown() { |
| 74 | delete sync_; |
| 75 | delete send_time_; |
| 76 | delete receive_time_; |
| 77 | } |
| 78 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 79 | // Generates the necessary RTCP measurements and RTP timestamps and computes |
| 80 | // the audio and video delays needed to get the two streams in sync. |
| 81 | // |audio_delay_ms| and |video_delay_ms| are the number of milliseconds after |
| 82 | // capture which the frames are rendered. |
| 83 | // |current_audio_delay_ms| is the number of milliseconds which audio is |
| 84 | // currently being delayed by the receiver. |
| 85 | bool DelayedStreams(int audio_delay_ms, |
| 86 | int video_delay_ms, |
| 87 | int current_audio_delay_ms, |
| 88 | int* extra_audio_delay_ms, |
| 89 | int* total_video_delay_ms) { |
| 90 | int audio_frequency = static_cast<int>(kDefaultAudioFrequency * |
| 91 | audio_clock_drift_ + 0.5); |
| 92 | int audio_offset = 0; |
| 93 | int video_frequency = static_cast<int>(kDefaultVideoFrequency * |
| 94 | video_clock_drift_ + 0.5); |
asapersson | de9e5ff | 2016-11-02 07:14:03 -0700 | [diff] [blame] | 95 | bool new_sr; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 96 | int video_offset = 0; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 97 | StreamSynchronization::Measurements audio; |
| 98 | StreamSynchronization::Measurements video; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 99 | // Generate NTP/RTP timestamp pair for both streams corresponding to RTCP. |
asapersson | fe50b4d | 2016-12-22 07:53:51 -0800 | [diff] [blame] | 100 | NtpTime ntp_time = send_time_->GetNowNtp(); |
| 101 | uint32_t rtp_timestamp = |
| 102 | send_time_->GetNowRtp(audio_frequency, audio_offset); |
| 103 | EXPECT_TRUE(audio.rtp_to_ntp.UpdateMeasurements( |
| 104 | ntp_time.seconds(), ntp_time.fractions(), rtp_timestamp, &new_sr)); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 105 | send_time_->IncreaseTimeMs(100); |
| 106 | receive_time_->IncreaseTimeMs(100); |
asapersson | fe50b4d | 2016-12-22 07:53:51 -0800 | [diff] [blame] | 107 | ntp_time = send_time_->GetNowNtp(); |
| 108 | rtp_timestamp = send_time_->GetNowRtp(video_frequency, video_offset); |
| 109 | EXPECT_TRUE(video.rtp_to_ntp.UpdateMeasurements( |
| 110 | ntp_time.seconds(), ntp_time.fractions(), rtp_timestamp, &new_sr)); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 111 | send_time_->IncreaseTimeMs(900); |
| 112 | receive_time_->IncreaseTimeMs(900); |
asapersson | fe50b4d | 2016-12-22 07:53:51 -0800 | [diff] [blame] | 113 | ntp_time = send_time_->GetNowNtp(); |
| 114 | rtp_timestamp = send_time_->GetNowRtp(audio_frequency, audio_offset); |
| 115 | EXPECT_TRUE(audio.rtp_to_ntp.UpdateMeasurements( |
| 116 | ntp_time.seconds(), ntp_time.fractions(), rtp_timestamp, &new_sr)); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 117 | send_time_->IncreaseTimeMs(100); |
| 118 | receive_time_->IncreaseTimeMs(100); |
asapersson | fe50b4d | 2016-12-22 07:53:51 -0800 | [diff] [blame] | 119 | ntp_time = send_time_->GetNowNtp(); |
| 120 | rtp_timestamp = send_time_->GetNowRtp(video_frequency, video_offset); |
| 121 | EXPECT_TRUE(video.rtp_to_ntp.UpdateMeasurements( |
| 122 | ntp_time.seconds(), ntp_time.fractions(), rtp_timestamp, &new_sr)); |
asapersson | b7e7b49 | 2016-11-17 02:27:14 -0800 | [diff] [blame] | 123 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 124 | send_time_->IncreaseTimeMs(900); |
| 125 | receive_time_->IncreaseTimeMs(900); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 126 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 127 | // Capture an audio and a video frame at the same time. |
asapersson | b7e7b49 | 2016-11-17 02:27:14 -0800 | [diff] [blame] | 128 | audio.latest_timestamp = |
| 129 | send_time_->GetNowRtp(audio_frequency, audio_offset); |
| 130 | video.latest_timestamp = |
| 131 | send_time_->GetNowRtp(video_frequency, video_offset); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 132 | |
| 133 | if (audio_delay_ms > video_delay_ms) { |
| 134 | // Audio later than video. |
| 135 | receive_time_->IncreaseTimeMs(video_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 136 | video.latest_receive_time_ms = receive_time_->time_now_ms(); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 137 | receive_time_->IncreaseTimeMs(audio_delay_ms - video_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 138 | audio.latest_receive_time_ms = receive_time_->time_now_ms(); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 139 | } else { |
| 140 | // Video later than audio. |
| 141 | receive_time_->IncreaseTimeMs(audio_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 142 | audio.latest_receive_time_ms = receive_time_->time_now_ms(); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 143 | receive_time_->IncreaseTimeMs(video_delay_ms - audio_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 144 | video.latest_receive_time_ms = receive_time_->time_now_ms(); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 145 | } |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 146 | int relative_delay_ms; |
| 147 | StreamSynchronization::ComputeRelativeDelay(audio, video, |
| 148 | &relative_delay_ms); |
| 149 | EXPECT_EQ(video_delay_ms - audio_delay_ms, relative_delay_ms); |
| 150 | return sync_->ComputeDelays(relative_delay_ms, |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 151 | current_audio_delay_ms, |
| 152 | extra_audio_delay_ms, |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 153 | total_video_delay_ms); |
| 154 | } |
| 155 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 156 | // Simulate audio playback 300 ms after capture and video rendering 100 ms |
| 157 | // after capture. Verify that the correct extra delays are calculated for |
| 158 | // audio and video, and that they change correctly when we simulate that |
| 159 | // NetEQ or the VCM adds more delay to the streams. |
| 160 | // TODO(holmer): This is currently wrong! We should simply change |
| 161 | // audio_delay_ms or video_delay_ms since those now include VCM and NetEQ |
| 162 | // delays. |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 163 | void BothDelayedAudioLaterTest(int base_target_delay) { |
| 164 | int current_audio_delay_ms = base_target_delay; |
| 165 | int audio_delay_ms = base_target_delay + 300; |
| 166 | int video_delay_ms = base_target_delay + 100; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 167 | int extra_audio_delay_ms = 0; |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 168 | int total_video_delay_ms = base_target_delay; |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 169 | int filtered_move = (audio_delay_ms - video_delay_ms) / kSmoothingFilter; |
pwestin@webrtc.org | 4e545b3 | 2013-04-26 15:23:34 +0000 | [diff] [blame] | 170 | const int kNeteqDelayIncrease = 50; |
| 171 | const int kNeteqDelayDecrease = 10; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 172 | |
| 173 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 174 | video_delay_ms, |
| 175 | current_audio_delay_ms, |
| 176 | &extra_audio_delay_ms, |
| 177 | &total_video_delay_ms)); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 178 | EXPECT_EQ(base_target_delay + filtered_move, total_video_delay_ms); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 179 | EXPECT_EQ(base_target_delay, extra_audio_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 180 | current_audio_delay_ms = extra_audio_delay_ms; |
| 181 | |
| 182 | send_time_->IncreaseTimeMs(1000); |
| 183 | receive_time_->IncreaseTimeMs(1000 - std::max(audio_delay_ms, |
| 184 | video_delay_ms)); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 185 | // Simulate base_target_delay minimum delay in the VCM. |
| 186 | total_video_delay_ms = base_target_delay; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 187 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 188 | video_delay_ms, |
| 189 | current_audio_delay_ms, |
| 190 | &extra_audio_delay_ms, |
| 191 | &total_video_delay_ms)); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 192 | EXPECT_EQ(base_target_delay + 2 * filtered_move, total_video_delay_ms); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 193 | EXPECT_EQ(base_target_delay, extra_audio_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 194 | current_audio_delay_ms = extra_audio_delay_ms; |
| 195 | |
| 196 | send_time_->IncreaseTimeMs(1000); |
| 197 | receive_time_->IncreaseTimeMs(1000 - std::max(audio_delay_ms, |
| 198 | video_delay_ms)); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 199 | // Simulate base_target_delay minimum delay in the VCM. |
| 200 | total_video_delay_ms = base_target_delay; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 201 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 202 | video_delay_ms, |
| 203 | current_audio_delay_ms, |
| 204 | &extra_audio_delay_ms, |
| 205 | &total_video_delay_ms)); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 206 | EXPECT_EQ(base_target_delay + 3 * filtered_move, total_video_delay_ms); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 207 | EXPECT_EQ(base_target_delay, extra_audio_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 208 | |
| 209 | // Simulate that NetEQ introduces some audio delay. |
pwestin@webrtc.org | 4e545b3 | 2013-04-26 15:23:34 +0000 | [diff] [blame] | 210 | current_audio_delay_ms = base_target_delay + kNeteqDelayIncrease; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 211 | send_time_->IncreaseTimeMs(1000); |
| 212 | receive_time_->IncreaseTimeMs(1000 - std::max(audio_delay_ms, |
| 213 | video_delay_ms)); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 214 | // Simulate base_target_delay minimum delay in the VCM. |
| 215 | total_video_delay_ms = base_target_delay; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 216 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 217 | video_delay_ms, |
| 218 | current_audio_delay_ms, |
| 219 | &extra_audio_delay_ms, |
| 220 | &total_video_delay_ms)); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 221 | filtered_move = 3 * filtered_move + |
pwestin@webrtc.org | 4e545b3 | 2013-04-26 15:23:34 +0000 | [diff] [blame] | 222 | (kNeteqDelayIncrease + audio_delay_ms - video_delay_ms) / |
| 223 | kSmoothingFilter; |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 224 | EXPECT_EQ(base_target_delay + filtered_move, total_video_delay_ms); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 225 | EXPECT_EQ(base_target_delay, extra_audio_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 226 | |
| 227 | // Simulate that NetEQ reduces its delay. |
pwestin@webrtc.org | 4e545b3 | 2013-04-26 15:23:34 +0000 | [diff] [blame] | 228 | current_audio_delay_ms = base_target_delay + kNeteqDelayDecrease; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 229 | send_time_->IncreaseTimeMs(1000); |
| 230 | receive_time_->IncreaseTimeMs(1000 - std::max(audio_delay_ms, |
| 231 | video_delay_ms)); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 232 | // Simulate base_target_delay minimum delay in the VCM. |
| 233 | total_video_delay_ms = base_target_delay; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 234 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 235 | video_delay_ms, |
| 236 | current_audio_delay_ms, |
| 237 | &extra_audio_delay_ms, |
| 238 | &total_video_delay_ms)); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 239 | |
| 240 | filtered_move = filtered_move + |
pwestin@webrtc.org | 4e545b3 | 2013-04-26 15:23:34 +0000 | [diff] [blame] | 241 | (kNeteqDelayDecrease + audio_delay_ms - video_delay_ms) / |
| 242 | kSmoothingFilter; |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 243 | |
| 244 | EXPECT_EQ(base_target_delay + filtered_move, total_video_delay_ms); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 245 | EXPECT_EQ(base_target_delay, extra_audio_delay_ms); |
| 246 | } |
| 247 | |
| 248 | void BothDelayedVideoLaterTest(int base_target_delay) { |
| 249 | int current_audio_delay_ms = base_target_delay; |
| 250 | int audio_delay_ms = base_target_delay + 100; |
| 251 | int video_delay_ms = base_target_delay + 300; |
| 252 | int extra_audio_delay_ms = 0; |
| 253 | int total_video_delay_ms = base_target_delay; |
| 254 | |
| 255 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 256 | video_delay_ms, |
| 257 | current_audio_delay_ms, |
| 258 | &extra_audio_delay_ms, |
| 259 | &total_video_delay_ms)); |
| 260 | EXPECT_EQ(base_target_delay, total_video_delay_ms); |
| 261 | // The audio delay is not allowed to change more than this in 1 second. |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 262 | EXPECT_GE(base_target_delay + kMaxAudioDiffMs, extra_audio_delay_ms); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 263 | current_audio_delay_ms = extra_audio_delay_ms; |
| 264 | int current_extra_delay_ms = extra_audio_delay_ms; |
| 265 | |
| 266 | send_time_->IncreaseTimeMs(1000); |
| 267 | receive_time_->IncreaseTimeMs(800); |
| 268 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 269 | video_delay_ms, |
| 270 | current_audio_delay_ms, |
| 271 | &extra_audio_delay_ms, |
| 272 | &total_video_delay_ms)); |
| 273 | EXPECT_EQ(base_target_delay, total_video_delay_ms); |
| 274 | // The audio delay is not allowed to change more than the half of the |
| 275 | // required change in delay. |
| 276 | EXPECT_EQ(current_extra_delay_ms + MaxAudioDelayIncrease( |
| 277 | current_audio_delay_ms, |
| 278 | base_target_delay + video_delay_ms - audio_delay_ms), |
| 279 | extra_audio_delay_ms); |
| 280 | current_audio_delay_ms = extra_audio_delay_ms; |
| 281 | current_extra_delay_ms = extra_audio_delay_ms; |
| 282 | |
| 283 | send_time_->IncreaseTimeMs(1000); |
| 284 | receive_time_->IncreaseTimeMs(800); |
| 285 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 286 | video_delay_ms, |
| 287 | current_audio_delay_ms, |
| 288 | &extra_audio_delay_ms, |
| 289 | &total_video_delay_ms)); |
| 290 | EXPECT_EQ(base_target_delay, total_video_delay_ms); |
| 291 | // The audio delay is not allowed to change more than the half of the |
| 292 | // required change in delay. |
| 293 | EXPECT_EQ(current_extra_delay_ms + MaxAudioDelayIncrease( |
| 294 | current_audio_delay_ms, |
| 295 | base_target_delay + video_delay_ms - audio_delay_ms), |
| 296 | extra_audio_delay_ms); |
| 297 | current_extra_delay_ms = extra_audio_delay_ms; |
| 298 | |
| 299 | // Simulate that NetEQ for some reason reduced the delay. |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 300 | current_audio_delay_ms = base_target_delay + 10; |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 301 | send_time_->IncreaseTimeMs(1000); |
| 302 | receive_time_->IncreaseTimeMs(800); |
| 303 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 304 | video_delay_ms, |
| 305 | current_audio_delay_ms, |
| 306 | &extra_audio_delay_ms, |
| 307 | &total_video_delay_ms)); |
| 308 | EXPECT_EQ(base_target_delay, total_video_delay_ms); |
| 309 | // Since we only can ask NetEQ for a certain amount of extra delay, and |
| 310 | // we only measure the total NetEQ delay, we will ask for additional delay |
| 311 | // here to try to stay in sync. |
| 312 | EXPECT_EQ(current_extra_delay_ms + MaxAudioDelayIncrease( |
| 313 | current_audio_delay_ms, |
| 314 | base_target_delay + video_delay_ms - audio_delay_ms), |
| 315 | extra_audio_delay_ms); |
| 316 | current_extra_delay_ms = extra_audio_delay_ms; |
| 317 | |
| 318 | // Simulate that NetEQ for some reason significantly increased the delay. |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 319 | current_audio_delay_ms = base_target_delay + 350; |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 320 | send_time_->IncreaseTimeMs(1000); |
| 321 | receive_time_->IncreaseTimeMs(800); |
| 322 | EXPECT_TRUE(DelayedStreams(audio_delay_ms, |
| 323 | video_delay_ms, |
| 324 | current_audio_delay_ms, |
| 325 | &extra_audio_delay_ms, |
| 326 | &total_video_delay_ms)); |
| 327 | EXPECT_EQ(base_target_delay, total_video_delay_ms); |
| 328 | // The audio delay is not allowed to change more than the half of the |
| 329 | // required change in delay. |
| 330 | EXPECT_EQ(current_extra_delay_ms + MaxAudioDelayIncrease( |
| 331 | current_audio_delay_ms, |
| 332 | base_target_delay + video_delay_ms - audio_delay_ms), |
| 333 | extra_audio_delay_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 334 | } |
| 335 | |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 336 | int MaxAudioDelayIncrease(int current_audio_delay_ms, int delay_ms) { |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 337 | return std::min((delay_ms - current_audio_delay_ms) / kSmoothingFilter, |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 338 | static_cast<int>(kMaxAudioDiffMs)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | int MaxAudioDelayDecrease(int current_audio_delay_ms, int delay_ms) { |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 342 | return std::max((delay_ms - current_audio_delay_ms) / kSmoothingFilter, |
| 343 | -kMaxAudioDiffMs); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 344 | } |
| 345 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 346 | enum { kSendTimeOffsetMs = 98765 }; |
| 347 | enum { kReceiveTimeOffsetMs = 43210 }; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 348 | |
| 349 | StreamSynchronization* sync_; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 350 | Time* send_time_; // The simulated clock at the sender. |
| 351 | Time* receive_time_; // The simulated clock at the receiver. |
| 352 | double audio_clock_drift_; |
| 353 | double video_clock_drift_; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 354 | }; |
| 355 | |
| 356 | TEST_F(StreamSynchronizationTest, NoDelay) { |
| 357 | uint32_t current_audio_delay_ms = 0; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 358 | int extra_audio_delay_ms = 0; |
| 359 | int total_video_delay_ms = 0; |
| 360 | |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 361 | EXPECT_FALSE(DelayedStreams(0, 0, current_audio_delay_ms, |
| 362 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 363 | EXPECT_EQ(0, extra_audio_delay_ms); |
| 364 | EXPECT_EQ(0, total_video_delay_ms); |
| 365 | } |
| 366 | |
| 367 | TEST_F(StreamSynchronizationTest, VideoDelay) { |
| 368 | uint32_t current_audio_delay_ms = 0; |
| 369 | int delay_ms = 200; |
| 370 | int extra_audio_delay_ms = 0; |
| 371 | int total_video_delay_ms = 0; |
| 372 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 373 | EXPECT_TRUE(DelayedStreams(delay_ms, 0, current_audio_delay_ms, |
| 374 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 375 | EXPECT_EQ(0, extra_audio_delay_ms); |
| 376 | // The video delay is not allowed to change more than this in 1 second. |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 377 | EXPECT_EQ(delay_ms / kSmoothingFilter, total_video_delay_ms); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 378 | |
| 379 | send_time_->IncreaseTimeMs(1000); |
| 380 | receive_time_->IncreaseTimeMs(800); |
| 381 | // Simulate 0 minimum delay in the VCM. |
| 382 | total_video_delay_ms = 0; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 383 | EXPECT_TRUE(DelayedStreams(delay_ms, 0, current_audio_delay_ms, |
| 384 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 385 | EXPECT_EQ(0, extra_audio_delay_ms); |
| 386 | // The video delay is not allowed to change more than this in 1 second. |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 387 | EXPECT_EQ(2 * delay_ms / kSmoothingFilter, total_video_delay_ms); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 388 | |
| 389 | send_time_->IncreaseTimeMs(1000); |
| 390 | receive_time_->IncreaseTimeMs(800); |
| 391 | // Simulate 0 minimum delay in the VCM. |
| 392 | total_video_delay_ms = 0; |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 393 | EXPECT_TRUE(DelayedStreams(delay_ms, 0, current_audio_delay_ms, |
| 394 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 395 | EXPECT_EQ(0, extra_audio_delay_ms); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 396 | EXPECT_EQ(3 * delay_ms / kSmoothingFilter, total_video_delay_ms); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | TEST_F(StreamSynchronizationTest, AudioDelay) { |
| 400 | int current_audio_delay_ms = 0; |
| 401 | int delay_ms = 200; |
| 402 | int extra_audio_delay_ms = 0; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 403 | int total_video_delay_ms = 0; |
| 404 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 405 | EXPECT_TRUE(DelayedStreams(0, delay_ms, current_audio_delay_ms, |
| 406 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 407 | EXPECT_EQ(0, total_video_delay_ms); |
| 408 | // The audio delay is not allowed to change more than this in 1 second. |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 409 | EXPECT_EQ(delay_ms / kSmoothingFilter, extra_audio_delay_ms); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 410 | current_audio_delay_ms = extra_audio_delay_ms; |
andrew@webrtc.org | d7a71d0 | 2012-08-01 01:40:02 +0000 | [diff] [blame] | 411 | int current_extra_delay_ms = extra_audio_delay_ms; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 412 | |
| 413 | send_time_->IncreaseTimeMs(1000); |
| 414 | receive_time_->IncreaseTimeMs(800); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 415 | EXPECT_TRUE(DelayedStreams(0, delay_ms, current_audio_delay_ms, |
| 416 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 417 | EXPECT_EQ(0, total_video_delay_ms); |
| 418 | // The audio delay is not allowed to change more than the half of the required |
| 419 | // change in delay. |
| 420 | EXPECT_EQ(current_extra_delay_ms + |
| 421 | MaxAudioDelayIncrease(current_audio_delay_ms, delay_ms), |
| 422 | extra_audio_delay_ms); |
| 423 | current_audio_delay_ms = extra_audio_delay_ms; |
| 424 | current_extra_delay_ms = extra_audio_delay_ms; |
| 425 | |
| 426 | send_time_->IncreaseTimeMs(1000); |
| 427 | receive_time_->IncreaseTimeMs(800); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 428 | EXPECT_TRUE(DelayedStreams(0, delay_ms, current_audio_delay_ms, |
| 429 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 430 | EXPECT_EQ(0, total_video_delay_ms); |
| 431 | // The audio delay is not allowed to change more than the half of the required |
| 432 | // change in delay. |
| 433 | EXPECT_EQ(current_extra_delay_ms + |
| 434 | MaxAudioDelayIncrease(current_audio_delay_ms, delay_ms), |
| 435 | extra_audio_delay_ms); |
| 436 | current_extra_delay_ms = extra_audio_delay_ms; |
| 437 | |
| 438 | // Simulate that NetEQ for some reason reduced the delay. |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 439 | current_audio_delay_ms = 10; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 440 | send_time_->IncreaseTimeMs(1000); |
| 441 | receive_time_->IncreaseTimeMs(800); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 442 | EXPECT_TRUE(DelayedStreams(0, delay_ms, current_audio_delay_ms, |
| 443 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 444 | EXPECT_EQ(0, total_video_delay_ms); |
| 445 | // Since we only can ask NetEQ for a certain amount of extra delay, and |
| 446 | // we only measure the total NetEQ delay, we will ask for additional delay |
| 447 | // here to try to |
| 448 | EXPECT_EQ(current_extra_delay_ms + |
| 449 | MaxAudioDelayIncrease(current_audio_delay_ms, delay_ms), |
| 450 | extra_audio_delay_ms); |
| 451 | current_extra_delay_ms = extra_audio_delay_ms; |
| 452 | |
| 453 | // Simulate that NetEQ for some reason significantly increased the delay. |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 454 | current_audio_delay_ms = 350; |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 455 | send_time_->IncreaseTimeMs(1000); |
| 456 | receive_time_->IncreaseTimeMs(800); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 457 | EXPECT_TRUE(DelayedStreams(0, delay_ms, current_audio_delay_ms, |
| 458 | &extra_audio_delay_ms, &total_video_delay_ms)); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 459 | EXPECT_EQ(0, total_video_delay_ms); |
| 460 | // The audio delay is not allowed to change more than the half of the required |
| 461 | // change in delay. |
| 462 | EXPECT_EQ(current_extra_delay_ms + |
| 463 | MaxAudioDelayDecrease(current_audio_delay_ms, delay_ms), |
| 464 | extra_audio_delay_ms); |
| 465 | } |
| 466 | |
| 467 | TEST_F(StreamSynchronizationTest, BothDelayedVideoLater) { |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 468 | BothDelayedVideoLaterTest(0); |
| 469 | } |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 470 | |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 471 | TEST_F(StreamSynchronizationTest, BothDelayedVideoLaterAudioClockDrift) { |
| 472 | audio_clock_drift_ = 1.05; |
| 473 | BothDelayedVideoLaterTest(0); |
| 474 | } |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 475 | |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 476 | TEST_F(StreamSynchronizationTest, BothDelayedVideoLaterVideoClockDrift) { |
| 477 | video_clock_drift_ = 1.05; |
| 478 | BothDelayedVideoLaterTest(0); |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 479 | } |
| 480 | |
| 481 | TEST_F(StreamSynchronizationTest, BothDelayedAudioLater) { |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 482 | BothDelayedAudioLaterTest(0); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 483 | } |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 484 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 485 | TEST_F(StreamSynchronizationTest, BothDelayedAudioClockDrift) { |
| 486 | audio_clock_drift_ = 1.05; |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 487 | BothDelayedAudioLaterTest(0); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 488 | } |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 489 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 490 | TEST_F(StreamSynchronizationTest, BothDelayedVideoClockDrift) { |
| 491 | video_clock_drift_ = 1.05; |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 492 | BothDelayedAudioLaterTest(0); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 493 | } |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 494 | |
| 495 | TEST_F(StreamSynchronizationTest, BaseDelay) { |
| 496 | int base_target_delay_ms = 2000; |
| 497 | int current_audio_delay_ms = 2000; |
| 498 | int extra_audio_delay_ms = 0; |
| 499 | int total_video_delay_ms = base_target_delay_ms; |
| 500 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 501 | // We are in sync don't change. |
| 502 | EXPECT_FALSE(DelayedStreams(base_target_delay_ms, base_target_delay_ms, |
| 503 | current_audio_delay_ms, |
| 504 | &extra_audio_delay_ms, &total_video_delay_ms)); |
mikhal@webrtc.org | 0d8d010 | 2013-02-22 19:30:44 +0000 | [diff] [blame] | 505 | // Triggering another call with the same values. Delay should not be modified. |
| 506 | base_target_delay_ms = 2000; |
| 507 | current_audio_delay_ms = base_target_delay_ms; |
| 508 | total_video_delay_ms = base_target_delay_ms; |
| 509 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 510 | // We are in sync don't change. |
| 511 | EXPECT_FALSE(DelayedStreams(base_target_delay_ms, base_target_delay_ms, |
| 512 | current_audio_delay_ms, |
| 513 | &extra_audio_delay_ms, &total_video_delay_ms)); |
mikhal@webrtc.org | 0d8d010 | 2013-02-22 19:30:44 +0000 | [diff] [blame] | 514 | // Changing delay value - intended to test this module only. In practice it |
| 515 | // would take VoE time to adapt. |
| 516 | base_target_delay_ms = 5000; |
| 517 | current_audio_delay_ms = base_target_delay_ms; |
| 518 | total_video_delay_ms = base_target_delay_ms; |
| 519 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
pwestin@webrtc.org | 6311733 | 2013-04-22 18:57:14 +0000 | [diff] [blame] | 520 | // We are in sync don't change. |
| 521 | EXPECT_FALSE(DelayedStreams(base_target_delay_ms, base_target_delay_ms, |
| 522 | current_audio_delay_ms, |
| 523 | &extra_audio_delay_ms, &total_video_delay_ms)); |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | TEST_F(StreamSynchronizationTest, BothDelayedAudioLaterWithBaseDelay) { |
| 527 | int base_target_delay_ms = 3000; |
| 528 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
| 529 | BothDelayedAudioLaterTest(base_target_delay_ms); |
| 530 | } |
| 531 | |
| 532 | TEST_F(StreamSynchronizationTest, BothDelayedAudioClockDriftWithBaseDelay) { |
| 533 | int base_target_delay_ms = 3000; |
| 534 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
| 535 | audio_clock_drift_ = 1.05; |
| 536 | BothDelayedAudioLaterTest(base_target_delay_ms); |
| 537 | } |
| 538 | |
| 539 | TEST_F(StreamSynchronizationTest, BothDelayedVideoClockDriftWithBaseDelay) { |
| 540 | int base_target_delay_ms = 3000; |
| 541 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
| 542 | video_clock_drift_ = 1.05; |
| 543 | BothDelayedAudioLaterTest(base_target_delay_ms); |
| 544 | } |
| 545 | |
| 546 | TEST_F(StreamSynchronizationTest, BothDelayedVideoLaterWithBaseDelay) { |
| 547 | int base_target_delay_ms = 2000; |
| 548 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
| 549 | BothDelayedVideoLaterTest(base_target_delay_ms); |
| 550 | } |
| 551 | |
| 552 | TEST_F(StreamSynchronizationTest, |
| 553 | BothDelayedVideoLaterAudioClockDriftWithBaseDelay) { |
| 554 | int base_target_delay_ms = 2000; |
| 555 | audio_clock_drift_ = 1.05; |
| 556 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
| 557 | BothDelayedVideoLaterTest(base_target_delay_ms); |
| 558 | } |
| 559 | |
| 560 | TEST_F(StreamSynchronizationTest, |
| 561 | BothDelayedVideoLaterVideoClockDriftWithBaseDelay) { |
| 562 | int base_target_delay_ms = 2000; |
| 563 | video_clock_drift_ = 1.05; |
| 564 | sync_->SetTargetBufferingDelay(base_target_delay_ms); |
| 565 | BothDelayedVideoLaterTest(base_target_delay_ms); |
| 566 | } |
| 567 | |
stefan@webrtc.org | 5f28498 | 2012-06-28 07:51:16 +0000 | [diff] [blame] | 568 | } // namespace webrtc |