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