OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 "name", | 45 "name", |
46 audio, | 46 audio, |
47 {// Initialize the audio struct in this case. | 47 {// Initialize the audio struct in this case. |
48 {kTypicalFrequency, kTypicalChannels, rate}}}; | 48 {kTypicalFrequency, kTypicalChannels, rate}}}; |
49 | 49 |
50 // Note: we return a new payload since the payload registry takes ownership | 50 // Note: we return a new payload since the payload registry takes ownership |
51 // of the created object. | 51 // of the created object. |
52 RtpUtility::Payload* returned_payload_on_heap = | 52 RtpUtility::Payload* returned_payload_on_heap = |
53 new RtpUtility::Payload(returned_payload); | 53 new RtpUtility::Payload(returned_payload); |
54 EXPECT_CALL(*mock_payload_strategy_, | 54 EXPECT_CALL(*mock_payload_strategy_, |
55 CreatePayloadType(kTypicalPayloadName, payload_type, | 55 CreatePayloadType(kTypicalPayloadName, payload_type, |
56 kTypicalFrequency, | 56 kTypicalFrequency, kTypicalChannels, rate)) |
57 kTypicalChannels, | 57 .WillOnce(Return(returned_payload_on_heap)); |
58 rate)).WillOnce(Return(returned_payload_on_heap)); | |
59 return returned_payload_on_heap; | 58 return returned_payload_on_heap; |
60 } | 59 } |
61 | 60 |
62 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; | 61 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; |
63 testing::NiceMock<MockRTPPayloadStrategy>* mock_payload_strategy_; | 62 testing::NiceMock<MockRTPPayloadStrategy>* mock_payload_strategy_; |
64 }; | 63 }; |
65 | 64 |
66 TEST_F(RtpPayloadRegistryTest, RegistersAndRemembersPayloadsUntilDeregistered) { | 65 TEST_F(RtpPayloadRegistryTest, RegistersAndRemembersPayloadsUntilDeregistered) { |
67 uint8_t payload_type = 97; | 66 uint8_t payload_type = 97; |
68 RtpUtility::Payload* returned_payload_on_heap = | 67 RtpUtility::Payload* returned_payload_on_heap = |
69 ExpectReturnOfTypicalAudioPayload(payload_type, kTypicalRate); | 68 ExpectReturnOfTypicalAudioPayload(payload_type, kTypicalRate); |
70 | 69 |
71 bool new_payload_created = false; | 70 bool new_payload_created = false; |
72 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 71 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
73 kTypicalPayloadName, payload_type, kTypicalFrequency, kTypicalChannels, | 72 kTypicalPayloadName, payload_type, kTypicalFrequency, |
74 kTypicalRate, &new_payload_created)); | 73 kTypicalChannels, kTypicalRate, &new_payload_created)); |
75 | 74 |
76 EXPECT_TRUE(new_payload_created) << "A new payload WAS created."; | 75 EXPECT_TRUE(new_payload_created) << "A new payload WAS created."; |
77 | 76 |
78 RtpUtility::Payload* retrieved_payload = NULL; | 77 RtpUtility::Payload* retrieved_payload = NULL; |
79 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type, | 78 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type, |
80 retrieved_payload)); | 79 retrieved_payload)); |
81 | 80 |
82 // We should get back the exact pointer to the payload returned by the | 81 // We should get back the exact pointer to the payload returned by the |
83 // payload strategy. | 82 // payload strategy. |
84 EXPECT_EQ(returned_payload_on_heap, retrieved_payload); | 83 EXPECT_EQ(returned_payload_on_heap, retrieved_payload); |
85 | 84 |
86 // Now forget about it and verify it's gone. | 85 // Now forget about it and verify it's gone. |
87 EXPECT_EQ(0, rtp_payload_registry_->DeRegisterReceivePayload(payload_type)); | 86 EXPECT_EQ(0, rtp_payload_registry_->DeRegisterReceivePayload(payload_type)); |
88 EXPECT_FALSE(rtp_payload_registry_->PayloadTypeToPayload( | 87 EXPECT_FALSE(rtp_payload_registry_->PayloadTypeToPayload(payload_type, |
89 payload_type, retrieved_payload)); | 88 retrieved_payload)); |
90 } | 89 } |
91 | 90 |
92 TEST_F(RtpPayloadRegistryTest, AudioRedWorkProperly) { | 91 TEST_F(RtpPayloadRegistryTest, AudioRedWorkProperly) { |
93 const uint8_t kRedPayloadType = 127; | 92 const uint8_t kRedPayloadType = 127; |
94 const int kRedSampleRate = 8000; | 93 const int kRedSampleRate = 8000; |
95 const int kRedChannels = 1; | 94 const int kRedChannels = 1; |
96 const int kRedBitRate = 0; | 95 const int kRedBitRate = 0; |
97 | 96 |
98 // This creates an audio RTP payload strategy. | 97 // This creates an audio RTP payload strategy. |
99 rtp_payload_registry_.reset(new RTPPayloadRegistry( | 98 rtp_payload_registry_.reset( |
100 RTPPayloadStrategy::CreateStrategy(true))); | 99 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))); |
101 | 100 |
102 bool new_payload_created = false; | 101 bool new_payload_created = false; |
103 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 102 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
104 "red", kRedPayloadType, kRedSampleRate, kRedChannels, kRedBitRate, | 103 "red", kRedPayloadType, kRedSampleRate, kRedChannels, |
105 &new_payload_created)); | 104 kRedBitRate, &new_payload_created)); |
106 EXPECT_TRUE(new_payload_created); | 105 EXPECT_TRUE(new_payload_created); |
107 | 106 |
108 EXPECT_EQ(kRedPayloadType, rtp_payload_registry_->red_payload_type()); | 107 EXPECT_EQ(kRedPayloadType, rtp_payload_registry_->red_payload_type()); |
109 | 108 |
110 RtpUtility::Payload* retrieved_payload = NULL; | 109 RtpUtility::Payload* retrieved_payload = NULL; |
111 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(kRedPayloadType, | 110 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(kRedPayloadType, |
112 retrieved_payload)); | 111 retrieved_payload)); |
113 ASSERT_TRUE(retrieved_payload); | 112 ASSERT_TRUE(retrieved_payload); |
114 EXPECT_TRUE(retrieved_payload->audio); | 113 EXPECT_TRUE(retrieved_payload->audio); |
115 EXPECT_STRCASEEQ("red", retrieved_payload->name); | 114 EXPECT_STRCASEEQ("red", retrieved_payload->name); |
116 | 115 |
117 // Sample rate is correctly registered. | 116 // Sample rate is correctly registered. |
118 EXPECT_EQ(kRedSampleRate, | 117 EXPECT_EQ(kRedSampleRate, |
119 rtp_payload_registry_->GetPayloadTypeFrequency(kRedPayloadType)); | 118 rtp_payload_registry_->GetPayloadTypeFrequency(kRedPayloadType)); |
120 } | 119 } |
121 | 120 |
122 TEST_F(RtpPayloadRegistryTest, | 121 TEST_F(RtpPayloadRegistryTest, |
123 DoesNotAcceptSamePayloadTypeTwiceExceptIfPayloadIsCompatible) { | 122 DoesNotAcceptSamePayloadTypeTwiceExceptIfPayloadIsCompatible) { |
124 uint8_t payload_type = 97; | 123 uint8_t payload_type = 97; |
125 | 124 |
126 bool ignored = false; | 125 bool ignored = false; |
127 RtpUtility::Payload* first_payload_on_heap = | 126 RtpUtility::Payload* first_payload_on_heap = |
128 ExpectReturnOfTypicalAudioPayload(payload_type, kTypicalRate); | 127 ExpectReturnOfTypicalAudioPayload(payload_type, kTypicalRate); |
129 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 128 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
130 kTypicalPayloadName, payload_type, kTypicalFrequency, kTypicalChannels, | 129 kTypicalPayloadName, payload_type, kTypicalFrequency, |
131 kTypicalRate, &ignored)); | 130 kTypicalChannels, kTypicalRate, &ignored)); |
132 | 131 |
133 EXPECT_EQ(-1, rtp_payload_registry_->RegisterReceivePayload( | 132 EXPECT_EQ(-1, rtp_payload_registry_->RegisterReceivePayload( |
134 kTypicalPayloadName, payload_type, kTypicalFrequency, kTypicalChannels, | 133 kTypicalPayloadName, payload_type, kTypicalFrequency, |
135 kTypicalRate, &ignored)) << "Adding same codec twice = bad."; | 134 kTypicalChannels, kTypicalRate, &ignored)) |
| 135 << "Adding same codec twice = bad."; |
136 | 136 |
137 RtpUtility::Payload* second_payload_on_heap = | 137 RtpUtility::Payload* second_payload_on_heap = |
138 ExpectReturnOfTypicalAudioPayload(payload_type - 1, kTypicalRate); | 138 ExpectReturnOfTypicalAudioPayload(payload_type - 1, kTypicalRate); |
139 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 139 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
140 kTypicalPayloadName, payload_type - 1, kTypicalFrequency, | 140 kTypicalPayloadName, payload_type - 1, kTypicalFrequency, |
141 kTypicalChannels, kTypicalRate, &ignored)) << | 141 kTypicalChannels, kTypicalRate, &ignored)) |
142 "With a different payload type is fine though."; | 142 << "With a different payload type is fine though."; |
143 | 143 |
144 // Ensure both payloads are preserved. | 144 // Ensure both payloads are preserved. |
145 RtpUtility::Payload* retrieved_payload = NULL; | 145 RtpUtility::Payload* retrieved_payload = NULL; |
146 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type, | 146 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type, |
147 retrieved_payload)); | 147 retrieved_payload)); |
148 EXPECT_EQ(first_payload_on_heap, retrieved_payload); | 148 EXPECT_EQ(first_payload_on_heap, retrieved_payload); |
149 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1, | 149 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1, |
150 retrieved_payload)); | 150 retrieved_payload)); |
151 EXPECT_EQ(second_payload_on_heap, retrieved_payload); | 151 EXPECT_EQ(second_payload_on_heap, retrieved_payload); |
152 | 152 |
153 // Ok, update the rate for one of the codecs. If either the incoming rate or | 153 // Ok, update the rate for one of the codecs. If either the incoming rate or |
154 // the stored rate is zero it's not really an error to register the same | 154 // the stored rate is zero it's not really an error to register the same |
155 // codec twice, and in that case roughly the following happens. | 155 // codec twice, and in that case roughly the following happens. |
156 ON_CALL(*mock_payload_strategy_, PayloadIsCompatible(_, _, _, _)) | 156 ON_CALL(*mock_payload_strategy_, PayloadIsCompatible(_, _, _, _)) |
157 .WillByDefault(Return(true)); | 157 .WillByDefault(Return(true)); |
158 EXPECT_CALL(*mock_payload_strategy_, | 158 EXPECT_CALL(*mock_payload_strategy_, |
159 UpdatePayloadRate(first_payload_on_heap, kTypicalRate)); | 159 UpdatePayloadRate(first_payload_on_heap, kTypicalRate)); |
160 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 160 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
161 kTypicalPayloadName, payload_type, kTypicalFrequency, kTypicalChannels, | 161 kTypicalPayloadName, payload_type, kTypicalFrequency, |
162 kTypicalRate, &ignored)); | 162 kTypicalChannels, kTypicalRate, &ignored)); |
163 } | 163 } |
164 | 164 |
165 TEST_F(RtpPayloadRegistryTest, | 165 TEST_F(RtpPayloadRegistryTest, |
166 RemovesCompatibleCodecsOnRegistryIfCodecsMustBeUnique) { | 166 RemovesCompatibleCodecsOnRegistryIfCodecsMustBeUnique) { |
167 ON_CALL(*mock_payload_strategy_, PayloadIsCompatible(_, _, _, _)) | 167 ON_CALL(*mock_payload_strategy_, PayloadIsCompatible(_, _, _, _)) |
168 .WillByDefault(Return(true)); | 168 .WillByDefault(Return(true)); |
169 ON_CALL(*mock_payload_strategy_, CodecsMustBeUnique()) | 169 ON_CALL(*mock_payload_strategy_, CodecsMustBeUnique()) |
170 .WillByDefault(Return(true)); | 170 .WillByDefault(Return(true)); |
171 | 171 |
172 uint8_t payload_type = 97; | 172 uint8_t payload_type = 97; |
173 | 173 |
174 bool ignored = false; | 174 bool ignored = false; |
175 ExpectReturnOfTypicalAudioPayload(payload_type, kTypicalRate); | 175 ExpectReturnOfTypicalAudioPayload(payload_type, kTypicalRate); |
176 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 176 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
177 kTypicalPayloadName, payload_type, kTypicalFrequency, kTypicalChannels, | 177 kTypicalPayloadName, payload_type, kTypicalFrequency, |
178 kTypicalRate, &ignored)); | 178 kTypicalChannels, kTypicalRate, &ignored)); |
179 ExpectReturnOfTypicalAudioPayload(payload_type - 1, kTypicalRate); | 179 ExpectReturnOfTypicalAudioPayload(payload_type - 1, kTypicalRate); |
180 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 180 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
181 kTypicalPayloadName, payload_type - 1, kTypicalFrequency, | 181 kTypicalPayloadName, payload_type - 1, kTypicalFrequency, |
182 kTypicalChannels, kTypicalRate, &ignored)); | 182 kTypicalChannels, kTypicalRate, &ignored)); |
183 | 183 |
184 RtpUtility::Payload* retrieved_payload = NULL; | 184 RtpUtility::Payload* retrieved_payload = NULL; |
185 EXPECT_FALSE(rtp_payload_registry_->PayloadTypeToPayload( | 185 EXPECT_FALSE(rtp_payload_registry_->PayloadTypeToPayload(payload_type, |
186 payload_type, retrieved_payload)) << "The first payload should be " | 186 retrieved_payload)) |
187 "deregistered because the only thing that differs is payload type."; | 187 << "The first payload should be " |
188 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload( | 188 "deregistered because the only thing that differs is payload type."; |
189 payload_type - 1, retrieved_payload)) << | 189 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1, |
190 "The second payload should still be registered though."; | 190 retrieved_payload)) |
| 191 << "The second payload should still be registered though."; |
191 | 192 |
192 // Now ensure non-compatible codecs aren't removed. | 193 // Now ensure non-compatible codecs aren't removed. |
193 ON_CALL(*mock_payload_strategy_, PayloadIsCompatible(_, _, _, _)) | 194 ON_CALL(*mock_payload_strategy_, PayloadIsCompatible(_, _, _, _)) |
194 .WillByDefault(Return(false)); | 195 .WillByDefault(Return(false)); |
195 ExpectReturnOfTypicalAudioPayload(payload_type + 1, kTypicalRate); | 196 ExpectReturnOfTypicalAudioPayload(payload_type + 1, kTypicalRate); |
196 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 197 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
197 kTypicalPayloadName, payload_type + 1, kTypicalFrequency, | 198 kTypicalPayloadName, payload_type + 1, kTypicalFrequency, |
198 kTypicalChannels, kTypicalRate, &ignored)); | 199 kTypicalChannels, kTypicalRate, &ignored)); |
199 | 200 |
200 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload( | 201 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1, |
201 payload_type - 1, retrieved_payload)) << | 202 retrieved_payload)) |
202 "Not compatible; both payloads should be kept."; | 203 << "Not compatible; both payloads should be kept."; |
203 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload( | 204 EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type + 1, |
204 payload_type + 1, retrieved_payload)) << | 205 retrieved_payload)) |
205 "Not compatible; both payloads should be kept."; | 206 << "Not compatible; both payloads should be kept."; |
206 } | 207 } |
207 | 208 |
208 TEST_F(RtpPayloadRegistryTest, | 209 TEST_F(RtpPayloadRegistryTest, |
209 LastReceivedCodecTypesAreResetWhenRegisteringNewPayloadTypes) { | 210 LastReceivedCodecTypesAreResetWhenRegisteringNewPayloadTypes) { |
210 rtp_payload_registry_->set_last_received_payload_type(17); | 211 rtp_payload_registry_->set_last_received_payload_type(17); |
211 EXPECT_EQ(17, rtp_payload_registry_->last_received_payload_type()); | 212 EXPECT_EQ(17, rtp_payload_registry_->last_received_payload_type()); |
212 | 213 |
213 bool media_type_unchanged = rtp_payload_registry_->ReportMediaPayloadType(18); | 214 bool media_type_unchanged = rtp_payload_registry_->ReportMediaPayloadType(18); |
214 EXPECT_FALSE(media_type_unchanged); | 215 EXPECT_FALSE(media_type_unchanged); |
215 media_type_unchanged = rtp_payload_registry_->ReportMediaPayloadType(18); | 216 media_type_unchanged = rtp_payload_registry_->ReportMediaPayloadType(18); |
216 EXPECT_TRUE(media_type_unchanged); | 217 EXPECT_TRUE(media_type_unchanged); |
217 | 218 |
218 bool ignored; | 219 bool ignored; |
219 ExpectReturnOfTypicalAudioPayload(34, kTypicalRate); | 220 ExpectReturnOfTypicalAudioPayload(34, kTypicalRate); |
220 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( | 221 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
221 kTypicalPayloadName, 34, kTypicalFrequency, kTypicalChannels, | 222 kTypicalPayloadName, 34, kTypicalFrequency, kTypicalChannels, |
222 kTypicalRate, &ignored)); | 223 kTypicalRate, &ignored)); |
223 | 224 |
224 EXPECT_EQ(-1, rtp_payload_registry_->last_received_payload_type()); | 225 EXPECT_EQ(-1, rtp_payload_registry_->last_received_payload_type()); |
225 media_type_unchanged = rtp_payload_registry_->ReportMediaPayloadType(18); | 226 media_type_unchanged = rtp_payload_registry_->ReportMediaPayloadType(18); |
226 EXPECT_FALSE(media_type_unchanged); | 227 EXPECT_FALSE(media_type_unchanged); |
227 } | 228 } |
228 | 229 |
229 class ParameterizedRtpPayloadRegistryTest : | 230 class ParameterizedRtpPayloadRegistryTest |
230 public RtpPayloadRegistryTest, | 231 : public RtpPayloadRegistryTest, |
231 public ::testing::WithParamInterface<int> { | 232 public ::testing::WithParamInterface<int> {}; |
232 }; | |
233 | 233 |
234 TEST_P(ParameterizedRtpPayloadRegistryTest, | 234 TEST_P(ParameterizedRtpPayloadRegistryTest, |
235 FailsToRegisterKnownPayloadsWeAreNotInterestedIn) { | 235 FailsToRegisterKnownPayloadsWeAreNotInterestedIn) { |
236 int payload_type = GetParam(); | 236 int payload_type = GetParam(); |
237 | 237 |
238 bool ignored; | 238 bool ignored; |
239 EXPECT_EQ(-1, rtp_payload_registry_->RegisterReceivePayload( | 239 EXPECT_EQ(-1, rtp_payload_registry_->RegisterReceivePayload( |
240 "whatever", static_cast<uint8_t>(payload_type), 19, 1, 17, &ignored)); | 240 "whatever", static_cast<uint8_t>(payload_type), 19, 1, 17, |
| 241 &ignored)); |
241 } | 242 } |
242 | 243 |
243 INSTANTIATE_TEST_CASE_P(TestKnownBadPayloadTypes, | 244 INSTANTIATE_TEST_CASE_P(TestKnownBadPayloadTypes, |
244 ParameterizedRtpPayloadRegistryTest, | 245 ParameterizedRtpPayloadRegistryTest, |
245 testing::Values(64, 72, 73, 74, 75, 76, 77, 78, 79)); | 246 testing::Values(64, 72, 73, 74, 75, 76, 77, 78, 79)); |
246 | 247 |
247 class RtpPayloadRegistryGenericTest : | 248 class RtpPayloadRegistryGenericTest |
248 public RtpPayloadRegistryTest, | 249 : public RtpPayloadRegistryTest, |
249 public ::testing::WithParamInterface<int> { | 250 public ::testing::WithParamInterface<int> {}; |
250 }; | |
251 | 251 |
252 TEST_P(RtpPayloadRegistryGenericTest, RegisterGenericReceivePayloadType) { | 252 TEST_P(RtpPayloadRegistryGenericTest, RegisterGenericReceivePayloadType) { |
253 int payload_type = GetParam(); | 253 int payload_type = GetParam(); |
254 | 254 |
255 bool ignored; | 255 bool ignored; |
256 | 256 |
257 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload("generic-codec", | 257 EXPECT_EQ(0, rtp_payload_registry_->RegisterReceivePayload( |
258 static_cast<int8_t>(payload_type), | 258 "generic-codec", static_cast<int8_t>(payload_type), 19, 1, |
259 19, 1, 17, &ignored)); // dummy values, except for payload_type | 259 17, &ignored)); // dummy values, except for payload_type |
260 } | 260 } |
261 | 261 |
262 // Generates an RTX packet for the given length and original sequence number. | 262 // Generates an RTX packet for the given length and original sequence number. |
263 // The RTX sequence number and ssrc will use the default value of 9999. The | 263 // The RTX sequence number and ssrc will use the default value of 9999. The |
264 // caller takes ownership of the returned buffer. | 264 // caller takes ownership of the returned buffer. |
265 const uint8_t* GenerateRtxPacket(size_t header_length, | 265 const uint8_t* GenerateRtxPacket(size_t header_length, |
266 size_t payload_length, | 266 size_t payload_length, |
267 uint16_t original_sequence_number) { | 267 uint16_t original_sequence_number) { |
268 uint8_t* packet = | 268 uint8_t* packet = |
269 new uint8_t[kRtxHeaderSize + header_length + payload_length](); | 269 new uint8_t[kRtxHeaderSize + header_length + payload_length](); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 rtp_payload_registry_->SetRtxSsrc(100); | 388 rtp_payload_registry_->SetRtxSsrc(100); |
389 // Fails because no mappings exist and the incoming payload type isn't known. | 389 // Fails because no mappings exist and the incoming payload type isn't known. |
390 TestRtxPacket(rtp_payload_registry_.get(), 105, 0, false); | 390 TestRtxPacket(rtp_payload_registry_.get(), 105, 0, false); |
391 // Succeeds when the mapping is used, but fails for the implicit fallback. | 391 // Succeeds when the mapping is used, but fails for the implicit fallback. |
392 rtp_payload_registry_->SetRtxPayloadType(105, 95); | 392 rtp_payload_registry_->SetRtxPayloadType(105, 95); |
393 rtp_payload_registry_->set_use_rtx_payload_mapping_on_restore(true); | 393 rtp_payload_registry_->set_use_rtx_payload_mapping_on_restore(true); |
394 TestRtxPacket(rtp_payload_registry_.get(), 105, 95, true); | 394 TestRtxPacket(rtp_payload_registry_.get(), 105, 95, true); |
395 TestRtxPacket(rtp_payload_registry_.get(), 106, 0, false); | 395 TestRtxPacket(rtp_payload_registry_.get(), 106, 0, false); |
396 } | 396 } |
397 | 397 |
398 INSTANTIATE_TEST_CASE_P(TestDynamicRange, RtpPayloadRegistryGenericTest, | 398 INSTANTIATE_TEST_CASE_P(TestDynamicRange, |
399 testing::Range(96, 127+1)); | 399 RtpPayloadRegistryGenericTest, |
| 400 testing::Range(96, 127 + 1)); |
400 | 401 |
401 } // namespace webrtc | 402 } // namespace webrtc |
OLD | NEW |