OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 config.protected_media_ssrcs = {}; | 47 config.protected_media_ssrcs = {}; |
48 MockRecoveredPacketReceiver callback; | 48 MockRecoveredPacketReceiver callback; |
49 internal::FlexfecReceiveStream receive_stream(config, &callback); | 49 internal::FlexfecReceiveStream receive_stream(config, &callback); |
50 const uint8_t packet[] = {0x00, 0x11, 0x22, 0x33}; | 50 const uint8_t packet[] = {0x00, 0x11, 0x22, 0x33}; |
51 const size_t packet_length = sizeof(packet); | 51 const size_t packet_length = sizeof(packet); |
52 | 52 |
53 EXPECT_FALSE( | 53 EXPECT_FALSE( |
54 receive_stream.AddAndProcessReceivedPacket(packet, packet_length)); | 54 receive_stream.AddAndProcessReceivedPacket(packet, packet_length)); |
55 } | 55 } |
56 | 56 |
57 // TODO(brandtr): Remove when we support multistream protection. | |
58 TEST(FlexfecReceiveStreamTest, CannotProtectMultipleMediaStreams) { | |
59 FlexfecReceiveStream::Config config; | |
60 config.flexfec_payload_type = 118; | |
61 config.flexfec_ssrc = 424223; | |
62 config.protected_media_ssrcs = {123, 456}; | |
63 MockRecoveredPacketReceiver callback; | |
64 internal::FlexfecReceiveStream receive_stream(config, &callback); | |
65 | |
66 ASSERT_EQ(1U, receive_stream.config().protected_media_ssrcs.size()); | |
67 EXPECT_EQ(config.protected_media_ssrcs[0], | |
68 receive_stream.config().protected_media_ssrcs[0]); | |
69 } | |
70 | |
71 // Create a FlexFEC packet that protects a single media packet and ensure | 57 // Create a FlexFEC packet that protects a single media packet and ensure |
72 // that the callback is called. Correctness of recovery is checked in the | 58 // that the callback is called. Correctness of recovery is checked in the |
73 // FlexfecReceiver unit tests. | 59 // FlexfecReceiver unit tests. |
74 TEST(FlexfecReceiveStreamTest, RecoversPacketWhenStarted) { | 60 TEST(FlexfecReceiveStreamTest, RecoversPacketWhenStarted) { |
75 constexpr uint8_t kFlexfecPlType = 118; | 61 constexpr uint8_t kFlexfecPlType = 118; |
76 constexpr uint8_t kFlexfecSeqNum[] = {0x00, 0x01}; | 62 constexpr uint8_t kFlexfecSeqNum[] = {0x00, 0x01}; |
77 constexpr uint8_t kFlexfecTs[] = {0x00, 0x11, 0x22, 0x33}; | 63 constexpr uint8_t kFlexfecTs[] = {0x00, 0x11, 0x22, 0x33}; |
78 constexpr uint8_t kFlexfecSsrc[] = {0x00, 0x00, 0x00, 0x01}; | 64 constexpr uint8_t kFlexfecSsrc[] = {0x00, 0x00, 0x00, 0x01}; |
79 constexpr uint8_t kMediaPlType = 107; | 65 constexpr uint8_t kMediaPlType = 107; |
80 constexpr uint8_t kMediaSeqNum[] = {0x00, 0x02}; | 66 constexpr uint8_t kMediaSeqNum[] = {0x00, 0x02}; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Call back after being started. | 109 // Call back after being started. |
124 receive_stream.Start(); | 110 receive_stream.Start(); |
125 EXPECT_CALL( | 111 EXPECT_CALL( |
126 recovered_packet_receiver, | 112 recovered_packet_receiver, |
127 OnRecoveredPacket(::testing::_, kRtpHeaderSize + kPayloadLength[1])); | 113 OnRecoveredPacket(::testing::_, kRtpHeaderSize + kPayloadLength[1])); |
128 receive_stream.AddAndProcessReceivedPacket(kFlexfecPacket, | 114 receive_stream.AddAndProcessReceivedPacket(kFlexfecPacket, |
129 kFlexfecPacketLength); | 115 kFlexfecPacketLength); |
130 } | 116 } |
131 | 117 |
132 } // namespace webrtc | 118 } // namespace webrtc |
OLD | NEW |