Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter_unittest.cc

Issue 2001533003: Refactoring: Hide VideoCodec.codecSpecific as "private" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More zeroes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 helper_->factory()->encoders()[stream_index]->codec(); 277 helper_->factory()->encoders()[stream_index]->codec();
278 EXPECT_EQ(ref.codecType, target.codecType); 278 EXPECT_EQ(ref.codecType, target.codecType);
279 EXPECT_EQ(0, strcmp(ref.plName, target.plName)); 279 EXPECT_EQ(0, strcmp(ref.plName, target.plName));
280 EXPECT_EQ(ref.plType, target.plType); 280 EXPECT_EQ(ref.plType, target.plType);
281 EXPECT_EQ(ref.width, target.width); 281 EXPECT_EQ(ref.width, target.width);
282 EXPECT_EQ(ref.height, target.height); 282 EXPECT_EQ(ref.height, target.height);
283 EXPECT_EQ(ref.startBitrate, target.startBitrate); 283 EXPECT_EQ(ref.startBitrate, target.startBitrate);
284 EXPECT_EQ(ref.maxBitrate, target.maxBitrate); 284 EXPECT_EQ(ref.maxBitrate, target.maxBitrate);
285 EXPECT_EQ(ref.minBitrate, target.minBitrate); 285 EXPECT_EQ(ref.minBitrate, target.minBitrate);
286 EXPECT_EQ(ref.maxFramerate, target.maxFramerate); 286 EXPECT_EQ(ref.maxFramerate, target.maxFramerate);
287 EXPECT_EQ(ref.codecSpecific.VP8.pictureLossIndicationOn, 287 EXPECT_EQ(ref.VP8().pictureLossIndicationOn,
288 target.codecSpecific.VP8.pictureLossIndicationOn); 288 target.VP8().pictureLossIndicationOn);
289 EXPECT_EQ(ref.codecSpecific.VP8.feedbackModeOn, 289 EXPECT_EQ(ref.VP8().feedbackModeOn, target.VP8().feedbackModeOn);
290 target.codecSpecific.VP8.feedbackModeOn); 290 EXPECT_EQ(ref.VP8().complexity, target.VP8().complexity);
291 EXPECT_EQ(ref.codecSpecific.VP8.complexity, 291 EXPECT_EQ(ref.VP8().resilience, target.VP8().resilience);
292 target.codecSpecific.VP8.complexity); 292 EXPECT_EQ(ref.VP8().numberOfTemporalLayers,
293 EXPECT_EQ(ref.codecSpecific.VP8.resilience, 293 target.VP8().numberOfTemporalLayers);
294 target.codecSpecific.VP8.resilience); 294 EXPECT_EQ(ref.VP8().denoisingOn, target.VP8().denoisingOn);
295 EXPECT_EQ(ref.codecSpecific.VP8.numberOfTemporalLayers, 295 EXPECT_EQ(ref.VP8().errorConcealmentOn, target.VP8().errorConcealmentOn);
296 target.codecSpecific.VP8.numberOfTemporalLayers); 296 EXPECT_EQ(ref.VP8().automaticResizeOn, target.VP8().automaticResizeOn);
297 EXPECT_EQ(ref.codecSpecific.VP8.denoisingOn, 297 EXPECT_EQ(ref.VP8().frameDroppingOn, target.VP8().frameDroppingOn);
298 target.codecSpecific.VP8.denoisingOn); 298 EXPECT_EQ(ref.VP8().keyFrameInterval, target.VP8().keyFrameInterval);
299 EXPECT_EQ(ref.codecSpecific.VP8.errorConcealmentOn, 299 EXPECT_EQ(ref.VP8().tl_factory, target.VP8().tl_factory);
300 target.codecSpecific.VP8.errorConcealmentOn);
301 EXPECT_EQ(ref.codecSpecific.VP8.automaticResizeOn,
302 target.codecSpecific.VP8.automaticResizeOn);
303 EXPECT_EQ(ref.codecSpecific.VP8.frameDroppingOn,
304 target.codecSpecific.VP8.frameDroppingOn);
305 EXPECT_EQ(ref.codecSpecific.VP8.keyFrameInterval,
306 target.codecSpecific.VP8.keyFrameInterval);
307 EXPECT_EQ(ref.codecSpecific.VP8.tl_factory,
308 target.codecSpecific.VP8.tl_factory);
309 EXPECT_EQ(ref.qpMax, target.qpMax); 300 EXPECT_EQ(ref.qpMax, target.qpMax);
310 EXPECT_EQ(0, target.numberOfSimulcastStreams); 301 EXPECT_EQ(0, target.numberOfSimulcastStreams);
311 EXPECT_EQ(ref.mode, target.mode); 302 EXPECT_EQ(ref.mode, target.mode);
312 303
313 // No need to compare simulcastStream as numberOfSimulcastStreams should 304 // No need to compare simulcastStream as numberOfSimulcastStreams should
314 // always be 0. 305 // always be 0.
315 } 306 }
316 307
317 void InitRefCodec(int stream_index, VideoCodec* ref_codec) { 308 void InitRefCodec(int stream_index, VideoCodec* ref_codec) {
318 *ref_codec = codec_; 309 *ref_codec = codec_;
319 ref_codec->codecSpecific.VP8.numberOfTemporalLayers = 310 ref_codec->VP8()->numberOfTemporalLayers =
320 kTestTemporalLayerProfile[stream_index]; 311 kTestTemporalLayerProfile[stream_index];
321 ref_codec->width = codec_.simulcastStream[stream_index].width; 312 ref_codec->width = codec_.simulcastStream[stream_index].width;
322 ref_codec->height = codec_.simulcastStream[stream_index].height; 313 ref_codec->height = codec_.simulcastStream[stream_index].height;
323 ref_codec->maxBitrate = codec_.simulcastStream[stream_index].maxBitrate; 314 ref_codec->maxBitrate = codec_.simulcastStream[stream_index].maxBitrate;
324 ref_codec->minBitrate = codec_.simulcastStream[stream_index].minBitrate; 315 ref_codec->minBitrate = codec_.simulcastStream[stream_index].minBitrate;
325 ref_codec->qpMax = codec_.simulcastStream[stream_index].qpMax; 316 ref_codec->qpMax = codec_.simulcastStream[stream_index].qpMax;
326 } 317 }
327 318
328 void VerifyCodecSettings() { 319 void VerifyCodecSettings() {
329 EXPECT_EQ(3u, helper_->factory()->encoders().size()); 320 EXPECT_EQ(3u, helper_->factory()->encoders().size());
330 VideoCodec ref_codec; 321 VideoCodec ref_codec;
331 322
332 // stream 0, the lowest resolution stream. 323 // stream 0, the lowest resolution stream.
333 InitRefCodec(0, &ref_codec); 324 InitRefCodec(0, &ref_codec);
334 ref_codec.qpMax = 45; 325 ref_codec.qpMax = 45;
335 ref_codec.codecSpecific.VP8.complexity = webrtc::kComplexityHigher; 326 ref_codec.VP8()->complexity = webrtc::kComplexityHigher;
336 ref_codec.codecSpecific.VP8.denoisingOn = false; 327 ref_codec.VP8()->denoisingOn = false;
337 ref_codec.startBitrate = 100; // Should equal to the target bitrate. 328 ref_codec.startBitrate = 100; // Should equal to the target bitrate.
338 VerifyCodec(ref_codec, 0); 329 VerifyCodec(ref_codec, 0);
339 330
340 // stream 1 331 // stream 1
341 InitRefCodec(1, &ref_codec); 332 InitRefCodec(1, &ref_codec);
342 ref_codec.codecSpecific.VP8.denoisingOn = false; 333 ref_codec.VP8()->denoisingOn = false;
343 // The start bitrate (300kbit) minus what we have for the lower layers 334 // The start bitrate (300kbit) minus what we have for the lower layers
344 // (100kbit). 335 // (100kbit).
345 ref_codec.startBitrate = 200; 336 ref_codec.startBitrate = 200;
346 VerifyCodec(ref_codec, 1); 337 VerifyCodec(ref_codec, 1);
347 338
348 // stream 2, the biggest resolution stream. 339 // stream 2, the biggest resolution stream.
349 InitRefCodec(2, &ref_codec); 340 InitRefCodec(2, &ref_codec);
350 // We don't have enough bits to send this, so the adapter should have 341 // We don't have enough bits to send this, so the adapter should have
351 // configured it to use the min bitrate for this layer (600kbit) but turn 342 // configured it to use the min bitrate for this layer (600kbit) but turn
352 // off sending. 343 // off sending.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); 446 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
456 adapter_->RegisterEncodeCompleteCallback(this); 447 adapter_->RegisterEncodeCompleteCallback(this);
457 ASSERT_EQ(3u, helper_->factory()->encoders().size()); 448 ASSERT_EQ(3u, helper_->factory()->encoders().size());
458 for (MockVideoEncoder* encoder : helper_->factory()->encoders()) 449 for (MockVideoEncoder* encoder : helper_->factory()->encoders())
459 encoder->set_supports_native_handle(true); 450 encoder->set_supports_native_handle(true);
460 EXPECT_FALSE(adapter_->SupportsNativeHandle()); 451 EXPECT_FALSE(adapter_->SupportsNativeHandle());
461 } 452 }
462 453
463 } // namespace testing 454 } // namespace testing
464 } // namespace webrtc 455 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698