Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_payload_registry_unittest.cc

Issue 1649493004: Support multiple rtx codecs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove some more code. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 TEST_F(RtpPayloadRegistryTest, MultipleRtxPayloadTypes) { 328 TEST_F(RtpPayloadRegistryTest, MultipleRtxPayloadTypes) {
329 // Set the incoming payload type to 90. 329 // Set the incoming payload type to 90.
330 RTPHeader header; 330 RTPHeader header;
331 header.payloadType = 90; 331 header.payloadType = 90;
332 header.ssrc = 1; 332 header.ssrc = 1;
333 rtp_payload_registry_->SetIncomingPayloadType(header); 333 rtp_payload_registry_->SetIncomingPayloadType(header);
334 rtp_payload_registry_->SetRtxSsrc(100); 334 rtp_payload_registry_->SetRtxSsrc(100);
335 // Map two RTX payload types. 335 // Map two RTX payload types.
336 rtp_payload_registry_->SetRtxPayloadType(105, 95); 336 rtp_payload_registry_->SetRtxPayloadType(105, 95);
337 rtp_payload_registry_->SetRtxPayloadType(106, 96); 337 rtp_payload_registry_->SetRtxPayloadType(106, 96);
338 rtp_payload_registry_->set_use_rtx_payload_mapping_on_restore(true);
339
340 TestRtxPacket(rtp_payload_registry_.get(), 105, 95, true);
341 TestRtxPacket(rtp_payload_registry_.get(), 106, 96, true);
342
343 // If the option is off, the map will be ignored.
344 rtp_payload_registry_->set_use_rtx_payload_mapping_on_restore(false);
345 TestRtxPacket(rtp_payload_registry_.get(), 105, 90, true);
346 TestRtxPacket(rtp_payload_registry_.get(), 106, 90, true);
347 }
348
349 // TODO(holmer): Ignored by default for compatibility with misconfigured RTX
350 // streams in Chrome. When that is fixed, remove this.
351 TEST_F(RtpPayloadRegistryTest, IgnoresRtxPayloadTypeMappingByDefault) {
352 // Set the incoming payload type to 90.
353 RTPHeader header;
354 header.payloadType = 90;
355 header.ssrc = 1;
356 rtp_payload_registry_->SetIncomingPayloadType(header);
357 rtp_payload_registry_->SetRtxSsrc(100);
358 // Map two RTX payload types.
359 rtp_payload_registry_->SetRtxPayloadType(105, 95);
360 rtp_payload_registry_->SetRtxPayloadType(106, 96);
361 338
362 TestRtxPacket(rtp_payload_registry_.get(), 105, 90, true);
363 TestRtxPacket(rtp_payload_registry_.get(), 106, 90, true);
364 }
365
366 TEST_F(RtpPayloadRegistryTest, InferLastReceivedPacketIfPayloadTypeUnknown) {
367 rtp_payload_registry_->SetRtxSsrc(100);
368 // Set the incoming payload type to 90.
369 RTPHeader header;
370 header.payloadType = 90;
371 header.ssrc = 1;
372 rtp_payload_registry_->SetIncomingPayloadType(header);
373 rtp_payload_registry_->SetRtxPayloadType(105, 95);
374 rtp_payload_registry_->set_use_rtx_payload_mapping_on_restore(true);
375 // Mapping respected for known type.
376 TestRtxPacket(rtp_payload_registry_.get(), 105, 95, true); 339 TestRtxPacket(rtp_payload_registry_.get(), 105, 95, true);
377 // Mapping ignored for unknown type, even though the option is on. 340 TestRtxPacket(rtp_payload_registry_.get(), 106, 96, true);
378 TestRtxPacket(rtp_payload_registry_.get(), 106, 90, true);
379 } 341 }
380 342
381 TEST_F(RtpPayloadRegistryTest, InvalidRtxConfiguration) { 343 TEST_F(RtpPayloadRegistryTest, InvalidRtxConfiguration) {
382 rtp_payload_registry_->SetRtxSsrc(100); 344 rtp_payload_registry_->SetRtxSsrc(100);
383 // Fails because no mappings exist and the incoming payload type isn't known. 345 // Fails because no mappings exist and the incoming payload type isn't known.
384 TestRtxPacket(rtp_payload_registry_.get(), 105, 0, false); 346 TestRtxPacket(rtp_payload_registry_.get(), 105, 0, false);
385 // Succeeds when the mapping is used, but fails for the implicit fallback. 347 // Succeeds when the mapping is used, but fails for the implicit fallback.
386 rtp_payload_registry_->SetRtxPayloadType(105, 95); 348 rtp_payload_registry_->SetRtxPayloadType(105, 95);
387 rtp_payload_registry_->set_use_rtx_payload_mapping_on_restore(true); 349 rtp_payload_registry_->set_use_rtx_payload_mapping_on_restore(true);
388 TestRtxPacket(rtp_payload_registry_.get(), 105, 95, true); 350 TestRtxPacket(rtp_payload_registry_.get(), 105, 95, true);
389 TestRtxPacket(rtp_payload_registry_.get(), 106, 0, false); 351 TestRtxPacket(rtp_payload_registry_.get(), 106, 0, false);
390 } 352 }
391 353
392 INSTANTIATE_TEST_CASE_P(TestDynamicRange, 354 INSTANTIATE_TEST_CASE_P(TestDynamicRange,
393 RtpPayloadRegistryGenericTest, 355 RtpPayloadRegistryGenericTest,
394 testing::Range(96, 127 + 1)); 356 testing::Range(96, 127 + 1));
395 357
396 } // namespace webrtc 358 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698