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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 1970343002: Make sure WebRTC works without libvpx VP9 support. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add test to make sure VP9 support isn't announced 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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // initialized when the constructor is called. 143 // initialized when the constructor is called.
144 std::unique_ptr<webrtc::Call> call_; 144 std::unique_ptr<webrtc::Call> call_;
145 WebRtcVoiceEngine voice_engine_; 145 WebRtcVoiceEngine voice_engine_;
146 WebRtcVideoEngine2 engine_; 146 WebRtcVideoEngine2 engine_;
147 VideoCodec default_codec_; 147 VideoCodec default_codec_;
148 VideoCodec default_red_codec_; 148 VideoCodec default_red_codec_;
149 VideoCodec default_ulpfec_codec_; 149 VideoCodec default_ulpfec_codec_;
150 std::map<int, int> default_apt_rtx_types_; 150 std::map<int, int> default_apt_rtx_types_;
151 }; 151 };
152 152
153 TEST_F(WebRtcVideoEngine2Test, AnnouncesVp9AccordingToBuildFlags) {
154 bool claims_vp9_support = false;
155 for (const cricket::VideoCodec& codec : engine_.codecs()) {
156 if (codec.name == "VP9") {
157 claims_vp9_support = true;
158 break;
159 }
160 }
161 #if defined(RTC_DISABLE_VP9)
162 EXPECT_FALSE(claims_vp9_support);
163 #else
164 EXPECT_TRUE(claims_vp9_support);
165 #endif // defined(RTC_DISABLE_VP9)
166 }
167
153 TEST_F(WebRtcVideoEngine2Test, DefaultRtxCodecHasAssociatedPayloadTypeSet) { 168 TEST_F(WebRtcVideoEngine2Test, DefaultRtxCodecHasAssociatedPayloadTypeSet) {
154 std::vector<VideoCodec> engine_codecs = engine_.codecs(); 169 std::vector<VideoCodec> engine_codecs = engine_.codecs();
155 for (size_t i = 0; i < engine_codecs.size(); ++i) { 170 for (size_t i = 0; i < engine_codecs.size(); ++i) {
156 if (engine_codecs[i].name != kRtxCodecName) 171 if (engine_codecs[i].name != kRtxCodecName)
157 continue; 172 continue;
158 int associated_payload_type; 173 int associated_payload_type;
159 EXPECT_TRUE(engine_codecs[i].GetParam(kCodecParamAssociatedPayloadType, 174 EXPECT_TRUE(engine_codecs[i].GetParam(kCodecParamAssociatedPayloadType,
160 &associated_payload_type)); 175 &associated_payload_type));
161 EXPECT_EQ(default_codec_.id, associated_payload_type); 176 EXPECT_EQ(default_codec_.id, associated_payload_type);
162 return; 177 return;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 422 }
408 423
409 TEST_F(WebRtcVideoEngine2Test, EnablesFullEncoderTimeForExternalEncoders) { 424 TEST_F(WebRtcVideoEngine2Test, EnablesFullEncoderTimeForExternalEncoders) {
410 TestExtendedEncoderOveruse(true); 425 TestExtendedEncoderOveruse(true);
411 } 426 }
412 427
413 TEST_F(WebRtcVideoEngine2Test, DisablesFullEncoderTimeForNonExternalEncoders) { 428 TEST_F(WebRtcVideoEngine2Test, DisablesFullEncoderTimeForNonExternalEncoders) {
414 TestExtendedEncoderOveruse(false); 429 TestExtendedEncoderOveruse(false);
415 } 430 }
416 431
432 #if !defined(RTC_DISABLE_VP9)
417 TEST_F(WebRtcVideoEngine2Test, CanConstructDecoderForVp9EncoderFactory) { 433 TEST_F(WebRtcVideoEngine2Test, CanConstructDecoderForVp9EncoderFactory) {
418 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; 434 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
419 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP9, "VP9"); 435 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP9, "VP9");
420 std::vector<cricket::VideoCodec> codecs; 436 std::vector<cricket::VideoCodec> codecs;
421 codecs.push_back(kVp9Codec); 437 codecs.push_back(kVp9Codec);
422 438
423 std::unique_ptr<VideoMediaChannel> channel( 439 std::unique_ptr<VideoMediaChannel> channel(
424 SetUpForExternalEncoderFactory(&encoder_factory, codecs)); 440 SetUpForExternalEncoderFactory(&encoder_factory, codecs));
425 441
426 EXPECT_TRUE( 442 EXPECT_TRUE(
427 channel->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc))); 443 channel->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc)));
428 } 444 }
445 #endif // !defined(RTC_DISABLE_VP9)
429 446
430 TEST_F(WebRtcVideoEngine2Test, PropagatesInputFrameTimestamp) { 447 TEST_F(WebRtcVideoEngine2Test, PropagatesInputFrameTimestamp) {
431 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; 448 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
432 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); 449 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8");
433 std::vector<cricket::VideoCodec> codecs; 450 std::vector<cricket::VideoCodec> codecs;
434 codecs.push_back(kVp8Codec); 451 codecs.push_back(kVp8Codec);
435 452
436 FakeCall* fake_call = new FakeCall(webrtc::Call::Config()); 453 FakeCall* fake_call = new FakeCall(webrtc::Call::Config());
437 call_.reset(fake_call); 454 call_.reset(fake_call);
438 std::unique_ptr<VideoMediaChannel> channel( 455 std::unique_ptr<VideoMediaChannel> channel(
(...skipping 3254 matching lines...) Expand 10 before | Expand all | Expand 10 after
3693 } 3710 }
3694 3711
3695 // Test that we normalize send codec format size in simulcast. 3712 // Test that we normalize send codec format size in simulcast.
3696 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3713 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3697 cricket::VideoCodec codec(kVp8Codec270p); 3714 cricket::VideoCodec codec(kVp8Codec270p);
3698 codec.width += 1; 3715 codec.width += 1;
3699 codec.height += 1; 3716 codec.height += 1;
3700 VerifySimulcastSettings(codec, 2, 2); 3717 VerifySimulcastSettings(codec, 2, 2);
3701 } 3718 }
3702 } // namespace cricket 3719 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698