OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 | 63 |
64 class VCMJitterEstimatorMock : public VCMJitterEstimator { | 64 class VCMJitterEstimatorMock : public VCMJitterEstimator { |
65 public: | 65 public: |
66 explicit VCMJitterEstimatorMock(Clock* clock) : VCMJitterEstimator(clock) {} | 66 explicit VCMJitterEstimatorMock(Clock* clock) : VCMJitterEstimator(clock) {} |
67 | 67 |
68 MOCK_METHOD1(UpdateRtt, void(int64_t rttMs)); | 68 MOCK_METHOD1(UpdateRtt, void(int64_t rttMs)); |
69 MOCK_METHOD3(UpdateEstimate, | 69 MOCK_METHOD3(UpdateEstimate, |
70 void(int64_t frameDelayMs, | 70 void(int64_t frameDelayMs, |
71 uint32_t frameSizeBytes, | 71 uint32_t frameSizeBytes, |
72 bool incompleteFrame)); | 72 bool incompleteFrame)); |
73 MOCK_METHOD1(GetJitterEstimate, int(double rttMultiplier)); | |
stefan-webrtc
2016/08/02 14:19:03
rtt_multiplier
| |
73 }; | 74 }; |
74 | 75 |
75 class FrameObjectFake : public FrameObject { | 76 class FrameObjectFake : public FrameObject { |
76 public: | 77 public: |
77 bool GetBitstream(uint8_t* destination) const override { return true; } | 78 bool GetBitstream(uint8_t* destination) const override { return true; } |
78 | 79 |
79 uint32_t Timestamp() const override { return timestamp; } | 80 uint32_t Timestamp() const override { return timestamp; } |
80 | 81 |
81 int64_t ReceivedTime() const override { return 0; } | 82 int64_t ReceivedTime() const override { return 0; } |
82 | 83 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 | 172 |
172 tfb->frames_.emplace_back(tfb->buffer_.NextFrame(tfb->max_wait_time_)); | 173 tfb->frames_.emplace_back(tfb->buffer_.NextFrame(tfb->max_wait_time_)); |
173 } | 174 } |
174 } | 175 } |
175 } | 176 } |
176 | 177 |
177 uint32_t Rand() { return rand_.Rand<uint32_t>(); } | 178 uint32_t Rand() { return rand_.Rand<uint32_t>(); } |
178 | 179 |
179 SimulatedClock clock_; | 180 SimulatedClock clock_; |
180 VCMTimingFake timing_; | 181 VCMTimingFake timing_; |
181 VCMJitterEstimatorMock jitter_estimator_; | 182 ::testing::NiceMock<VCMJitterEstimatorMock> jitter_estimator_; |
182 FrameBuffer buffer_; | 183 FrameBuffer buffer_; |
183 std::vector<std::unique_ptr<FrameObject>> frames_; | 184 std::vector<std::unique_ptr<FrameObject>> frames_; |
184 Random rand_; | 185 Random rand_; |
185 | 186 |
186 int64_t max_wait_time_; | 187 int64_t max_wait_time_; |
187 bool tear_down_; | 188 bool tear_down_; |
188 rtc::PlatformThread extract_thread_; | 189 rtc::PlatformThread extract_thread_; |
189 rtc::Event trigger_extract_event_; | 190 rtc::Event trigger_extract_event_; |
190 rtc::Event crit_acquired_event_; | 191 rtc::Event crit_acquired_event_; |
191 rtc::CriticalSection crit_; | 192 rtc::CriticalSection crit_; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 InsertFrame(pid + 2, 0, ts, false); | 330 InsertFrame(pid + 2, 0, ts, false); |
330 ExtractFrame(); | 331 ExtractFrame(); |
331 InsertFrame(pid + 1, 0, ts, false, pid); | 332 InsertFrame(pid + 1, 0, ts, false, pid); |
332 ExtractFrame(); | 333 ExtractFrame(); |
333 | 334 |
334 CheckFrame(0, pid, 0); | 335 CheckFrame(0, pid, 0); |
335 CheckFrame(1, pid + 2, 0); | 336 CheckFrame(1, pid + 2, 0); |
336 CheckNoFrame(2); | 337 CheckNoFrame(2); |
337 } | 338 } |
338 | 339 |
340 TEST_F(TestFrameBuffer2, ProtectionMode) { | |
341 uint16_t pid = Rand(); | |
342 uint32_t ts = Rand(); | |
343 | |
344 EXPECT_CALL(jitter_estimator_, GetJitterEstimate(1.0)); | |
345 InsertFrame(pid, 0, ts, false); | |
346 ExtractFrame(); | |
347 | |
348 buffer_.SetProtectionMode(kProtectionNackFEC); | |
349 EXPECT_CALL(jitter_estimator_, GetJitterEstimate(0.0)); | |
350 InsertFrame(pid + 1, 0, ts, false); | |
351 ExtractFrame(); | |
352 } | |
353 | |
339 } // namespace video_coding | 354 } // namespace video_coding |
340 } // namespace webrtc | 355 } // namespace webrtc |
OLD | NEW |