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/video_sender_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) 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
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec_, 1, 1200)); 407 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec_, 1, 1200));
408 } 408 }
409 409
410 static VideoCodec MakeVp8VideoCodec(int width, 410 static VideoCodec MakeVp8VideoCodec(int width,
411 int height, 411 int height,
412 int temporal_layers) { 412 int temporal_layers) {
413 VideoCodec codec; 413 VideoCodec codec;
414 VideoCodingModule::Codec(kVideoCodecVP8, &codec); 414 VideoCodingModule::Codec(kVideoCodecVP8, &codec);
415 codec.width = width; 415 codec.width = width;
416 codec.height = height; 416 codec.height = height;
417 codec.codecSpecific.VP8.numberOfTemporalLayers = temporal_layers; 417 codec.VP8()->numberOfTemporalLayers = temporal_layers;
418 return codec; 418 return codec;
419 } 419 }
420 420
421 void InsertFrames(float framerate, float seconds) { 421 void InsertFrames(float framerate, float seconds) {
422 for (int i = 0; i < seconds * framerate; ++i) { 422 for (int i = 0; i < seconds * framerate; ++i) {
423 clock_.AdvanceTimeMilliseconds(1000.0f / framerate); 423 clock_.AdvanceTimeMilliseconds(1000.0f / framerate);
424 AddFrame(); 424 AddFrame();
425 // SetChannelParameters needs to be called frequently to propagate 425 // SetChannelParameters needs to be called frequently to propagate
426 // framerate from the media optimization into the encoder. 426 // framerate from the media optimization into the encoder.
427 // Note: SetChannelParameters fails if less than 2 frames are in the 427 // Note: SetChannelParameters fails if less than 2 frames are in the
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 472
473 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) 473 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
474 #define MAYBE_RealTimeTemporalLayersStrategy \ 474 #define MAYBE_RealTimeTemporalLayersStrategy \
475 DISABLED_RealTimeTemporalLayersStrategy 475 DISABLED_RealTimeTemporalLayersStrategy
476 #else 476 #else
477 #define MAYBE_RealTimeTemporalLayersStrategy RealTimeTemporalLayersStrategy 477 #define MAYBE_RealTimeTemporalLayersStrategy RealTimeTemporalLayersStrategy
478 #endif 478 #endif
479 TEST_F(TestVideoSenderWithVp8, MAYBE_RealTimeTemporalLayersStrategy) { 479 TEST_F(TestVideoSenderWithVp8, MAYBE_RealTimeTemporalLayersStrategy) {
480 VideoCodec codec = MakeVp8VideoCodec(352, 288, 3); 480 VideoCodec codec = MakeVp8VideoCodec(352, 288, 3);
481 RealTimeTemporalLayersFactory realtime_tl_factory; 481 RealTimeTemporalLayersFactory realtime_tl_factory;
482 codec.codecSpecific.VP8.tl_factory = &realtime_tl_factory; 482 codec.VP8()->tl_factory = &realtime_tl_factory;
483 codec.minBitrate = 10; 483 codec.minBitrate = 10;
484 codec.startBitrate = codec_bitrate_kbps_; 484 codec.startBitrate = codec_bitrate_kbps_;
485 codec.maxBitrate = codec_bitrate_kbps_; 485 codec.maxBitrate = codec_bitrate_kbps_;
486 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec, 1, 1200)); 486 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec, 1, 1200));
487 487
488 const int low_b = codec_bitrate_kbps_ * 0.4; 488 const int low_b = codec_bitrate_kbps_ * 0.4;
489 const int mid_b = codec_bitrate_kbps_ * 0.6; 489 const int mid_b = codec_bitrate_kbps_ * 0.6;
490 const int high_b = codec_bitrate_kbps_; 490 const int high_b = codec_bitrate_kbps_;
491 491
492 { 492 {
(...skipping 14 matching lines...) Expand all
507 } 507 }
508 { 508 {
509 // TODO(andresp): Find out why this fails with framerate = 7.5 509 // TODO(andresp): Find out why this fails with framerate = 7.5
510 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}}; 510 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}};
511 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); 511 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected));
512 } 512 }
513 } 513 }
514 } // namespace 514 } // namespace
515 } // namespace vcm 515 } // namespace vcm
516 } // namespace webrtc 516 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698