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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0); | 50 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0); |
51 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0); | 51 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0); |
52 | 52 |
53 static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30, 0); | 53 static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30, 0); |
54 static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30, 0); | 54 static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30, 0); |
55 static const cricket::VideoCodec kH264Codec(102, "H264", 640, 400, 30, 0); | 55 static const cricket::VideoCodec kH264Codec(102, "H264", 640, 400, 30, 0); |
56 | 56 |
57 static const cricket::VideoCodec kRedCodec(116, "red", 0, 0, 0, 0); | 57 static const cricket::VideoCodec kRedCodec(116, "red", 0, 0, 0, 0); |
58 static const cricket::VideoCodec kUlpfecCodec(117, "ulpfec", 0, 0, 0, 0); | 58 static const cricket::VideoCodec kUlpfecCodec(117, "ulpfec", 0, 0, 0, 0); |
59 | 59 |
| 60 static const uint8_t kRedRtxPayloadType = 125; |
| 61 |
60 static const uint32 kSsrcs1[] = {1}; | 62 static const uint32 kSsrcs1[] = {1}; |
61 static const uint32 kSsrcs3[] = {1, 2, 3}; | 63 static const uint32 kSsrcs3[] = {1, 2, 3}; |
62 static const uint32 kRtxSsrcs1[] = {4}; | 64 static const uint32 kRtxSsrcs1[] = {4}; |
| 65 static const uint32 kIncomingUnsignalledSsrc = 0xC0FFEE; |
63 static const char kUnsupportedExtensionName[] = | 66 static const char kUnsupportedExtensionName[] = |
64 "urn:ietf:params:rtp-hdrext:unsupported"; | 67 "urn:ietf:params:rtp-hdrext:unsupported"; |
65 | 68 |
66 void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec) { | 69 void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec) { |
67 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( | 70 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
68 cricket::kRtcpFbParamNack, cricket::kParamValueEmpty))); | 71 cricket::kRtcpFbParamNack, cricket::kParamValueEmpty))); |
69 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( | 72 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
70 cricket::kRtcpFbParamNack, cricket::kRtcpFbNackParamPli))); | 73 cricket::kRtcpFbParamNack, cricket::kRtcpFbNackParamPli))); |
71 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( | 74 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
72 cricket::kRtcpFbParamRemb, cricket::kParamValueEmpty))); | 75 cricket::kRtcpFbParamRemb, cricket::kParamValueEmpty))); |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 // streams. | 968 // streams. |
966 EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions)); | 969 EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions)); |
967 recv_stream = call->GetVideoReceiveStreams()[0]; | 970 recv_stream = call->GetVideoReceiveStreams()[0]; |
968 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); | 971 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size()); |
969 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id); | 972 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id); |
970 EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name); | 973 EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name); |
971 } | 974 } |
972 | 975 |
973 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare); | 976 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare); |
974 void TestReceiverLocalSsrcConfiguration(bool receiver_first); | 977 void TestReceiverLocalSsrcConfiguration(bool receiver_first); |
| 978 void TestReceiveUnsignalledSsrcPacket(uint8_t payload_type, |
| 979 bool expect_created_receive_stream); |
975 | 980 |
976 FakeVideoSendStream* SetDenoisingOption(bool enabled) { | 981 FakeVideoSendStream* SetDenoisingOption(bool enabled) { |
977 VideoOptions options; | 982 VideoOptions options; |
978 options.video_noise_reduction.Set(enabled); | 983 options.video_noise_reduction.Set(enabled); |
979 channel_->SetOptions(options); | 984 channel_->SetOptions(options); |
980 return fake_call_->GetVideoSendStreams().back(); | 985 return fake_call_->GetVideoSendStreams().back(); |
981 } | 986 } |
982 | 987 |
983 FakeVideoSendStream* SetUpSimulcast(bool enabled) { | 988 FakeVideoSendStream* SetUpSimulcast(bool enabled) { |
984 last_ssrc_ += 3; | 989 last_ssrc_ += 3; |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2574 ASSERT_TRUE(channel_->GetStats(&info)); | 2579 ASSERT_TRUE(channel_->GetStats(&info)); |
2575 | 2580 |
2576 ASSERT_EQ(1u, info.senders.size()); | 2581 ASSERT_EQ(1u, info.senders.size()); |
2577 ASSERT_EQ(1u, info.receivers.size()); | 2582 ASSERT_EQ(1u, info.receivers.size()); |
2578 | 2583 |
2579 EXPECT_NE(sender_sp.ssrc_groups, receiver_sp.ssrc_groups); | 2584 EXPECT_NE(sender_sp.ssrc_groups, receiver_sp.ssrc_groups); |
2580 EXPECT_EQ(sender_sp.ssrc_groups, info.senders[0].ssrc_groups); | 2585 EXPECT_EQ(sender_sp.ssrc_groups, info.senders[0].ssrc_groups); |
2581 EXPECT_EQ(receiver_sp.ssrc_groups, info.receivers[0].ssrc_groups); | 2586 EXPECT_EQ(receiver_sp.ssrc_groups, info.receivers[0].ssrc_groups); |
2582 } | 2587 } |
2583 | 2588 |
| 2589 void WebRtcVideoChannel2Test::TestReceiveUnsignalledSsrcPacket( |
| 2590 uint8_t payload_type, |
| 2591 bool expect_created_receive_stream) { |
| 2592 std::vector<VideoCodec> codecs(engine_.codecs()); |
| 2593 // Add a RED RTX codec. |
| 2594 VideoCodec red_rtx_codec = |
| 2595 VideoCodec::CreateRtxCodec(kRedRtxPayloadType, kDefaultRedPlType); |
| 2596 codecs.push_back(red_rtx_codec); |
| 2597 EXPECT_TRUE(channel_->SetRecvCodecs(codecs)); |
| 2598 |
| 2599 ASSERT_EQ(0u, fake_call_->GetVideoReceiveStreams().size()); |
| 2600 const size_t kDataLength = 12; |
| 2601 uint8_t data[kDataLength]; |
| 2602 memset(data, 0, sizeof(data)); |
| 2603 |
| 2604 rtc::Set8(data, 1, payload_type); |
| 2605 rtc::SetBE32(&data[8], kIncomingUnsignalledSsrc); |
| 2606 rtc::Buffer packet(data, kDataLength); |
| 2607 rtc::PacketTime packet_time; |
| 2608 channel_->OnPacketReceived(&packet, packet_time); |
| 2609 |
| 2610 if (expect_created_receive_stream) { |
| 2611 EXPECT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()) |
| 2612 << "Should have created a receive stream for payload type: " |
| 2613 << payload_type; |
| 2614 } else { |
| 2615 EXPECT_EQ(0u, fake_call_->GetVideoReceiveStreams().size()) |
| 2616 << "Shouldn't have created a receive stream for payload type: " |
| 2617 << payload_type; |
| 2618 } |
| 2619 } |
| 2620 |
| 2621 TEST_F(WebRtcVideoChannel2Test, Vp8PacketCreatesUnsignalledStream) { |
| 2622 TestReceiveUnsignalledSsrcPacket(kDefaultVp8PlType, true); |
| 2623 } |
| 2624 |
| 2625 TEST_F(WebRtcVideoChannel2Test, Vp9PacketCreatesUnsignalledStream) { |
| 2626 TestReceiveUnsignalledSsrcPacket(kDefaultVp9PlType, true); |
| 2627 } |
| 2628 |
| 2629 TEST_F(WebRtcVideoChannel2Test, RtxPacketDoesntCreateUnsignalledStream) { |
| 2630 TestReceiveUnsignalledSsrcPacket(kDefaultRtxVp8PlType, false); |
| 2631 } |
| 2632 |
| 2633 TEST_F(WebRtcVideoChannel2Test, UlpfecPacketDoesntCreateUnsignalledStream) { |
| 2634 TestReceiveUnsignalledSsrcPacket(kDefaultUlpfecType, false); |
| 2635 } |
| 2636 |
| 2637 TEST_F(WebRtcVideoChannel2Test, RedRtxPacketDoesntCreateUnsignalledStream) { |
| 2638 TestReceiveUnsignalledSsrcPacket(kRedRtxPayloadType, false); |
| 2639 } |
| 2640 |
2584 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration( | 2641 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration( |
2585 bool receiver_first) { | 2642 bool receiver_first) { |
2586 EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); | 2643 EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
2587 | 2644 |
2588 const uint32_t kSenderSsrc = 0xC0FFEE; | 2645 const uint32_t kSenderSsrc = 0xC0FFEE; |
2589 const uint32_t kReceiverSsrc = 0x4711; | 2646 const uint32_t kReceiverSsrc = 0x4711; |
2590 | 2647 |
2591 if (receiver_first) { | 2648 if (receiver_first) { |
2592 AddRecvStream(StreamParams::CreateLegacy(kReceiverSsrc)); | 2649 AddRecvStream(StreamParams::CreateLegacy(kReceiverSsrc)); |
2593 std::vector<FakeVideoReceiveStream*> receive_streams = | 2650 std::vector<FakeVideoReceiveStream*> receive_streams = |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 // Ensures that the correct settings are applied to the codec when two temporal | 3081 // Ensures that the correct settings are applied to the codec when two temporal |
3025 // layer screencasting is enabled, and that the correct simulcast settings are | 3082 // layer screencasting is enabled, and that the correct simulcast settings are |
3026 // reapplied when disabling screencasting. | 3083 // reapplied when disabling screencasting. |
3027 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3084 TEST_F(WebRtcVideoChannel2SimulcastTest, |
3028 DISABLED_TwoTemporalLayerScreencastSettings) { | 3085 DISABLED_TwoTemporalLayerScreencastSettings) { |
3029 // TODO(pbos): Implement. | 3086 // TODO(pbos): Implement. |
3030 FAIL() << "Not implemented."; | 3087 FAIL() << "Not implemented."; |
3031 } | 3088 } |
3032 | 3089 |
3033 } // namespace cricket | 3090 } // namespace cricket |
OLD | NEW |