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/api/video/i420_buffer.h" | 14 #include "webrtc/api/video/i420_buffer.h" |
15 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 15 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" | 16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" |
17 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_rate_allocator.h" | 17 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_rate_allocator.h" |
18 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" | 18 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" |
19 #include "webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h" | 19 #include "webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h" |
20 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" | 20 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" |
21 #include "webrtc/modules/video_coding/include/video_coding.h" | 21 #include "webrtc/modules/video_coding/include/video_coding.h" |
22 #include "webrtc/modules/video_coding/video_coding_impl.h" | 22 #include "webrtc/modules/video_coding/video_coding_impl.h" |
23 #include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h" | 23 #include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h" |
24 #include "webrtc/system_wrappers/include/clock.h" | 24 #include "webrtc/system_wrappers/include/clock.h" |
25 #include "webrtc/test/frame_generator.h" | 25 #include "webrtc/test/frame_generator.h" |
26 #include "webrtc/test/gtest.h" | 26 #include "webrtc/test/gtest.h" |
27 #include "webrtc/test/testsupport/fileutils.h" | 27 #include "webrtc/test/testsupport/fileutils.h" |
| 28 #include "webrtc/test/video_codec_settings.h" |
28 | 29 |
29 using ::testing::_; | 30 using ::testing::_; |
30 using ::testing::AllOf; | 31 using ::testing::AllOf; |
31 using ::testing::ElementsAre; | 32 using ::testing::ElementsAre; |
32 using ::testing::ElementsAreArray; | 33 using ::testing::ElementsAreArray; |
33 using ::testing::Field; | 34 using ::testing::Field; |
34 using ::testing::NiceMock; | 35 using ::testing::NiceMock; |
35 using ::testing::Pointee; | 36 using ::testing::Pointee; |
36 using ::testing::Return; | 37 using ::testing::Return; |
37 using ::testing::FloatEq; | 38 using ::testing::FloatEq; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 200 |
200 class TestVideoSenderWithMockEncoder : public TestVideoSender { | 201 class TestVideoSenderWithMockEncoder : public TestVideoSender { |
201 public: | 202 public: |
202 TestVideoSenderWithMockEncoder() {} | 203 TestVideoSenderWithMockEncoder() {} |
203 ~TestVideoSenderWithMockEncoder() override {} | 204 ~TestVideoSenderWithMockEncoder() override {} |
204 | 205 |
205 protected: | 206 protected: |
206 void SetUp() override { | 207 void SetUp() override { |
207 TestVideoSender::SetUp(); | 208 TestVideoSender::SetUp(); |
208 sender_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType, false); | 209 sender_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType, false); |
209 VideoCodingModule::Codec(kVideoCodecVP8, &settings_); | 210 webrtc::test::CodecSettings(kVideoCodecVP8, &settings_); |
210 settings_.numberOfSimulcastStreams = kNumberOfStreams; | 211 settings_.numberOfSimulcastStreams = kNumberOfStreams; |
211 ConfigureStream(kDefaultWidth / 4, kDefaultHeight / 4, 100, | 212 ConfigureStream(kDefaultWidth / 4, kDefaultHeight / 4, 100, |
212 &settings_.simulcastStream[0]); | 213 &settings_.simulcastStream[0]); |
213 ConfigureStream(kDefaultWidth / 2, kDefaultHeight / 2, 500, | 214 ConfigureStream(kDefaultWidth / 2, kDefaultHeight / 2, 500, |
214 &settings_.simulcastStream[1]); | 215 &settings_.simulcastStream[1]); |
215 ConfigureStream(kDefaultWidth, kDefaultHeight, 1200, | 216 ConfigureStream(kDefaultWidth, kDefaultHeight, 1200, |
216 &settings_.simulcastStream[2]); | 217 &settings_.simulcastStream[2]); |
217 settings_.plType = kUnusedPayloadType; // Use the mocked encoder. | 218 settings_.plType = kUnusedPayloadType; // Use the mocked encoder. |
218 generator_.reset( | 219 generator_.reset( |
219 new EmptyFrameGenerator(settings_.width, settings_.height)); | 220 new EmptyFrameGenerator(settings_.width, settings_.height)); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 420 |
420 encoder_.reset(VP8Encoder::Create()); | 421 encoder_.reset(VP8Encoder::Create()); |
421 sender_->RegisterExternalEncoder(encoder_.get(), codec_.plType, false); | 422 sender_->RegisterExternalEncoder(encoder_.get(), codec_.plType, false); |
422 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec_, 1, 1200)); | 423 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec_, 1, 1200)); |
423 } | 424 } |
424 | 425 |
425 static VideoCodec MakeVp8VideoCodec(int width, | 426 static VideoCodec MakeVp8VideoCodec(int width, |
426 int height, | 427 int height, |
427 int temporal_layers) { | 428 int temporal_layers) { |
428 VideoCodec codec; | 429 VideoCodec codec; |
429 VideoCodingModule::Codec(kVideoCodecVP8, &codec); | 430 webrtc::test::CodecSettings(kVideoCodecVP8, &codec); |
430 codec.width = width; | 431 codec.width = width; |
431 codec.height = height; | 432 codec.height = height; |
432 codec.VP8()->numberOfTemporalLayers = temporal_layers; | 433 codec.VP8()->numberOfTemporalLayers = temporal_layers; |
433 return codec; | 434 return codec; |
434 } | 435 } |
435 | 436 |
436 void InsertFrames(float framerate, float seconds) { | 437 void InsertFrames(float framerate, float seconds) { |
437 for (int i = 0; i < seconds * framerate; ++i) { | 438 for (int i = 0; i < seconds * framerate; ++i) { |
438 clock_.AdvanceTimeMilliseconds(1000.0f / framerate); | 439 clock_.AdvanceTimeMilliseconds(1000.0f / framerate); |
439 AddFrame(); | 440 AddFrame(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 } | 484 } |
484 { | 485 { |
485 Vp8StreamInfo expected = {{3.75, 7.5, 15.0}, {low_b, mid_b, high_b}}; | 486 Vp8StreamInfo expected = {{3.75, 7.5, 15.0}, {low_b, mid_b, high_b}}; |
486 EXPECT_THAT(SimulateWithFramerate(15.0), MatchesVp8StreamInfo(expected)); | 487 EXPECT_THAT(SimulateWithFramerate(15.0), MatchesVp8StreamInfo(expected)); |
487 } | 488 } |
488 } | 489 } |
489 | 490 |
490 } // namespace | 491 } // namespace |
491 } // namespace vcm | 492 } // namespace vcm |
492 } // namespace webrtc | 493 } // namespace webrtc |
OLD | NEW |