OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 protected: | 145 protected: |
146 VideoMediaChannel* SetUpForExternalEncoderFactory( | 146 VideoMediaChannel* SetUpForExternalEncoderFactory( |
147 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 147 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
148 const std::vector<VideoCodec>& codecs); | 148 const std::vector<VideoCodec>& codecs); |
149 | 149 |
150 VideoMediaChannel* SetUpForExternalDecoderFactory( | 150 VideoMediaChannel* SetUpForExternalDecoderFactory( |
151 cricket::WebRtcVideoDecoderFactory* decoder_factory, | 151 cricket::WebRtcVideoDecoderFactory* decoder_factory, |
152 const std::vector<VideoCodec>& codecs); | 152 const std::vector<VideoCodec>& codecs); |
153 | 153 |
| 154 void TestExtendedEncoderOveruse(bool use_external_encoder); |
| 155 |
154 webrtc::test::ScopedFieldTrials override_field_trials_; | 156 webrtc::test::ScopedFieldTrials override_field_trials_; |
155 // Used in WebRtcVideoEngine2VoiceTest, but defined here so it's properly | 157 // Used in WebRtcVideoEngine2VoiceTest, but defined here so it's properly |
156 // initialized when the constructor is called. | 158 // initialized when the constructor is called. |
157 rtc::scoped_ptr<webrtc::Call> call_; | 159 rtc::scoped_ptr<webrtc::Call> call_; |
158 WebRtcVoiceEngine voice_engine_; | 160 WebRtcVoiceEngine voice_engine_; |
159 WebRtcVideoEngine2 engine_; | 161 WebRtcVideoEngine2 engine_; |
160 VideoCodec default_codec_; | 162 VideoCodec default_codec_; |
161 VideoCodec default_red_codec_; | 163 VideoCodec default_red_codec_; |
162 VideoCodec default_ulpfec_codec_; | 164 VideoCodec default_ulpfec_codec_; |
163 std::map<int, int> default_apt_rtx_types_; | 165 std::map<int, int> default_apt_rtx_types_; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // Setting codecs of the same type should not reallocate any encoders | 393 // Setting codecs of the same type should not reallocate any encoders |
392 // (expecting a no-op). | 394 // (expecting a no-op). |
393 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 395 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
394 EXPECT_EQ(num_created_encoders, encoder_factory.GetNumCreatedEncoders()); | 396 EXPECT_EQ(num_created_encoders, encoder_factory.GetNumCreatedEncoders()); |
395 | 397 |
396 // Remove stream previously added to free the external encoder instance. | 398 // Remove stream previously added to free the external encoder instance. |
397 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); | 399 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); |
398 EXPECT_EQ(0u, encoder_factory.encoders().size()); | 400 EXPECT_EQ(0u, encoder_factory.encoders().size()); |
399 } | 401 } |
400 | 402 |
| 403 void WebRtcVideoEngine2Test::TestExtendedEncoderOveruse( |
| 404 bool use_external_encoder) { |
| 405 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 406 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); |
| 407 cricket::VideoSendParameters parameters; |
| 408 parameters.codecs.push_back(kVp8Codec); |
| 409 rtc::scoped_ptr<VideoMediaChannel> channel; |
| 410 FakeCall* fake_call = new FakeCall(webrtc::Call::Config()); |
| 411 call_.reset(fake_call); |
| 412 if (use_external_encoder) { |
| 413 channel.reset( |
| 414 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); |
| 415 } else { |
| 416 engine_.Init(); |
| 417 channel.reset(engine_.CreateChannel(call_.get(), cricket::VideoOptions())); |
| 418 } |
| 419 ASSERT_TRUE( |
| 420 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
| 421 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
| 422 EXPECT_TRUE(channel->SetSend(true)); |
| 423 FakeVideoSendStream* stream = fake_call->GetVideoSendStreams()[0]; |
| 424 |
| 425 EXPECT_EQ(use_external_encoder, |
| 426 stream->GetConfig().encoder_settings.full_overuse_time); |
| 427 // Remove stream previously added to free the external encoder instance. |
| 428 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); |
| 429 } |
| 430 |
| 431 TEST_F(WebRtcVideoEngine2Test, EnablesFullEncoderTimeForExternalEncoders) { |
| 432 TestExtendedEncoderOveruse(true); |
| 433 } |
| 434 |
| 435 TEST_F(WebRtcVideoEngine2Test, DisablesFullEncoderTimeForExternalEncoders) { |
| 436 TestExtendedEncoderOveruse(false); |
| 437 } |
| 438 |
401 TEST_F(WebRtcVideoEngine2Test, CanConstructDecoderForVp9EncoderFactory) { | 439 TEST_F(WebRtcVideoEngine2Test, CanConstructDecoderForVp9EncoderFactory) { |
402 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 440 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
403 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP9, "VP9"); | 441 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP9, "VP9"); |
404 std::vector<cricket::VideoCodec> codecs; | 442 std::vector<cricket::VideoCodec> codecs; |
405 codecs.push_back(kVp9Codec); | 443 codecs.push_back(kVp9Codec); |
406 | 444 |
407 rtc::scoped_ptr<VideoMediaChannel> channel( | 445 rtc::scoped_ptr<VideoMediaChannel> channel( |
408 SetUpForExternalEncoderFactory(&encoder_factory, codecs)); | 446 SetUpForExternalEncoderFactory(&encoder_factory, codecs)); |
409 | 447 |
410 EXPECT_TRUE( | 448 EXPECT_TRUE( |
(...skipping 2991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3402 // Ensures that the correct settings are applied to the codec when two temporal | 3440 // Ensures that the correct settings are applied to the codec when two temporal |
3403 // layer screencasting is enabled, and that the correct simulcast settings are | 3441 // layer screencasting is enabled, and that the correct simulcast settings are |
3404 // reapplied when disabling screencasting. | 3442 // reapplied when disabling screencasting. |
3405 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3443 TEST_F(WebRtcVideoChannel2SimulcastTest, |
3406 DISABLED_TwoTemporalLayerScreencastSettings) { | 3444 DISABLED_TwoTemporalLayerScreencastSettings) { |
3407 // TODO(pbos): Implement. | 3445 // TODO(pbos): Implement. |
3408 FAIL() << "Not implemented."; | 3446 FAIL() << "Not implemented."; |
3409 } | 3447 } |
3410 | 3448 |
3411 } // namespace cricket | 3449 } // namespace cricket |
OLD | NEW |