OLD | NEW |
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 Loading... |
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 TEST_F(WebRtcVideoEngine2Test, RtxCodecAddedForExternalCodec) { |
| 394 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 395 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecUnknown, |
| 396 "TEST"); |
| 397 engine_.SetExternalEncoderFactory(&encoder_factory); |
| 398 engine_.Init(); |
| 399 |
| 400 auto codecs = engine_.codecs(); |
| 401 // First figure out what payload type the test codec got assigned. |
| 402 auto test_codec_it = |
| 403 std::find_if(codecs.begin(), codecs.end(), |
| 404 [](const VideoCodec& c) { return c.name == "TEST"; }); |
| 405 ASSERT_NE(codecs.end(), test_codec_it); |
| 406 // Now search for an RTX codec for it. |
| 407 EXPECT_TRUE(std::any_of(codecs.begin(), codecs.end(), |
| 408 [&test_codec_it](const VideoCodec& c) { |
| 409 int associated_payload_type; |
| 410 return c.name == "rtx" && |
| 411 c.GetParam(kCodecParamAssociatedPayloadType, |
| 412 &associated_payload_type) && |
| 413 associated_payload_type == test_codec_it->id; |
| 414 })); |
| 415 } |
| 416 |
391 void WebRtcVideoEngine2Test::TestExtendedEncoderOveruse( | 417 void WebRtcVideoEngine2Test::TestExtendedEncoderOveruse( |
392 bool use_external_encoder) { | 418 bool use_external_encoder) { |
393 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 419 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
394 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); | 420 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); |
395 cricket::VideoSendParameters parameters; | 421 cricket::VideoSendParameters parameters; |
396 parameters.codecs.push_back(kVp8Codec); | 422 parameters.codecs.push_back(kVp8Codec); |
397 std::unique_ptr<VideoMediaChannel> channel; | 423 std::unique_ptr<VideoMediaChannel> channel; |
398 FakeCall* fake_call = new FakeCall(webrtc::Call::Config()); | 424 FakeCall* fake_call = new FakeCall(webrtc::Call::Config()); |
399 call_.reset(fake_call); | 425 call_.reset(fake_call); |
400 if (use_external_encoder) { | 426 if (use_external_encoder) { |
(...skipping 3385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3786 } | 3812 } |
3787 | 3813 |
3788 // Test that we normalize send codec format size in simulcast. | 3814 // Test that we normalize send codec format size in simulcast. |
3789 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3815 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3790 cricket::VideoCodec codec(kVp8Codec270p); | 3816 cricket::VideoCodec codec(kVp8Codec270p); |
3791 codec.width += 1; | 3817 codec.width += 1; |
3792 codec.height += 1; | 3818 codec.height += 1; |
3793 VerifySimulcastSettings(codec, 2, 2); | 3819 VerifySimulcastSettings(codec, 2, 2); |
3794 } | 3820 } |
3795 } // namespace cricket | 3821 } // namespace cricket |
OLD | NEW |