| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h" | 14 #include "webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h" |
| 15 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" | 15 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" |
| 16 #include "webrtc/modules/video_coding/include/video_coding.h" | 16 #include "webrtc/modules/video_coding/include/video_coding.h" |
| 17 #include "webrtc/modules/video_coding/test/test_util.h" | 17 #include "webrtc/modules/video_coding/test/test_util.h" |
| 18 #include "webrtc/modules/video_coding/timing.h" | 18 #include "webrtc/modules/video_coding/timing.h" |
| 19 #include "webrtc/modules/video_coding/video_coding_impl.h" | 19 #include "webrtc/modules/video_coding/video_coding_impl.h" |
| 20 #include "webrtc/system_wrappers/include/clock.h" | 20 #include "webrtc/system_wrappers/include/clock.h" |
| 21 #include "webrtc/test/gtest.h" | 21 #include "webrtc/test/gtest.h" |
| 22 #include "webrtc/test/video_codec_settings.h" |
| 22 | 23 |
| 23 using ::testing::_; | 24 using ::testing::_; |
| 24 using ::testing::AnyNumber; | 25 using ::testing::AnyNumber; |
| 25 using ::testing::NiceMock; | 26 using ::testing::NiceMock; |
| 26 | 27 |
| 27 namespace webrtc { | 28 namespace webrtc { |
| 28 namespace vcm { | 29 namespace vcm { |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| 31 class TestVideoReceiver : public ::testing::Test { | 32 class TestVideoReceiver : public ::testing::Test { |
| 32 protected: | 33 protected: |
| 33 static const int kUnusedPayloadType = 10; | 34 static const int kUnusedPayloadType = 10; |
| 34 | 35 |
| 35 TestVideoReceiver() : clock_(0) {} | 36 TestVideoReceiver() : clock_(0) {} |
| 36 | 37 |
| 37 virtual void SetUp() { | 38 virtual void SetUp() { |
| 38 timing_.reset(new VCMTiming(&clock_)); | 39 timing_.reset(new VCMTiming(&clock_)); |
| 39 receiver_.reset( | 40 receiver_.reset( |
| 40 new VideoReceiver(&clock_, &event_factory_, nullptr, timing_.get())); | 41 new VideoReceiver(&clock_, &event_factory_, nullptr, timing_.get())); |
| 41 receiver_->RegisterExternalDecoder(&decoder_, kUnusedPayloadType); | 42 receiver_->RegisterExternalDecoder(&decoder_, kUnusedPayloadType); |
| 42 const size_t kMaxNackListSize = 250; | 43 const size_t kMaxNackListSize = 250; |
| 43 const int kMaxPacketAgeToNack = 450; | 44 const int kMaxPacketAgeToNack = 450; |
| 44 receiver_->SetNackSettings(kMaxNackListSize, kMaxPacketAgeToNack, 0); | 45 receiver_->SetNackSettings(kMaxNackListSize, kMaxPacketAgeToNack, 0); |
| 45 | 46 |
| 46 VideoCodingModule::Codec(kVideoCodecVP8, &settings_); | 47 webrtc::test::CodecSettings(kVideoCodecVP8, &settings_); |
| 47 settings_.plType = kUnusedPayloadType; // Use the mocked encoder. | 48 settings_.plType = kUnusedPayloadType; // Use the mocked encoder. |
| 48 EXPECT_EQ(0, receiver_->RegisterReceiveCodec(&settings_, 1, true)); | 49 EXPECT_EQ(0, receiver_->RegisterReceiveCodec(&settings_, 1, true)); |
| 49 | 50 |
| 50 // Since we call Decode, we need to provide a valid receive callback. | 51 // Since we call Decode, we need to provide a valid receive callback. |
| 51 // However, for the purposes of these tests, we ignore the callbacks. | 52 // However, for the purposes of these tests, we ignore the callbacks. |
| 52 EXPECT_CALL(receive_callback_, OnIncomingPayloadType(_)).Times(AnyNumber()); | 53 EXPECT_CALL(receive_callback_, OnIncomingPayloadType(_)).Times(AnyNumber()); |
| 53 EXPECT_CALL(receive_callback_, OnDecoderImplementationName(_)) | 54 EXPECT_CALL(receive_callback_, OnDecoderImplementationName(_)) |
| 54 .Times(AnyNumber()); | 55 .Times(AnyNumber()); |
| 55 receiver_->RegisterReceiveCallback(&receive_callback_); | 56 receiver_->RegisterReceiveCallback(&receive_callback_); |
| 56 } | 57 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 TEST_F(TestVideoReceiver, ReceiverDelay) { | 214 TEST_F(TestVideoReceiver, ReceiverDelay) { |
| 214 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(0)); | 215 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(0)); |
| 215 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(5000)); | 216 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(5000)); |
| 216 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(-100)); | 217 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(-100)); |
| 217 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(10010)); | 218 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(10010)); |
| 218 } | 219 } |
| 219 | 220 |
| 220 } // namespace | 221 } // namespace |
| 221 } // namespace vcm | 222 } // namespace vcm |
| 222 } // namespace webrtc | 223 } // namespace webrtc |
| OLD | NEW |