OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 private: | 139 private: |
140 int decoded_frames_; | 140 int decoded_frames_; |
141 }; | 141 }; |
142 | 142 |
143 class SkipEncodingUnusedStreamsTest { | 143 class SkipEncodingUnusedStreamsTest { |
144 public: | 144 public: |
145 std::vector<unsigned int> RunTest(VP8Encoder* encoder, | 145 std::vector<unsigned int> RunTest(VP8Encoder* encoder, |
146 VideoCodec* settings, | 146 VideoCodec* settings, |
147 uint32_t target_bitrate) { | 147 uint32_t target_bitrate) { |
148 SpyingTemporalLayersFactory spy_factory; | 148 SpyingTemporalLayersFactory spy_factory; |
149 settings->codecSpecific.VP8.tl_factory = &spy_factory; | 149 settings->VP8()->tl_factory = &spy_factory; |
150 EXPECT_EQ(0, encoder->InitEncode(settings, 1, 1200)); | 150 EXPECT_EQ(0, encoder->InitEncode(settings, 1, 1200)); |
151 | 151 |
152 encoder->SetRates(target_bitrate, 30); | 152 encoder->SetRates(target_bitrate, 30); |
153 | 153 |
154 std::vector<unsigned int> configured_bitrates; | 154 std::vector<unsigned int> configured_bitrates; |
155 for (std::vector<TemporalLayers*>::const_iterator it = | 155 for (std::vector<TemporalLayers*>::const_iterator it = |
156 spy_factory.spying_layers_.begin(); | 156 spy_factory.spying_layers_.begin(); |
157 it != spy_factory.spying_layers_.end(); ++it) { | 157 it != spy_factory.spying_layers_.end(); ++it) { |
158 configured_bitrates.push_back( | 158 configured_bitrates.push_back( |
159 static_cast<SpyingTemporalLayers*>(*it)->configured_bitrate_); | 159 static_cast<SpyingTemporalLayers*>(*it)->configured_bitrate_); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 ASSERT_EQ(3, kNumberOfSimulcastStreams); | 274 ASSERT_EQ(3, kNumberOfSimulcastStreams); |
275 ConfigureStream(kDefaultWidth / 4, kDefaultHeight / 4, kMaxBitrates[0], | 275 ConfigureStream(kDefaultWidth / 4, kDefaultHeight / 4, kMaxBitrates[0], |
276 kMinBitrates[0], kTargetBitrates[0], | 276 kMinBitrates[0], kTargetBitrates[0], |
277 &settings->simulcastStream[0], temporal_layer_profile[0]); | 277 &settings->simulcastStream[0], temporal_layer_profile[0]); |
278 ConfigureStream(kDefaultWidth / 2, kDefaultHeight / 2, kMaxBitrates[1], | 278 ConfigureStream(kDefaultWidth / 2, kDefaultHeight / 2, kMaxBitrates[1], |
279 kMinBitrates[1], kTargetBitrates[1], | 279 kMinBitrates[1], kTargetBitrates[1], |
280 &settings->simulcastStream[1], temporal_layer_profile[1]); | 280 &settings->simulcastStream[1], temporal_layer_profile[1]); |
281 ConfigureStream(kDefaultWidth, kDefaultHeight, kMaxBitrates[2], | 281 ConfigureStream(kDefaultWidth, kDefaultHeight, kMaxBitrates[2], |
282 kMinBitrates[2], kTargetBitrates[2], | 282 kMinBitrates[2], kTargetBitrates[2], |
283 &settings->simulcastStream[2], temporal_layer_profile[2]); | 283 &settings->simulcastStream[2], temporal_layer_profile[2]); |
284 settings->codecSpecific.VP8.resilience = kResilientStream; | 284 settings->VP8()->resilience = kResilientStream; |
285 settings->codecSpecific.VP8.denoisingOn = true; | 285 settings->VP8()->denoisingOn = true; |
286 settings->codecSpecific.VP8.errorConcealmentOn = false; | 286 settings->VP8()->errorConcealmentOn = false; |
287 settings->codecSpecific.VP8.automaticResizeOn = false; | 287 settings->VP8()->automaticResizeOn = false; |
288 settings->codecSpecific.VP8.feedbackModeOn = false; | 288 settings->VP8()->feedbackModeOn = false; |
289 settings->codecSpecific.VP8.frameDroppingOn = true; | 289 settings->VP8()->frameDroppingOn = true; |
290 settings->codecSpecific.VP8.keyFrameInterval = 3000; | 290 settings->VP8()->keyFrameInterval = 3000; |
291 } | 291 } |
292 | 292 |
293 static void ConfigureStream(int width, | 293 static void ConfigureStream(int width, |
294 int height, | 294 int height, |
295 int max_bitrate, | 295 int max_bitrate, |
296 int min_bitrate, | 296 int min_bitrate, |
297 int target_bitrate, | 297 int target_bitrate, |
298 SimulcastStream* stream, | 298 SimulcastStream* stream, |
299 int num_temporal_layers) { | 299 int num_temporal_layers) { |
300 assert(stream); | 300 assert(stream); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 kTargetBitrates[0] + kTargetBitrates[1] + kTargetBitrates[2], 30); | 548 kTargetBitrates[0] + kTargetBitrates[1] + kTargetBitrates[2], 30); |
549 // We get a key frame because a new stream is being enabled. | 549 // We get a key frame because a new stream is being enabled. |
550 ExpectStreams(kVideoFrameKey, 3); | 550 ExpectStreams(kVideoFrameKey, 3); |
551 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); | 551 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); |
552 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); | 552 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); |
553 } | 553 } |
554 | 554 |
555 void SwitchingToOneStream(int width, int height) { | 555 void SwitchingToOneStream(int width, int height) { |
556 // Disable all streams except the last and set the bitrate of the last to | 556 // Disable all streams except the last and set the bitrate of the last to |
557 // 100 kbps. This verifies the way GTP switches to screenshare mode. | 557 // 100 kbps. This verifies the way GTP switches to screenshare mode. |
558 settings_.codecSpecific.VP8.numberOfTemporalLayers = 1; | 558 settings_.VP8()->numberOfTemporalLayers = 1; |
559 settings_.maxBitrate = 100; | 559 settings_.maxBitrate = 100; |
560 settings_.startBitrate = 100; | 560 settings_.startBitrate = 100; |
561 settings_.width = width; | 561 settings_.width = width; |
562 settings_.height = height; | 562 settings_.height = height; |
563 for (int i = 0; i < settings_.numberOfSimulcastStreams - 1; ++i) { | 563 for (int i = 0; i < settings_.numberOfSimulcastStreams - 1; ++i) { |
564 settings_.simulcastStream[i].maxBitrate = 0; | 564 settings_.simulcastStream[i].maxBitrate = 0; |
565 settings_.simulcastStream[i].width = settings_.width; | 565 settings_.simulcastStream[i].width = settings_.width; |
566 settings_.simulcastStream[i].height = settings_.height; | 566 settings_.simulcastStream[i].height = settings_.height; |
567 } | 567 } |
568 // Setting input image to new resolution. | 568 // Setting input image to new resolution. |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 std::unique_ptr<VP8Decoder> decoder_; | 962 std::unique_ptr<VP8Decoder> decoder_; |
963 MockDecodedImageCallback decoder_callback_; | 963 MockDecodedImageCallback decoder_callback_; |
964 VideoCodec settings_; | 964 VideoCodec settings_; |
965 VideoFrame input_frame_; | 965 VideoFrame input_frame_; |
966 }; | 966 }; |
967 | 967 |
968 } // namespace testing | 968 } // namespace testing |
969 } // namespace webrtc | 969 } // namespace webrtc |
970 | 970 |
971 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ | 971 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ |
OLD | NEW |