Disable PT based demuxing if MID header extension is present.

We want to turn off PT based demux because SSRC-based endpoints that
send media prematurely (which is a popular non-standard behavior still
heavily in use) can otherwise get incorrect mappings and unsignalled
ssrc issues because of the PT demux path.

This CL disables PT based demuxing when the MID header extension is
present on all m= sections in the SDP for that kind (audio/video), not
caring if it was in the offer or answer. However if PT demuxing has been
used in the past then it is always allowed. This ensures PT is off by
default but that either offer or answer can enable PT and once it has
been on it is also possible to get early media with PT.

- Want PT-based demux? The MID header extension has to be removed in
  either the offer or the answer. Follow-up O/As allow PT demuxing if
  possible.
- Want to use MID or SSRC demuxing? Great, you don't need PT-based demux
  and won't mind that we turned it off for you.

The reason for disabling PT demux at offer time (if MID is present)
instead of waiting for the SDP answer is because by the time the SDP
answer arrives, early media could have triggered PT demux and caused
incorrect mappings. The safe thing is to assume a spec-compliant
endpoint until proven otherwise.

However if PT demux is ever enabled, then from that point on we always
allow PT-based demux in follow-up O/A exchanges. This ensures we don't
drop packets in follow-up exchanges. The fact that PT-based demux is
disabled during the initial offer should not matter because before the
initial O/A exchange we don't have fingerprints.

This change only affects Unified Plan and bundled groups. Existing test
coverage ensuring we do not break legacy endpoints:
[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/pc/peer_connection_integrationtest.cc;l=1156
[2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/webrtc/protocol/rtp-demuxing.html;l=59

UnsignaledStreamTest is also updated to test the interesting setups.
A kill-switch is added in case we want to disable this change.

Bug: webrtc:12814
Change-Id: I807a82a543325753633aaef698e06cb4c9dfebaa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221101
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34251}
3 files changed
tree: 7a9d7700cae55dae75e3dc5a1345d642ce28307b
  1. api/
  2. audio/
  3. build_overrides/
  4. call/
  5. common_audio/
  6. common_video/
  7. data/
  8. docs/
  9. examples/
  10. g3doc/
  11. logging/
  12. media/
  13. modules/
  14. net/
  15. p2p/
  16. pc/
  17. resources/
  18. rtc_base/
  19. rtc_tools/
  20. sdk/
  21. stats/
  22. system_wrappers/
  23. test/
  24. tools_webrtc/
  25. video/
  26. .clang-format
  27. .git-blame-ignore-revs
  28. .gitignore
  29. .gn
  30. .vpython
  31. AUTHORS
  32. BUILD.gn
  33. CODE_OF_CONDUCT.md
  34. codereview.settings
  35. DEPS
  36. DIR_METADATA
  37. ENG_REVIEW_OWNERS
  38. g3doc.lua
  39. LICENSE
  40. license_template.txt
  41. native-api.md
  42. OWNERS
  43. PATENTS
  44. PRESUBMIT.py
  45. presubmit_test.py
  46. presubmit_test_mocks.py
  47. pylintrc
  48. README.chromium
  49. README.md
  50. WATCHLISTS
  51. webrtc.gni
  52. webrtc_lib_link_test.cc
  53. whitespace.txt
README.md

WebRTC is a free, open software project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.

Our mission: To enable rich, high-quality RTC applications to be developed for the browser, mobile platforms, and IoT devices, and allow them all to communicate via a common set of protocols.

The WebRTC initiative is a project supported by Google, Mozilla and Opera, amongst others.

Development

See here for instructions on how to get started developing with the native code.

Authoritative list of directories that contain the native API header files.

More info