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

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: Rebased Created 4 years, 1 month 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 helper_->factory()->encoders()[stream_index]->codec(); 282 helper_->factory()->encoders()[stream_index]->codec();
283 EXPECT_EQ(ref.codecType, target.codecType); 283 EXPECT_EQ(ref.codecType, target.codecType);
284 EXPECT_EQ(0, strcmp(ref.plName, target.plName)); 284 EXPECT_EQ(0, strcmp(ref.plName, target.plName));
285 EXPECT_EQ(ref.plType, target.plType); 285 EXPECT_EQ(ref.plType, target.plType);
286 EXPECT_EQ(ref.width, target.width); 286 EXPECT_EQ(ref.width, target.width);
287 EXPECT_EQ(ref.height, target.height); 287 EXPECT_EQ(ref.height, target.height);
288 EXPECT_EQ(ref.startBitrate, target.startBitrate); 288 EXPECT_EQ(ref.startBitrate, target.startBitrate);
289 EXPECT_EQ(ref.maxBitrate, target.maxBitrate); 289 EXPECT_EQ(ref.maxBitrate, target.maxBitrate);
290 EXPECT_EQ(ref.minBitrate, target.minBitrate); 290 EXPECT_EQ(ref.minBitrate, target.minBitrate);
291 EXPECT_EQ(ref.maxFramerate, target.maxFramerate); 291 EXPECT_EQ(ref.maxFramerate, target.maxFramerate);
292 EXPECT_EQ(ref.codecSpecific.VP8.pictureLossIndicationOn, 292 EXPECT_EQ(ref.VP8().pictureLossIndicationOn,
293 target.codecSpecific.VP8.pictureLossIndicationOn); 293 target.VP8().pictureLossIndicationOn);
294 EXPECT_EQ(ref.codecSpecific.VP8.feedbackModeOn, 294 EXPECT_EQ(ref.VP8().feedbackModeOn, target.VP8().feedbackModeOn);
295 target.codecSpecific.VP8.feedbackModeOn); 295 EXPECT_EQ(ref.VP8().complexity, target.VP8().complexity);
296 EXPECT_EQ(ref.codecSpecific.VP8.complexity, 296 EXPECT_EQ(ref.VP8().resilience, target.VP8().resilience);
297 target.codecSpecific.VP8.complexity); 297 EXPECT_EQ(ref.VP8().numberOfTemporalLayers,
298 EXPECT_EQ(ref.codecSpecific.VP8.resilience, 298 target.VP8().numberOfTemporalLayers);
299 target.codecSpecific.VP8.resilience); 299 EXPECT_EQ(ref.VP8().denoisingOn, target.VP8().denoisingOn);
300 EXPECT_EQ(ref.codecSpecific.VP8.numberOfTemporalLayers, 300 EXPECT_EQ(ref.VP8().errorConcealmentOn, target.VP8().errorConcealmentOn);
301 target.codecSpecific.VP8.numberOfTemporalLayers); 301 EXPECT_EQ(ref.VP8().automaticResizeOn, target.VP8().automaticResizeOn);
302 EXPECT_EQ(ref.codecSpecific.VP8.denoisingOn, 302 EXPECT_EQ(ref.VP8().frameDroppingOn, target.VP8().frameDroppingOn);
303 target.codecSpecific.VP8.denoisingOn); 303 EXPECT_EQ(ref.VP8().keyFrameInterval, target.VP8().keyFrameInterval);
304 EXPECT_EQ(ref.codecSpecific.VP8.errorConcealmentOn, 304 EXPECT_EQ(ref.VP8().tl_factory, target.VP8().tl_factory);
305 target.codecSpecific.VP8.errorConcealmentOn);
306 EXPECT_EQ(ref.codecSpecific.VP8.automaticResizeOn,
307 target.codecSpecific.VP8.automaticResizeOn);
308 EXPECT_EQ(ref.codecSpecific.VP8.frameDroppingOn,
309 target.codecSpecific.VP8.frameDroppingOn);
310 EXPECT_EQ(ref.codecSpecific.VP8.keyFrameInterval,
311 target.codecSpecific.VP8.keyFrameInterval);
312 EXPECT_EQ(ref.codecSpecific.VP8.tl_factory,
313 target.codecSpecific.VP8.tl_factory);
314 EXPECT_EQ(ref.qpMax, target.qpMax); 305 EXPECT_EQ(ref.qpMax, target.qpMax);
315 EXPECT_EQ(0, target.numberOfSimulcastStreams); 306 EXPECT_EQ(0, target.numberOfSimulcastStreams);
316 EXPECT_EQ(ref.mode, target.mode); 307 EXPECT_EQ(ref.mode, target.mode);
317 308
318 // No need to compare simulcastStream as numberOfSimulcastStreams should 309 // No need to compare simulcastStream as numberOfSimulcastStreams should
319 // always be 0. 310 // always be 0.
320 } 311 }
321 312
322 void InitRefCodec(int stream_index, VideoCodec* ref_codec) { 313 void InitRefCodec(int stream_index, VideoCodec* ref_codec) {
323 *ref_codec = codec_; 314 *ref_codec = codec_;
324 ref_codec->codecSpecific.VP8.numberOfTemporalLayers = 315 ref_codec->VP8()->numberOfTemporalLayers =
325 kTestTemporalLayerProfile[stream_index]; 316 kTestTemporalLayerProfile[stream_index];
326 ref_codec->width = codec_.simulcastStream[stream_index].width; 317 ref_codec->width = codec_.simulcastStream[stream_index].width;
327 ref_codec->height = codec_.simulcastStream[stream_index].height; 318 ref_codec->height = codec_.simulcastStream[stream_index].height;
328 ref_codec->maxBitrate = codec_.simulcastStream[stream_index].maxBitrate; 319 ref_codec->maxBitrate = codec_.simulcastStream[stream_index].maxBitrate;
329 ref_codec->minBitrate = codec_.simulcastStream[stream_index].minBitrate; 320 ref_codec->minBitrate = codec_.simulcastStream[stream_index].minBitrate;
330 ref_codec->qpMax = codec_.simulcastStream[stream_index].qpMax; 321 ref_codec->qpMax = codec_.simulcastStream[stream_index].qpMax;
331 } 322 }
332 323
333 void VerifyCodecSettings() { 324 void VerifyCodecSettings() {
334 EXPECT_EQ(3u, helper_->factory()->encoders().size()); 325 EXPECT_EQ(3u, helper_->factory()->encoders().size());
335 VideoCodec ref_codec; 326 VideoCodec ref_codec;
336 327
337 // stream 0, the lowest resolution stream. 328 // stream 0, the lowest resolution stream.
338 InitRefCodec(0, &ref_codec); 329 InitRefCodec(0, &ref_codec);
339 ref_codec.qpMax = 45; 330 ref_codec.qpMax = 45;
340 ref_codec.codecSpecific.VP8.complexity = webrtc::kComplexityHigher; 331 ref_codec.VP8()->complexity = webrtc::kComplexityHigher;
341 ref_codec.codecSpecific.VP8.denoisingOn = false; 332 ref_codec.VP8()->denoisingOn = false;
342 ref_codec.startBitrate = 100; // Should equal to the target bitrate. 333 ref_codec.startBitrate = 100; // Should equal to the target bitrate.
343 VerifyCodec(ref_codec, 0); 334 VerifyCodec(ref_codec, 0);
344 335
345 // stream 1 336 // stream 1
346 InitRefCodec(1, &ref_codec); 337 InitRefCodec(1, &ref_codec);
347 ref_codec.codecSpecific.VP8.denoisingOn = false; 338 ref_codec.VP8()->denoisingOn = false;
348 // The start bitrate (300kbit) minus what we have for the lower layers 339 // The start bitrate (300kbit) minus what we have for the lower layers
349 // (100kbit). 340 // (100kbit).
350 ref_codec.startBitrate = 200; 341 ref_codec.startBitrate = 200;
351 VerifyCodec(ref_codec, 1); 342 VerifyCodec(ref_codec, 1);
352 343
353 // stream 2, the biggest resolution stream. 344 // stream 2, the biggest resolution stream.
354 InitRefCodec(2, &ref_codec); 345 InitRefCodec(2, &ref_codec);
355 // We don't have enough bits to send this, so the adapter should have 346 // We don't have enough bits to send this, so the adapter should have
356 // configured it to use the min bitrate for this layer (600kbit) but turn 347 // configured it to use the min bitrate for this layer (600kbit) but turn
357 // off sending. 348 // off sending.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 kDefaultWidth, kDefaultHeight, kDefaultWidth, half_width, half_width); 531 kDefaultWidth, kDefaultHeight, kDefaultWidth, half_width, half_width);
541 input_buffer->InitializeData(); 532 input_buffer->InitializeData();
542 VideoFrame input_frame(input_buffer, 0, 0, webrtc::kVideoRotation_0); 533 VideoFrame input_frame(input_buffer, 0, 0, webrtc::kVideoRotation_0);
543 std::vector<FrameType> frame_types(3, kVideoFrameKey); 534 std::vector<FrameType> frame_types(3, kVideoFrameKey);
544 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, 535 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE,
545 adapter_->Encode(input_frame, nullptr, &frame_types)); 536 adapter_->Encode(input_frame, nullptr, &frame_types));
546 } 537 }
547 538
548 } // namespace testing 539 } // namespace testing
549 } // namespace webrtc 540 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698