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 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <list> | |
12 #include <map> | 13 #include <map> |
13 #include <memory> | 14 #include <memory> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "webrtc/base/arraysize.h" | 17 #include "webrtc/base/arraysize.h" |
17 #include "webrtc/base/gunit.h" | 18 #include "webrtc/base/gunit.h" |
18 #include "webrtc/base/stringutils.h" | 19 #include "webrtc/base/stringutils.h" |
19 #include "webrtc/common_video/h264/profile_level_id.h" | 20 #include "webrtc/common_video/h264/profile_level_id.h" |
20 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
21 #include "webrtc/media/base/testutils.h" | 22 #include "webrtc/media/base/testutils.h" |
22 #include "webrtc/media/base/videoengine_unittest.h" | 23 #include "webrtc/media/base/videoengine_unittest.h" |
23 #include "webrtc/media/engine/fakewebrtccall.h" | 24 #include "webrtc/media/engine/fakewebrtccall.h" |
24 #include "webrtc/media/engine/fakewebrtcvideoengine.h" | 25 #include "webrtc/media/engine/fakewebrtcvideoengine.h" |
25 #include "webrtc/media/engine/simulcast.h" | 26 #include "webrtc/media/engine/simulcast.h" |
26 #include "webrtc/media/engine/webrtcvideoengine2.h" | 27 #include "webrtc/media/engine/webrtcvideoengine2.h" |
27 #include "webrtc/media/engine/webrtcvoiceengine.h" | 28 #include "webrtc/media/engine/webrtcvoiceengine.h" |
28 #include "webrtc/test/field_trial.h" | 29 #include "webrtc/test/field_trial.h" |
29 #include "webrtc/video_encoder.h" | 30 #include "webrtc/video_encoder.h" |
30 | 31 |
31 using webrtc::RtpExtension; | 32 using webrtc::RtpExtension; |
32 | 33 |
33 namespace { | 34 namespace { |
34 static const int kDefaultQpMax = 56; | 35 static const int kDefaultQpMax = 56; |
35 | 36 |
36 static const uint8_t kRedRtxPayloadType = 125; | 37 static const uint8_t kRedRtxPayloadType = 125; |
37 | 38 |
38 static const uint32_t kSsrcs1[] = {1}; | 39 static const uint32_t kSsrcs1[] = {1}; |
39 static const uint32_t kSsrcs3[] = {1, 2, 3}; | 40 static const uint32_t kSsrcs3[] = {1, 2, 3}; |
40 static const uint32_t kRtxSsrcs1[] = {4}; | 41 static const uint32_t kRtxSsrcs1[] = {4}; |
42 static const uint32_t kFlexfecSsrc = 5; | |
41 static const uint32_t kIncomingUnsignalledSsrc = 0xC0FFEE; | 43 static const uint32_t kIncomingUnsignalledSsrc = 0xC0FFEE; |
42 static const char kUnsupportedExtensionName[] = | 44 static const char kUnsupportedExtensionName[] = |
43 "urn:ietf:params:rtp-hdrext:unsupported"; | 45 "urn:ietf:params:rtp-hdrext:unsupported"; |
44 | 46 |
45 cricket::VideoCodec RemoveFeedbackParams(cricket::VideoCodec&& codec) { | 47 cricket::VideoCodec RemoveFeedbackParams(cricket::VideoCodec&& codec) { |
46 codec.feedback_params = cricket::FeedbackParams(); | 48 codec.feedback_params = cricket::FeedbackParams(); |
47 return codec; | 49 return codec; |
48 } | 50 } |
49 | 51 |
50 void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec) { | 52 void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec) { |
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1931 | 1933 |
1932 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set."; | 1934 ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set."; |
1933 EXPECT_FALSE(vp9_settings.denoisingOn); | 1935 EXPECT_FALSE(vp9_settings.denoisingOn); |
1934 EXPECT_FALSE(vp9_settings.frameDroppingOn); | 1936 EXPECT_FALSE(vp9_settings.frameDroppingOn); |
1935 | 1937 |
1936 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 1938 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
1937 } | 1939 } |
1938 | 1940 |
1939 class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest { | 1941 class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest { |
1940 public: | 1942 public: |
1941 Vp9SettingsTestWithFieldTrial(const char* field_trials) | 1943 explicit Vp9SettingsTestWithFieldTrial(const char* field_trials) |
1942 : Vp9SettingsTest(field_trials) {} | 1944 : Vp9SettingsTest(field_trials) {} |
1943 | 1945 |
1944 protected: | 1946 protected: |
1945 void VerifySettings(int num_spatial_layers, int num_temporal_layers) { | 1947 void VerifySettings(int num_spatial_layers, int num_temporal_layers) { |
1946 cricket::VideoSendParameters parameters; | 1948 cricket::VideoSendParameters parameters; |
1947 parameters.codecs.push_back(GetEngineCodec("VP9")); | 1949 parameters.codecs.push_back(GetEngineCodec("VP9")); |
1948 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 1950 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
1949 | 1951 |
1950 FakeVideoSendStream* stream = SetUpSimulcast(false, false); | 1952 FakeVideoSendStream* stream = SetUpSimulcast(false, false); |
1951 | 1953 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2279 EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms); | 2281 EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms); |
2280 EXPECT_EQ(GetEngineCodec("ulpfec").id, config.rtp.ulpfec.ulpfec_payload_type); | 2282 EXPECT_EQ(GetEngineCodec("ulpfec").id, config.rtp.ulpfec.ulpfec_payload_type); |
2281 EXPECT_EQ(GetEngineCodec("red").id, config.rtp.ulpfec.red_payload_type); | 2283 EXPECT_EQ(GetEngineCodec("red").id, config.rtp.ulpfec.red_payload_type); |
2282 | 2284 |
2283 EXPECT_EQ(1u, config.rtp.rtx.ssrcs.size()); | 2285 EXPECT_EQ(1u, config.rtp.rtx.ssrcs.size()); |
2284 EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]); | 2286 EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]); |
2285 VerifySendStreamHasRtxTypes(config, default_apt_rtx_types_); | 2287 VerifySendStreamHasRtxTypes(config, default_apt_rtx_types_); |
2286 // TODO(juberti): Check RTCP, PLI, TMMBR. | 2288 // TODO(juberti): Check RTCP, PLI, TMMBR. |
2287 } | 2289 } |
2288 | 2290 |
2291 // TODO(brandtr): Remove when FlexFEC _is_ exposed by default. | |
2292 TEST_F(WebRtcVideoChannel2Test, FlexfecCodecWithoutSsrcNotExposedByDefault) { | |
2293 FakeVideoSendStream* stream = AddSendStream(); | |
2294 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | |
2295 | |
2296 EXPECT_EQ(-1, config.rtp.flexfec.flexfec_payload_type); | |
2297 } | |
2298 | |
2299 // TODO(brandtr): Remove when FlexFEC _is_ exposed by default. | |
2300 TEST_F(WebRtcVideoChannel2Test, FlexfecCodecWithSsrcNotExposedByDefault) { | |
2301 FakeVideoSendStream* stream = AddSendStream( | |
2302 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); | |
2303 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | |
2304 | |
2305 EXPECT_EQ(-1, config.rtp.flexfec.flexfec_payload_type); | |
2306 } | |
2307 | |
2308 // TODO(brandtr): When FlexFEC is no longer behind a field trial, merge all | |
2309 // tests that use this test fixture into the corresponding "non-field trial" | |
2310 // tests. | |
2311 class WebRtcVideoChannel2FlexfecTest : public WebRtcVideoChannel2Test { | |
2312 public: | |
2313 WebRtcVideoChannel2FlexfecTest() | |
2314 : WebRtcVideoChannel2Test("WebRTC-FlexFEC-03/Enabled/") {} | |
2315 }; | |
2316 | |
2317 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled | |
2318 // by default. | |
2319 TEST_F(WebRtcVideoChannel2FlexfecTest, SetDefaultSendCodecsWithoutSsrc) { | |
2320 FakeVideoSendStream* stream = AddSendStream(); | |
2321 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | |
2322 | |
2323 EXPECT_EQ(GetEngineCodec("flexfec-03").id, | |
2324 config.rtp.flexfec.flexfec_payload_type); | |
2325 EXPECT_FALSE(config.rtp.flexfec.IsCompleteAndEnabled()); | |
2326 } | |
2327 | |
2328 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled | |
2329 // by default. | |
2330 TEST_F(WebRtcVideoChannel2FlexfecTest, SetDefaultSendCodecsWithSsrc) { | |
2331 FakeVideoSendStream* stream = AddSendStream( | |
2332 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); | |
2333 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | |
2334 | |
2335 EXPECT_EQ(GetEngineCodec("flexfec-03").id, | |
2336 config.rtp.flexfec.flexfec_payload_type); | |
2337 EXPECT_TRUE(config.rtp.flexfec.IsCompleteAndEnabled()); | |
2338 } | |
2339 | |
2289 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { | 2340 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { |
2290 cricket::VideoSendParameters parameters; | 2341 cricket::VideoSendParameters parameters; |
2291 parameters.codecs.push_back(GetEngineCodec("VP8")); | 2342 parameters.codecs.push_back(GetEngineCodec("VP8")); |
2292 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2343 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2293 | 2344 |
2294 FakeVideoSendStream* stream = AddSendStream(); | 2345 FakeVideoSendStream* stream = AddSendStream(); |
2295 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | 2346 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); |
2296 | 2347 |
2297 EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type); | 2348 EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type); |
2298 EXPECT_EQ(-1, config.rtp.ulpfec.red_payload_type); | 2349 EXPECT_EQ(-1, config.rtp.ulpfec.red_payload_type); |
2299 } | 2350 } |
2300 | 2351 |
2352 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled | |
2353 // by default. | |
2354 TEST_F(WebRtcVideoChannel2FlexfecTest, SetSendCodecsWithoutFec) { | |
2355 cricket::VideoSendParameters parameters; | |
2356 parameters.codecs.push_back(GetEngineCodec("VP8")); | |
2357 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | |
2358 | |
2359 FakeVideoSendStream* stream = AddSendStream(); | |
2360 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | |
2361 | |
2362 EXPECT_EQ(-1, config.rtp.flexfec.flexfec_payload_type); | |
2363 } | |
2364 | |
2301 TEST_F(WebRtcVideoChannel2Test, | 2365 TEST_F(WebRtcVideoChannel2Test, |
2302 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { | 2366 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { |
2303 const int kUnusedPayloadType = 127; | 2367 const int kUnusedPayloadType = 127; |
2304 EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType)); | 2368 EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType)); |
2305 | 2369 |
2306 cricket::VideoSendParameters parameters; | 2370 cricket::VideoSendParameters parameters; |
2307 cricket::VideoCodec rtx_codec(kUnusedPayloadType, "rtx"); | 2371 cricket::VideoCodec rtx_codec(kUnusedPayloadType, "rtx"); |
2308 parameters.codecs.push_back(rtx_codec); | 2372 parameters.codecs.push_back(rtx_codec); |
2309 EXPECT_FALSE(channel_->SetSendParameters(parameters)) | 2373 EXPECT_FALSE(channel_->SetSendParameters(parameters)) |
2310 << "RTX codec without associated payload type should be rejected."; | 2374 << "RTX codec without associated payload type should be rejected."; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2342 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2406 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2343 | 2407 |
2344 FakeVideoSendStream* stream = AddSendStream(); | 2408 FakeVideoSendStream* stream = AddSendStream(); |
2345 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | 2409 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); |
2346 | 2410 |
2347 EXPECT_EQ(GetEngineCodec("ulpfec").id, config.rtp.ulpfec.ulpfec_payload_type); | 2411 EXPECT_EQ(GetEngineCodec("ulpfec").id, config.rtp.ulpfec.ulpfec_payload_type); |
2348 | 2412 |
2349 parameters.codecs.pop_back(); | 2413 parameters.codecs.pop_back(); |
2350 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2414 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2351 stream = fake_call_->GetVideoSendStreams()[0]; | 2415 stream = fake_call_->GetVideoSendStreams()[0]; |
2352 ASSERT_TRUE(stream != NULL); | 2416 ASSERT_TRUE(stream != nullptr); |
2353 config = stream->GetConfig().Copy(); | 2417 config = stream->GetConfig().Copy(); |
2354 EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type) | 2418 EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type) |
2355 << "SetSendCodec without FEC should disable current FEC."; | 2419 << "SetSendCodec without ULPFEC should disable current ULPFEC."; |
2420 } | |
2421 | |
2422 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled | |
2423 // by default. | |
2424 TEST_F(WebRtcVideoChannel2FlexfecTest, SetSendCodecsWithoutFecDisablesFec) { | |
2425 cricket::VideoSendParameters parameters; | |
2426 parameters.codecs.push_back(GetEngineCodec("VP8")); | |
2427 parameters.codecs.push_back(GetEngineCodec("flexfec-03")); | |
2428 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | |
2429 | |
2430 FakeVideoSendStream* stream = AddSendStream( | |
2431 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); | |
2432 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | |
2433 | |
2434 EXPECT_EQ(GetEngineCodec("flexfec-03").id, | |
2435 config.rtp.flexfec.flexfec_payload_type); | |
2436 EXPECT_EQ(kFlexfecSsrc, config.rtp.flexfec.flexfec_ssrc); | |
2437 ASSERT_EQ(1U, config.rtp.flexfec.protected_media_ssrcs.size()); | |
2438 EXPECT_EQ(kSsrcs1[0], config.rtp.flexfec.protected_media_ssrcs[0]); | |
2439 | |
2440 parameters.codecs.pop_back(); | |
2441 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | |
2442 stream = fake_call_->GetVideoSendStreams()[0]; | |
2443 ASSERT_TRUE(stream != nullptr); | |
2444 config = stream->GetConfig().Copy(); | |
2445 EXPECT_EQ(-1, config.rtp.flexfec.flexfec_payload_type) | |
2446 << "SetSendCodec without FlexFEC should disable current FlexFEC."; | |
2356 } | 2447 } |
2357 | 2448 |
2358 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) { | 2449 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) { |
2359 cricket::VideoSendParameters parameters; | 2450 cricket::VideoSendParameters parameters; |
2360 cricket::VideoCodec codec(100, "VP8"); | 2451 cricket::VideoCodec codec(100, "VP8"); |
2361 codec.SetParam(kCodecParamMaxQuantization, kDefaultQpMax); | 2452 codec.SetParam(kCodecParamMaxQuantization, kDefaultQpMax); |
2362 parameters.codecs.push_back(codec); | 2453 parameters.codecs.push_back(codec); |
2363 | 2454 |
2364 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2455 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2365 channel_->SetSend(true); | 2456 channel_->SetSend(true); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2691 | 2782 |
2692 FakeVideoReceiveStream* stream = AddRecvStream(); | 2783 FakeVideoReceiveStream* stream = AddRecvStream(); |
2693 | 2784 |
2694 EXPECT_EQ(GetEngineCodec("ulpfec").id, | 2785 EXPECT_EQ(GetEngineCodec("ulpfec").id, |
2695 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type); | 2786 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type); |
2696 | 2787 |
2697 cricket::VideoRecvParameters recv_parameters; | 2788 cricket::VideoRecvParameters recv_parameters; |
2698 recv_parameters.codecs.push_back(GetEngineCodec("VP8")); | 2789 recv_parameters.codecs.push_back(GetEngineCodec("VP8")); |
2699 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); | 2790 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); |
2700 stream = fake_call_->GetVideoReceiveStreams()[0]; | 2791 stream = fake_call_->GetVideoReceiveStreams()[0]; |
2701 ASSERT_TRUE(stream != NULL); | 2792 ASSERT_TRUE(stream != nullptr); |
2702 EXPECT_EQ(-1, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) | 2793 EXPECT_EQ(-1, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) |
2703 << "SetSendCodec without FEC should disable current FEC."; | 2794 << "SetSendCodec without ULPFEC should disable current ULPFEC."; |
2795 } | |
2796 | |
2797 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled | |
2798 // by default. | |
2799 TEST_F(WebRtcVideoChannel2FlexfecTest, SetRecvParamsWithoutFecDisablesFec) { | |
2800 cricket::VideoSendParameters send_parameters; | |
2801 send_parameters.codecs.push_back(GetEngineCodec("VP8")); | |
2802 send_parameters.codecs.push_back(GetEngineCodec("flexfec-03")); | |
2803 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); | |
2804 | |
2805 AddRecvStream( | |
2806 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); | |
2807 const std::list<FakeFlexfecReceiveStream>& streams = | |
2808 fake_call_->GetFlexfecReceiveStreams(); | |
2809 | |
2810 ASSERT_EQ(1U, streams.size()); | |
2811 const FakeFlexfecReceiveStream& stream = streams.front(); | |
2812 EXPECT_EQ(GetEngineCodec("flexfec-03").id, | |
2813 stream.GetConfig().flexfec_payload_type); | |
2814 EXPECT_EQ(kFlexfecSsrc, stream.GetConfig().flexfec_ssrc); | |
2815 ASSERT_EQ(1U, stream.GetConfig().protected_media_ssrcs.size()); | |
2816 EXPECT_EQ(kSsrcs1[0], stream.GetConfig().protected_media_ssrcs[0]); | |
2817 | |
2818 cricket::VideoRecvParameters recv_parameters; | |
2819 recv_parameters.codecs.push_back(GetEngineCodec("VP8")); | |
2820 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); | |
2821 EXPECT_TRUE(streams.empty()) | |
2822 << "SetSendCodec without FlexFEC should disable current FlexFEC."; | |
2704 } | 2823 } |
2705 | 2824 |
2706 TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithFecEnablesFec) { | 2825 TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithFecEnablesFec) { |
2707 FakeVideoReceiveStream* stream = AddRecvStream(); | 2826 FakeVideoReceiveStream* stream = AddRecvStream(); |
2708 EXPECT_EQ(GetEngineCodec("ulpfec").id, | 2827 EXPECT_EQ(GetEngineCodec("ulpfec").id, |
2709 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type); | 2828 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type); |
2710 | 2829 |
2711 cricket::VideoRecvParameters recv_parameters; | 2830 cricket::VideoRecvParameters recv_parameters; |
2712 recv_parameters.codecs.push_back(GetEngineCodec("VP8")); | 2831 recv_parameters.codecs.push_back(GetEngineCodec("VP8")); |
2713 recv_parameters.codecs.push_back(GetEngineCodec("red")); | 2832 recv_parameters.codecs.push_back(GetEngineCodec("red")); |
2714 recv_parameters.codecs.push_back(GetEngineCodec("ulpfec")); | 2833 recv_parameters.codecs.push_back(GetEngineCodec("ulpfec")); |
2715 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); | 2834 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); |
2716 stream = fake_call_->GetVideoReceiveStreams()[0]; | 2835 stream = fake_call_->GetVideoReceiveStreams()[0]; |
2717 ASSERT_TRUE(stream != NULL); | 2836 ASSERT_TRUE(stream != nullptr); |
2718 EXPECT_EQ(GetEngineCodec("ulpfec").id, | 2837 EXPECT_EQ(GetEngineCodec("ulpfec").id, |
2719 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) | 2838 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) |
2720 << "FEC should be enabled on the receive stream."; | 2839 << "ULPFEC should be enabled on the receive stream."; |
2721 | 2840 |
2722 cricket::VideoSendParameters send_parameters; | 2841 cricket::VideoSendParameters send_parameters; |
2723 send_parameters.codecs.push_back(GetEngineCodec("VP8")); | 2842 send_parameters.codecs.push_back(GetEngineCodec("VP8")); |
2724 send_parameters.codecs.push_back(GetEngineCodec("red")); | 2843 send_parameters.codecs.push_back(GetEngineCodec("red")); |
2725 send_parameters.codecs.push_back(GetEngineCodec("ulpfec")); | 2844 send_parameters.codecs.push_back(GetEngineCodec("ulpfec")); |
2726 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); | 2845 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); |
2727 stream = fake_call_->GetVideoReceiveStreams()[0]; | 2846 stream = fake_call_->GetVideoReceiveStreams()[0]; |
2728 EXPECT_EQ(GetEngineCodec("ulpfec").id, | 2847 EXPECT_EQ(GetEngineCodec("ulpfec").id, |
2729 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) | 2848 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) |
2730 << "FEC should be enabled on the receive stream."; | 2849 << "ULPFEC should be enabled on the receive stream."; |
2850 } | |
2851 | |
2852 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled | |
2853 // by default. | |
2854 TEST_F(WebRtcVideoChannel2FlexfecTest, SetSendParamsWithFecEnablesFec) { | |
2855 AddRecvStream( | |
2856 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); | |
2857 const std::list<FakeFlexfecReceiveStream>& streams = | |
2858 fake_call_->GetFlexfecReceiveStreams(); | |
2859 | |
2860 cricket::VideoRecvParameters recv_parameters; | |
2861 recv_parameters.codecs.push_back(GetEngineCodec("VP8")); | |
2862 recv_parameters.codecs.push_back(GetEngineCodec("flexfec-03")); | |
2863 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); | |
2864 ASSERT_EQ(1U, streams.size()); | |
2865 const FakeFlexfecReceiveStream& stream_with_recv_params = streams.front(); | |
2866 EXPECT_EQ(GetEngineCodec("flexfec-03").id, | |
2867 stream_with_recv_params.GetConfig().flexfec_payload_type); | |
2868 EXPECT_EQ(kFlexfecSsrc, stream_with_recv_params.GetConfig().flexfec_ssrc); | |
2869 EXPECT_EQ(1U, | |
2870 stream_with_recv_params.GetConfig().protected_media_ssrcs.size()); | |
2871 EXPECT_EQ(kSsrcs1[0], | |
2872 stream_with_recv_params.GetConfig().protected_media_ssrcs[0]); | |
2873 | |
2874 cricket::VideoSendParameters send_parameters; | |
2875 send_parameters.codecs.push_back(GetEngineCodec("VP8")); | |
2876 send_parameters.codecs.push_back(GetEngineCodec("flexfec-03")); | |
2877 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); | |
brandtr
2016/11/21 16:03:47
A crucial line was missing here.
| |
2878 ASSERT_EQ(1U, streams.size()); | |
2879 const FakeFlexfecReceiveStream& stream_with_send_params = streams.front(); | |
2880 EXPECT_EQ(GetEngineCodec("flexfec-03").id, | |
2881 stream_with_send_params.GetConfig().flexfec_payload_type); | |
2882 EXPECT_EQ(kFlexfecSsrc, stream_with_send_params.GetConfig().flexfec_ssrc); | |
2883 EXPECT_EQ(1U, | |
2884 stream_with_send_params.GetConfig().protected_media_ssrcs.size()); | |
2885 EXPECT_EQ(kSsrcs1[0], | |
2886 stream_with_send_params.GetConfig().protected_media_ssrcs[0]); | |
2731 } | 2887 } |
2732 | 2888 |
2733 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { | 2889 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { |
2734 cricket::VideoRecvParameters parameters; | 2890 cricket::VideoRecvParameters parameters; |
2735 parameters.codecs.push_back(GetEngineCodec("VP8")); | 2891 parameters.codecs.push_back(GetEngineCodec("VP8")); |
2736 parameters.codecs.push_back(GetEngineCodec("red")); | 2892 parameters.codecs.push_back(GetEngineCodec("red")); |
2737 parameters.codecs[1].id = parameters.codecs[0].id; | 2893 parameters.codecs[1].id = parameters.codecs[0].id; |
2738 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); | 2894 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); |
2739 } | 2895 } |
2740 | 2896 |
2897 // TODO(brandtr): Merge into "non-field trial" test when FlexFEC is enabled | |
2898 // by default. | |
2899 TEST_F(WebRtcVideoChannel2FlexfecTest, | |
2900 SetSendCodecsRejectDuplicateFecPayloads) { | |
2901 cricket::VideoRecvParameters parameters; | |
2902 parameters.codecs.push_back(GetEngineCodec("VP8")); | |
2903 parameters.codecs.push_back(GetEngineCodec("flexfec-03")); | |
2904 parameters.codecs[1].id = parameters.codecs[0].id; | |
2905 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); | |
2906 } | |
2907 | |
2741 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectDuplicateCodecPayloads) { | 2908 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectDuplicateCodecPayloads) { |
2742 cricket::VideoRecvParameters parameters; | 2909 cricket::VideoRecvParameters parameters; |
2743 parameters.codecs.push_back(GetEngineCodec("VP8")); | 2910 parameters.codecs.push_back(GetEngineCodec("VP8")); |
2744 parameters.codecs.push_back(GetEngineCodec("VP9")); | 2911 parameters.codecs.push_back(GetEngineCodec("VP9")); |
2745 parameters.codecs[1].id = parameters.codecs[0].id; | 2912 parameters.codecs[1].id = parameters.codecs[0].id; |
2746 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); | 2913 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); |
2747 } | 2914 } |
2748 | 2915 |
2749 TEST_F(WebRtcVideoChannel2Test, | 2916 TEST_F(WebRtcVideoChannel2Test, |
2750 SetRecvCodecsAcceptSameCodecOnMultiplePayloadTypes) { | 2917 SetRecvCodecsAcceptSameCodecOnMultiplePayloadTypes) { |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3370 const int rtx_vp8_payload_type = default_apt_rtx_types_[vp8.id]; | 3537 const int rtx_vp8_payload_type = default_apt_rtx_types_[vp8.id]; |
3371 TestReceiveUnsignaledSsrcPacket(rtx_vp8_payload_type, | 3538 TestReceiveUnsignaledSsrcPacket(rtx_vp8_payload_type, |
3372 false /* expect_created_receive_stream */); | 3539 false /* expect_created_receive_stream */); |
3373 } | 3540 } |
3374 | 3541 |
3375 TEST_F(WebRtcVideoChannel2Test, UlpfecPacketDoesntCreateUnsignalledStream) { | 3542 TEST_F(WebRtcVideoChannel2Test, UlpfecPacketDoesntCreateUnsignalledStream) { |
3376 TestReceiveUnsignaledSsrcPacket(GetEngineCodec("ulpfec").id, | 3543 TestReceiveUnsignaledSsrcPacket(GetEngineCodec("ulpfec").id, |
3377 false /* expect_created_receive_stream */); | 3544 false /* expect_created_receive_stream */); |
3378 } | 3545 } |
3379 | 3546 |
3547 // TODO(brandtr): Change to "non-field trial" test when FlexFEC is enabled | |
3548 // by default. | |
3549 TEST_F(WebRtcVideoChannel2FlexfecTest, | |
3550 FlexfecPacketDoesntCreateUnsignalledStream) { | |
3551 TestReceiveUnsignaledSsrcPacket(GetEngineCodec("flexfec-03").id, | |
3552 false /* expect_created_receive_stream */); | |
3553 } | |
3554 | |
3380 TEST_F(WebRtcVideoChannel2Test, RedRtxPacketDoesntCreateUnsignalledStream) { | 3555 TEST_F(WebRtcVideoChannel2Test, RedRtxPacketDoesntCreateUnsignalledStream) { |
3381 TestReceiveUnsignaledSsrcPacket(kRedRtxPayloadType, | 3556 TestReceiveUnsignaledSsrcPacket(kRedRtxPayloadType, |
3382 false /* expect_created_receive_stream */); | 3557 false /* expect_created_receive_stream */); |
3383 } | 3558 } |
3384 | 3559 |
3385 TEST_F(WebRtcVideoChannel2Test, CanSentMaxBitrateForExistingStream) { | 3560 TEST_F(WebRtcVideoChannel2Test, CanSentMaxBitrateForExistingStream) { |
3386 AddSendStream(); | 3561 AddSendStream(); |
3387 | 3562 |
3388 cricket::FakeVideoCapturer capturer; | 3563 cricket::FakeVideoCapturer capturer; |
3389 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); | 3564 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
3390 cricket::VideoFormat capture_format_hd = | 3565 cricket::VideoFormat capture_format_hd = |
3391 capturer.GetSupportedFormats()->front(); | 3566 capturer.GetSupportedFormats()->front(); |
3392 EXPECT_EQ(1280, capture_format_hd.width); | 3567 EXPECT_EQ(1280, capture_format_hd.width); |
3393 EXPECT_EQ(720, capture_format_hd.height); | 3568 EXPECT_EQ(720, capture_format_hd.height); |
3394 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); | 3569 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); |
3395 EXPECT_TRUE(channel_->SetSend(true)); | 3570 EXPECT_TRUE(channel_->SetSend(true)); |
3396 capturer.CaptureFrame(); | 3571 capturer.CaptureFrame(); |
3397 | 3572 |
3398 int default_encoder_bitrate = GetMaxEncoderBitrate(); | 3573 int default_encoder_bitrate = GetMaxEncoderBitrate(); |
3399 EXPECT_TRUE(default_encoder_bitrate > 1000); | 3574 EXPECT_GT(default_encoder_bitrate, 1000); |
3400 | 3575 |
3401 // TODO(skvlad): Resolve the inconsistency between the interpretation | 3576 // TODO(skvlad): Resolve the inconsistency between the interpretation |
3402 // of the global bitrate limit for audio and video: | 3577 // of the global bitrate limit for audio and video: |
3403 // - Audio: max_bandwidth_bps = 0 - fail the operation, | 3578 // - Audio: max_bandwidth_bps = 0 - fail the operation, |
3404 // max_bandwidth_bps = -1 - remove the bandwidth limit | 3579 // max_bandwidth_bps = -1 - remove the bandwidth limit |
3405 // - Video: max_bandwidth_bps = 0 - remove the bandwidth limit, | 3580 // - Video: max_bandwidth_bps = 0 - remove the bandwidth limit, |
3406 // max_bandwidth_bps = -1 - do not change the previously set | 3581 // max_bandwidth_bps = -1 - do not change the previously set |
3407 // limit. | 3582 // limit. |
3408 | 3583 |
3409 SetAndExpectMaxBitrate(1000, 0, 1000); | 3584 SetAndExpectMaxBitrate(1000, 0, 1000); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3814 | 3989 |
3815 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { | 3990 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { |
3816 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); | 3991 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); |
3817 } | 3992 } |
3818 | 3993 |
3819 // Test that we normalize send codec format size in simulcast. | 3994 // Test that we normalize send codec format size in simulcast. |
3820 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3995 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3821 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); | 3996 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); |
3822 } | 3997 } |
3823 } // namespace cricket | 3998 } // namespace cricket |
OLD | NEW |