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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 return buffer; | 75 return buffer; |
76 } | 76 } |
77 | 77 |
78 void VerifySendStreamHasRtxTypes(const webrtc::VideoSendStream::Config& config, | 78 void VerifySendStreamHasRtxTypes(const webrtc::VideoSendStream::Config& config, |
79 const std::map<int, int>& rtx_types) { | 79 const std::map<int, int>& rtx_types) { |
80 std::map<int, int>::const_iterator it; | 80 std::map<int, int>::const_iterator it; |
81 it = rtx_types.find(config.encoder_settings.payload_type); | 81 it = rtx_types.find(config.encoder_settings.payload_type); |
82 EXPECT_TRUE(it != rtx_types.end() && | 82 EXPECT_TRUE(it != rtx_types.end() && |
83 it->second == config.rtp.rtx.payload_type); | 83 it->second == config.rtp.rtx.payload_type); |
84 | 84 |
85 if (config.rtp.fec.red_rtx_payload_type != -1) { | 85 if (config.rtp.ulpfec.red_rtx_payload_type != -1) { |
86 it = rtx_types.find(config.rtp.fec.red_payload_type); | 86 it = rtx_types.find(config.rtp.ulpfec.red_payload_type); |
87 EXPECT_TRUE(it != rtx_types.end() && | 87 EXPECT_TRUE(it != rtx_types.end() && |
88 it->second == config.rtp.fec.red_rtx_payload_type); | 88 it->second == config.rtp.ulpfec.red_rtx_payload_type); |
89 } | 89 } |
90 } | 90 } |
91 } // namespace | 91 } // namespace |
92 | 92 |
93 namespace cricket { | 93 namespace cricket { |
94 class WebRtcVideoEngine2Test : public ::testing::Test { | 94 class WebRtcVideoEngine2Test : public ::testing::Test { |
95 public: | 95 public: |
96 WebRtcVideoEngine2Test() : WebRtcVideoEngine2Test("") {} | 96 WebRtcVideoEngine2Test() : WebRtcVideoEngine2Test("") {} |
97 explicit WebRtcVideoEngine2Test(const char* field_trials) | 97 explicit WebRtcVideoEngine2Test(const char* field_trials) |
98 : override_field_trials_(field_trials), | 98 : override_field_trials_(field_trials), |
(...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 | 2238 |
2239 // Using a RTX setup to verify that the default RTX payload type is good. | 2239 // Using a RTX setup to verify that the default RTX payload type is good. |
2240 const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1); | 2240 const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1); |
2241 const std::vector<uint32_t> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); | 2241 const std::vector<uint32_t> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
2242 FakeVideoSendStream* stream = AddSendStream( | 2242 FakeVideoSendStream* stream = AddSendStream( |
2243 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); | 2243 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); |
2244 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | 2244 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); |
2245 | 2245 |
2246 // Make sure NACK and FEC are enabled on the correct payload types. | 2246 // Make sure NACK and FEC are enabled on the correct payload types. |
2247 EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms); | 2247 EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms); |
2248 EXPECT_EQ(default_ulpfec_codec_.id, config.rtp.fec.ulpfec_payload_type); | 2248 EXPECT_EQ(default_ulpfec_codec_.id, config.rtp.ulpfec.ulpfec_payload_type); |
2249 EXPECT_EQ(default_red_codec_.id, config.rtp.fec.red_payload_type); | 2249 EXPECT_EQ(default_red_codec_.id, config.rtp.ulpfec.red_payload_type); |
2250 | 2250 |
2251 EXPECT_EQ(1u, config.rtp.rtx.ssrcs.size()); | 2251 EXPECT_EQ(1u, config.rtp.rtx.ssrcs.size()); |
2252 EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]); | 2252 EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]); |
2253 VerifySendStreamHasRtxTypes(config, default_apt_rtx_types_); | 2253 VerifySendStreamHasRtxTypes(config, default_apt_rtx_types_); |
2254 // TODO(juberti): Check RTCP, PLI, TMMBR. | 2254 // TODO(juberti): Check RTCP, PLI, TMMBR. |
2255 } | 2255 } |
2256 | 2256 |
2257 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { | 2257 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { |
2258 cricket::VideoSendParameters parameters; | 2258 cricket::VideoSendParameters parameters; |
2259 parameters.codecs.push_back(kVp8Codec); | 2259 parameters.codecs.push_back(kVp8Codec); |
2260 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2260 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2261 | 2261 |
2262 FakeVideoSendStream* stream = AddSendStream(); | 2262 FakeVideoSendStream* stream = AddSendStream(); |
2263 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | 2263 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); |
2264 | 2264 |
2265 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type); | 2265 EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type); |
2266 EXPECT_EQ(-1, config.rtp.fec.red_payload_type); | 2266 EXPECT_EQ(-1, config.rtp.ulpfec.red_payload_type); |
2267 } | 2267 } |
2268 | 2268 |
2269 TEST_F(WebRtcVideoChannel2Test, | 2269 TEST_F(WebRtcVideoChannel2Test, |
2270 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { | 2270 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { |
2271 cricket::VideoSendParameters parameters; | 2271 cricket::VideoSendParameters parameters; |
2272 cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0); | 2272 cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0); |
2273 parameters.codecs.push_back(rtx_codec); | 2273 parameters.codecs.push_back(rtx_codec); |
2274 EXPECT_FALSE(channel_->SetSendParameters(parameters)) | 2274 EXPECT_FALSE(channel_->SetSendParameters(parameters)) |
2275 << "RTX codec without associated payload type should be rejected."; | 2275 << "RTX codec without associated payload type should be rejected."; |
2276 } | 2276 } |
(...skipping 17 matching lines...) Expand all Loading... |
2294 | 2294 |
2295 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFecDisablesFec) { | 2295 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFecDisablesFec) { |
2296 cricket::VideoSendParameters parameters; | 2296 cricket::VideoSendParameters parameters; |
2297 parameters.codecs.push_back(kVp8Codec); | 2297 parameters.codecs.push_back(kVp8Codec); |
2298 parameters.codecs.push_back(kUlpfecCodec); | 2298 parameters.codecs.push_back(kUlpfecCodec); |
2299 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2299 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2300 | 2300 |
2301 FakeVideoSendStream* stream = AddSendStream(); | 2301 FakeVideoSendStream* stream = AddSendStream(); |
2302 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); | 2302 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); |
2303 | 2303 |
2304 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type); | 2304 EXPECT_EQ(kUlpfecCodec.id, config.rtp.ulpfec.ulpfec_payload_type); |
2305 | 2305 |
2306 parameters.codecs.pop_back(); | 2306 parameters.codecs.pop_back(); |
2307 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2307 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2308 stream = fake_call_->GetVideoSendStreams()[0]; | 2308 stream = fake_call_->GetVideoSendStreams()[0]; |
2309 ASSERT_TRUE(stream != NULL); | 2309 ASSERT_TRUE(stream != NULL); |
2310 config = stream->GetConfig().Copy(); | 2310 config = stream->GetConfig().Copy(); |
2311 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type) | 2311 EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type) |
2312 << "SetSendCodec without FEC should disable current FEC."; | 2312 << "SetSendCodec without FEC should disable current FEC."; |
2313 } | 2313 } |
2314 | 2314 |
2315 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) { | 2315 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) { |
2316 cricket::VideoSendParameters parameters; | 2316 cricket::VideoSendParameters parameters; |
2317 cricket::VideoCodec codec720p(100, "VP8", 1280, 720, 30); | 2317 cricket::VideoCodec codec720p(100, "VP8", 1280, 720, 30); |
2318 codec720p.SetParam(kCodecParamMaxQuantization, kDefaultQpMax); | 2318 codec720p.SetParam(kCodecParamMaxQuantization, kDefaultQpMax); |
2319 parameters.codecs.push_back(codec720p); | 2319 parameters.codecs.push_back(codec720p); |
2320 | 2320 |
2321 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2321 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 | 2650 |
2651 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) { | 2651 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) { |
2652 cricket::VideoSendParameters send_parameters; | 2652 cricket::VideoSendParameters send_parameters; |
2653 send_parameters.codecs.push_back(kVp8Codec); | 2653 send_parameters.codecs.push_back(kVp8Codec); |
2654 send_parameters.codecs.push_back(kRedCodec); | 2654 send_parameters.codecs.push_back(kRedCodec); |
2655 send_parameters.codecs.push_back(kUlpfecCodec); | 2655 send_parameters.codecs.push_back(kUlpfecCodec); |
2656 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); | 2656 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); |
2657 | 2657 |
2658 FakeVideoReceiveStream* stream = AddRecvStream(); | 2658 FakeVideoReceiveStream* stream = AddRecvStream(); |
2659 | 2659 |
2660 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type); | 2660 EXPECT_EQ(kUlpfecCodec.id, |
| 2661 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type); |
2661 | 2662 |
2662 cricket::VideoRecvParameters recv_parameters; | 2663 cricket::VideoRecvParameters recv_parameters; |
2663 recv_parameters.codecs.push_back(kVp8Codec); | 2664 recv_parameters.codecs.push_back(kVp8Codec); |
2664 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); | 2665 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); |
2665 stream = fake_call_->GetVideoReceiveStreams()[0]; | 2666 stream = fake_call_->GetVideoReceiveStreams()[0]; |
2666 ASSERT_TRUE(stream != NULL); | 2667 ASSERT_TRUE(stream != NULL); |
2667 EXPECT_EQ(-1, stream->GetConfig().rtp.fec.ulpfec_payload_type) | 2668 EXPECT_EQ(-1, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) |
2668 << "SetSendCodec without FEC should disable current FEC."; | 2669 << "SetSendCodec without FEC should disable current FEC."; |
2669 } | 2670 } |
2670 | 2671 |
2671 TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) { | 2672 TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) { |
2672 FakeVideoReceiveStream* stream = AddRecvStream(); | 2673 FakeVideoReceiveStream* stream = AddRecvStream(); |
2673 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type); | 2674 EXPECT_EQ(kUlpfecCodec.id, |
| 2675 stream->GetConfig().rtp.ulpfec.ulpfec_payload_type); |
2674 | 2676 |
2675 cricket::VideoRecvParameters recv_parameters; | 2677 cricket::VideoRecvParameters recv_parameters; |
2676 recv_parameters.codecs.push_back(kVp8Codec); | 2678 recv_parameters.codecs.push_back(kVp8Codec); |
2677 recv_parameters.codecs.push_back(kRedCodec); | 2679 recv_parameters.codecs.push_back(kRedCodec); |
2678 recv_parameters.codecs.push_back(kUlpfecCodec); | 2680 recv_parameters.codecs.push_back(kUlpfecCodec); |
2679 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); | 2681 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); |
2680 stream = fake_call_->GetVideoReceiveStreams()[0]; | 2682 stream = fake_call_->GetVideoReceiveStreams()[0]; |
2681 ASSERT_TRUE(stream != NULL); | 2683 ASSERT_TRUE(stream != NULL); |
2682 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type) | 2684 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) |
2683 << "FEC should be enabled on the recieve stream."; | 2685 << "FEC should be enabled on the recieve stream."; |
2684 | 2686 |
2685 cricket::VideoSendParameters send_parameters; | 2687 cricket::VideoSendParameters send_parameters; |
2686 send_parameters.codecs.push_back(kVp8Codec); | 2688 send_parameters.codecs.push_back(kVp8Codec); |
2687 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); | 2689 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); |
2688 stream = fake_call_->GetVideoReceiveStreams()[0]; | 2690 stream = fake_call_->GetVideoReceiveStreams()[0]; |
2689 EXPECT_EQ(-1, stream->GetConfig().rtp.fec.ulpfec_payload_type) | 2691 EXPECT_EQ(-1, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) |
2690 << "FEC should have been disabled when we know the other side won't do " | 2692 << "FEC should have been disabled when we know the other side won't do " |
2691 "FEC."; | 2693 "FEC."; |
2692 | 2694 |
2693 send_parameters.codecs.push_back(kRedCodec); | 2695 send_parameters.codecs.push_back(kRedCodec); |
2694 send_parameters.codecs.push_back(kUlpfecCodec); | 2696 send_parameters.codecs.push_back(kUlpfecCodec); |
2695 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); | 2697 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); |
2696 stream = fake_call_->GetVideoReceiveStreams()[0]; | 2698 stream = fake_call_->GetVideoReceiveStreams()[0]; |
2697 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type) | 2699 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) |
2698 << "FEC should be enabled on the recieve stream."; | 2700 << "FEC should be enabled on the recieve stream."; |
2699 } | 2701 } |
2700 | 2702 |
2701 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { | 2703 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { |
2702 cricket::VideoRecvParameters parameters; | 2704 cricket::VideoRecvParameters parameters; |
2703 parameters.codecs.push_back(kVp8Codec); | 2705 parameters.codecs.push_back(kVp8Codec); |
2704 parameters.codecs.push_back(kRedCodec); | 2706 parameters.codecs.push_back(kRedCodec); |
2705 parameters.codecs[1].id = parameters.codecs[0].id; | 2707 parameters.codecs[1].id = parameters.codecs[0].id; |
2706 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); | 2708 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); |
2707 } | 2709 } |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3852 } | 3854 } |
3853 | 3855 |
3854 // Test that we normalize send codec format size in simulcast. | 3856 // Test that we normalize send codec format size in simulcast. |
3855 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3857 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3856 cricket::VideoCodec codec(kVp8Codec270p); | 3858 cricket::VideoCodec codec(kVp8Codec270p); |
3857 codec.width += 1; | 3859 codec.width += 1; |
3858 codec.height += 1; | 3860 codec.height += 1; |
3859 VerifySimulcastSettings(codec, 2, 2); | 3861 VerifySimulcastSettings(codec, 2, 2); |
3860 } | 3862 } |
3861 } // namespace cricket | 3863 } // namespace cricket |
OLD | NEW |