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

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

Powered by Google App Engine
This is Rietveld 408576698