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

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

Issue 2088233004: Add RTX codecs for codecs only supported by external encoder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removing now-unused constant. Created 4 years, 5 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | 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) 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // Setting codecs of the same type should not reallocate any encoders 381 // Setting codecs of the same type should not reallocate any encoders
382 // (expecting a no-op). 382 // (expecting a no-op).
383 EXPECT_TRUE(channel->SetSendParameters(parameters)); 383 EXPECT_TRUE(channel->SetSendParameters(parameters));
384 EXPECT_EQ(num_created_encoders, encoder_factory.GetNumCreatedEncoders()); 384 EXPECT_EQ(num_created_encoders, encoder_factory.GetNumCreatedEncoders());
385 385
386 // Remove stream previously added to free the external encoder instance. 386 // Remove stream previously added to free the external encoder instance.
387 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); 387 EXPECT_TRUE(channel->RemoveSendStream(kSsrc));
388 EXPECT_EQ(0u, encoder_factory.encoders().size()); 388 EXPECT_EQ(0u, encoder_factory.encoders().size());
389 } 389 }
390 390
391 // Test that when an external encoder factory supports a codec we don't
392 // internally support, we still add an RTX codec for it.
393 // TODO(deadbeef): Currently this test is only effective if WebRTC is
394 // built with no internal H264 support. This test should be updated
395 // if/when we start adding RTX codecs for unrecognized codec names.
396 TEST_F(WebRtcVideoEngine2Test, RtxCodecAddedForExternalCodec) {
397 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
398 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecH264, "H264");
399 engine_.SetExternalEncoderFactory(&encoder_factory);
400 engine_.Init();
401
402 auto codecs = engine_.codecs();
403 // First figure out what payload type the test codec got assigned.
404 auto test_codec_it =
405 std::find_if(codecs.begin(), codecs.end(),
406 [](const VideoCodec& c) { return c.name == "H264"; });
407 ASSERT_NE(codecs.end(), test_codec_it);
408 // Now search for an RTX codec for it.
409 EXPECT_TRUE(std::any_of(codecs.begin(), codecs.end(),
410 [&test_codec_it](const VideoCodec& c) {
411 int associated_payload_type;
412 return c.name == "rtx" &&
413 c.GetParam(kCodecParamAssociatedPayloadType,
414 &associated_payload_type) &&
415 associated_payload_type == test_codec_it->id;
416 }));
417 }
418
391 void WebRtcVideoEngine2Test::TestExtendedEncoderOveruse( 419 void WebRtcVideoEngine2Test::TestExtendedEncoderOveruse(
392 bool use_external_encoder) { 420 bool use_external_encoder) {
393 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; 421 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
394 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); 422 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8");
395 cricket::VideoSendParameters parameters; 423 cricket::VideoSendParameters parameters;
396 parameters.codecs.push_back(kVp8Codec); 424 parameters.codecs.push_back(kVp8Codec);
397 std::unique_ptr<VideoMediaChannel> channel; 425 std::unique_ptr<VideoMediaChannel> channel;
398 FakeCall* fake_call = new FakeCall(webrtc::Call::Config()); 426 FakeCall* fake_call = new FakeCall(webrtc::Call::Config());
399 call_.reset(fake_call); 427 call_.reset(fake_call);
400 if (use_external_encoder) { 428 if (use_external_encoder) {
(...skipping 3385 matching lines...) Expand 10 before | Expand all | Expand 10 after
3786 } 3814 }
3787 3815
3788 // Test that we normalize send codec format size in simulcast. 3816 // Test that we normalize send codec format size in simulcast.
3789 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3817 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3790 cricket::VideoCodec codec(kVp8Codec270p); 3818 cricket::VideoCodec codec(kVp8Codec270p);
3791 codec.width += 1; 3819 codec.width += 1;
3792 codec.height += 1; 3820 codec.height += 1;
3793 VerifySimulcastSettings(codec, 2, 2); 3821 VerifySimulcastSettings(codec, 2, 2);
3794 } 3822 }
3795 } // namespace cricket 3823 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698