2940 Commits

Author SHA1 Message Date
Jeremy Leconte
e90ab59b7c Revert "Move resources to resources/BUILD.gn."
This reverts commit 7dea26d8bb0fbb2f6fe25e74d2baac9293e413a8.

Reason for revert: breaks downstream

Original change's description:
> Move resources to resources/BUILD.gn.
>
> iOS bundle all resources in the same folder and some conflicts can arise from that.
> Having all resources in the same file makes it easier to reason about it.
>
> Change-Id: I37f420dfbd265ec644804e9d4c96515c83d2a992
> Bug: b/397385850
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377821
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43944}

Bug: b/397385850
Change-Id: I80788590498fc24709c95a6a9580fdad65860f8c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378280
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43947}
2025-02-21 00:01:13 -08:00
Jeremy Leconte
7dea26d8bb Move resources to resources/BUILD.gn.
iOS bundle all resources in the same folder and some conflicts can arise from that.
Having all resources in the same file makes it easier to reason about it.

Change-Id: I37f420dfbd265ec644804e9d4c96515c83d2a992
Bug: b/397385850
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377821
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43944}
2025-02-20 08:48:47 -08:00
Evan Shrubsole
d9dd939d66 Move safe_minmax.h to webrtc namespace
Bug: webrtc:42232595
Change-Id: Ia3d96dfe1b1c25b6cc21bbd99d24ded7461924cd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378061
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43942}
2025-02-20 05:12:52 -08:00
Philipp Hancke
7233df9751 Filter fmtp parameters from RED capabilities
and ensure there is only one, similar to what is done with RTX.
This avoids exposing a payload type there.

See also
  https://github.com/w3c/webrtc-pc/issues/2696

BUG=webrtc:42221750,webrtc:360058654

Change-Id: Id7c2ddeaf47a3169db9be43c9c5b8e59346f1d57
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376760
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43929}
2025-02-19 09:43:31 -08:00
Evan Shrubsole
0ebd67f89d Move string_builder.h to webrtc namespace
Bug: webrtc:42232595
Change-Id: Iad12b11767c3bbaddcf0e87357e8e6037608defb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377740
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43926}
2025-02-19 06:30:53 -08:00
Evan Shrubsole
418a8c2c83 Move string_format.h to webrtc namespace
Bug: webrtc:42232595
Change-Id: I208257358150eeb97304946929649414af5eb2ca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377542
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43915}
2025-02-18 06:34:45 -08:00
Evan Shrubsole
f052c432fe Move string_to_number.h to webrtc namespace
Bug: webrtc:42232595
Change-Id: I104cff12bf40509fb4554b98f7af16975263285a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377520
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43911}
2025-02-18 01:44:39 -08:00
Harald Alvestrand
4aeab708bb Reland "Fix codec collision on reoffer after munged codec on offer."
This reverts commit 20bd702ebeb13a709832463fe5aadd623b7dc71b.

Reason for revert: Fixed test to not fail when AV1 is missing

Original change's description:
> Revert "Fix codec collision on reoffer after munged codec on offer."
>
> This reverts commit b9ddaa154b91b5d1cbe38bf38fce544a87e00d1a.
>
> Reason for revert: Downstream failure.
>
> Original change's description:
> > Fix codec collision on reoffer after munged codec on offer.
> >
> > Bug: chromium:395077842
> > Change-Id: I7665e593fa0f6883150363cb75103facd62f4fea
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377141
> > Reviewed-by: Henrik Boström <hbos@webrtc.org>
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#43889}
>
> Bug: chromium:395077842
> Change-Id: I10184a0d521add123838861a5c5e7929864537bb
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377500
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43901}

Bug: chromium:395077842
Change-Id: I3ba5cacebc7eb608edffea2de54cf1c1e9355a81
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377281
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43907}
2025-02-17 11:46:42 -08:00
Philipp Hancke
ff0256e8b6 Add unit test for "locking in" PTs offered by remote in subsequent O/A
C++ version of
  https://jsfiddle.net/fippo/ypj6mshr/3/

BUG=webrtc:360058654

Change-Id: Ieb6a149601093cafae337213d3e2b3b0bfc77831
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377322
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43904}
2025-02-17 06:37:07 -08:00
Harald Alvestrand
20bd702ebe Revert "Fix codec collision on reoffer after munged codec on offer."
This reverts commit b9ddaa154b91b5d1cbe38bf38fce544a87e00d1a.

Reason for revert: Downstream failure.

Original change's description:
> Fix codec collision on reoffer after munged codec on offer.
>
> Bug: chromium:395077842
> Change-Id: I7665e593fa0f6883150363cb75103facd62f4fea
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377141
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43889}

Bug: chromium:395077842
Change-Id: I10184a0d521add123838861a5c5e7929864537bb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377500
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43901}
2025-02-17 04:40:30 -08:00
Harald Alvestrand
b9ddaa154b Fix codec collision on reoffer after munged codec on offer.
Bug: chromium:395077842
Change-Id: I7665e593fa0f6883150363cb75103facd62f4fea
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377141
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43889}
2025-02-13 21:43:26 -08:00
Henrik Boström
736f58f35f Test that follow-up offer respects prior PT assignment.
Using parameterized testing, ensure that every possible payload type
that can be negotiated via remote O/A continues to show up in the local
follow-up offer in a subsequent O/A exchange.

This was an attempt to reproduce https://crbug.com/395077842, however
we pass all combinations.

Bug: chromium:395077842
Change-Id: Id4fd6f07a0870c8cd80ff7cf419e21fd6e2dbade
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376862
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43876}
2025-02-12 02:29:30 -08:00
Danil Chapovalov
8a97881882 Deprecate EmulatedNetworkManagerInterface::network_dependencies
That accessor forces test helpers to create BasicPortAllocator themself
rather than deligate such task to PeerConnectionFactory

Bug: webrtc:42232556
Change-Id: I262e032da110222198e6308f57a5e5f2d7ba4601
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376741
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43870}
2025-02-11 07:07:18 -08:00
Evan Shrubsole
fe5bdd75e0 Move ArrayView, Buffer and related to webrtc namespace
Bug: webrtc:42232595
Change-Id: Idcd603d534eda6a5c1eea36d2c1c1e80c19fa0ca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376561
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43863}
2025-02-10 03:54:43 -08:00
Henrik Boström
fe25b0e928 Report 'outbound-rtp.targetBitrate' correctly and per-RTP stream.
This CL fixes two issues with the old way targetBitrate was reported:
1. The target is per encoder, i.e. per SSRC, but the old way to report
   it was per sender and was approximately the sum of all encodings'
   targetBitrate in most cases.
2. The old value did not come directly from the VideoBitrateAllocation
   and tended to be greater than the sum of all targets (don't know
   why).

We know the old value was wrong and the new value correct because
the actual bytes produced by the encoder closely matches the configured
target, which wasn't always the case with the old metric implementation.

Tested with unit tests and manually in Chrome by going to
https://henbos.github.io/codec-quality/src/index.html and ensuring
target ~= actual bytes produced. It also matches the debug logging of
video_stream_encoder.cc.

Bug: webrtc:42225524, chromium:392424845
Change-Id: I7a6f69e053ebc3fd972c2c4b7712750e721c0acc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376460
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43854}
2025-02-06 09:55:11 -08:00
Danil Chapovalov
3164c2a4eb Restructure PeerConnection tests not to create PortAllocator directly
Instead rely on PeerConnectionFactory to create it.

Bug: webrtc:42232556
Change-Id: I24c9842ef027604b840188306db3e29756e1925f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376280
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43849}
2025-02-05 04:08:12 -08:00
Danil Chapovalov
b1ec813339 Expose direct access to PeerConnection in PeerConnectionWrapper helper
Multiple derived classes duplcated that code, and one more fixture
can benefit from the same direct access to avoid saving reference to port allocator

Cleaned includes and build dependencies on the way, in particular left single build target that contains peer_connection_wrapper

Bug: webrtc:42232556
Change-Id: Ieb3d5449f3a0285230847716e33fb3b2d1b47882
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376300
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43847}
2025-02-04 10:46:11 -08:00
Philipp Hancke
e828c6dba3 red: remove hardcoded parameters in favor of taking them from the codec
and make it less opus-specific.

BUG=None

Change-Id: I6fe2975ba6e45a3758fedc5b950de90e8d9df362
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375436
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43846}
2025-02-04 10:28:30 -08:00
Danil Chapovalov
34c15bc511 Restructure PeerConnectionBundleTest helper not to create PortAllocator
Instead rely on PeerConnectionFactory to create it.

Bug: webrtc:42232556
Change-Id: If3de8a2e311fcdca4371cca03d10bd383fbd3e01
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375922
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43835}
2025-02-03 03:06:13 -08:00
Philipp Hancke
f68df0b95c Restore primary/rtx payload type assignment logic
Changes the order of payload type assignment to keep the rtx_pt =
primary_pt+1 pattern (even if not required by the specification)

On https://webrtc.github.io/samples/src/content/peerconnection/pc1/ this
changes PTs as follows:

M132: m=video 9 UDP/TLS/RTP/SAVPF 96 97 102 103
104 105 106 107 108 109 127 125 39 40 45 46 98 99 100 101 112 113 114
(121 more lines) mid=1

M134: m=video 9 UDP/TLS/RTP/SAVPF 96 109 99 118 100 119 101 120 103 121
104 122 37 123 40 127 97 114 98 115 107 44 108 (121 more lines) mid=1

M134 with this patch: m=video 9 UDP/TLS/RTP/SAVPF 96 97 107 108 109 114
115 116 117 118 119 120 37 121 40 124 98 99 100 101 127 42 43 (121 more
lines) mid=1

Note that this pushes red and ulpfec into lower range but those codecs
are not widely used and it is possible to get them back into the upper
range e.g. by using setCodecPreferences to disable H264 (where ulpfec is
not supported)

BUG=chromium:391132280

Change-Id: I892f00a2f276728d16c37e8ba5f76d01f6322a7d
No-Iwyu: single include missing, keep it more merge-able
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375847
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Guido Urdaneta <guidou@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43833}
2025-01-31 06:41:50 -08:00
Harald Alvestrand
406d195d16 Move the rtc_p2p file last in its BUILD file
This will cause automation to not pick it up when searching for
headers.

Bug: webrtc:42226155
Change-Id: I4e93cd4eca13af32f76201df784b20a80ac9baed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375581
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43816}
2025-01-28 09:58:56 -08:00
Jonas Oreland
4a210486d3 DTLS 1.3 - patch 5
Extend DtlsRestart test to also
test with Dtls13 (and add variants
that tests caller/callee active).

BUG=webrtc:383141571

Change-Id: Ib8b48653d4ad3cb2f5d66d6e28fc9ab54064d804
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375620
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43813}
2025-01-28 03:15:36 -08:00
Harald Alvestrand
1a72c0ccb9 Move a test from media_session_unittest to codec_vendor_unittest
This test was only testing codec vendor functionality.

Bug: webrtc:360058654
Change-Id: I5763e766a44f6bb1542c4281b1d6c177a52c8c74
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375600
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43811}
2025-01-28 01:44:01 -08:00
Harald Alvestrand
13170bd177 Refactor media_session to move codec handling to new class
The new class "CodecVendor" is intended to handle all logic dealing
with codecs. This CL is a no-behavior-change CL, later CLs will
change the logic.

Bug: webrtc:360058654
Change-Id: I44e76f0e0bd364eeb7d4506f3e01e9e00e2843a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375500
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43806}
2025-01-27 07:52:12 -08:00
Philipp Hancke
9ff254eaf2 srtp: stop using private libsrtp function to determine packet index
instead use the standard API to get the rollover counter and
determine the extended sequence number which is the basis for the packet index.

See https://github.com/cisco/libsrtp/issues/738 and
https://github.com/cisco/libsrtp/issues/721

BUG=webrtc:357776213

Change-Id: I90c5a4a538f56132158aa48db8700187fcdb47d2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/371960
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43802}
2025-01-26 22:10:27 -08:00
Philipp Hancke
5090eaf363 Reland "srtp: spanify Protect + Unprotect"
This is a reland of commit 9572b2fa5850da6d319b9efb5ee36290e2895f7f
that does not remove the legacy implementations yet.

Original change's description:
> srtp: spanify Protect + Unprotect
>
> Makes SrtpSession and SrtpTransport use rtc::CopyOnWriteBuffer for the Protect and Unprotect operations instead of passing around void pointers.
>
> Also updates the unit tests to use CopyOnWriteBuffer instead of char arrays with a fixed length.
>
> BUG=webrtc:357776213
> No-Iwyu: missing include is a private libsrtp header
>
> Change-Id: I02a22ceb4e183e93c4ebd8c0a9c931404e0e32f3
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358442
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@meta.com>
> Cr-Commit-Position: refs/heads/main@{#43601}

No-Iwyu: missing include is a private libsrtp header
Bug: webrtc:357776213
Change-Id: I93704e27a6c48e015b775712fcd848c8c0c753e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372321
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43799}
2025-01-24 11:40:56 -08:00
Philipp Hancke
4e8c984d15 Obfuscate private keys in unit tests to avoid false lint errors
This was already done in one place but got caught by our linter
nonetheless. For better obfuscation split "PRIVATE" into two pieces.

BUG=None

No-Iwyu: mostly unrelated changes and some require special attention
Change-Id: Iba82b603fd5c5a50c75fc7e27cafbc7237e956f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375063
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43798}
2025-01-24 10:19:00 -08:00
Henrik Boström
ede69fd577 Make IsSameRtpCodecIgnoringLevel work for any codec.
Prior to this CL, IsSameRtpCodecIgnoringLevel() only ignored level IDs
if the codec was H265, incorrectly considering, for example, different
levels of H264 Baseline as not equal.
- This CL fixes that problem by using IsSameCodecSpecific() which is
  already used in other places, reducing the risk of different
  comparisons using different comparison rules.

This also fixes https://crbug.com/webrtc/391340599 where
setParameters() would throw if unrecognized SDP FMTP parameters were
added to a codec as part of SDP negotiation via SDP munging.

This CL makes the following WPT tests pass:
- external/wpt/webrtc/protocol/h264-unidirectional-codec-offer.https.html
- fast/peerconnection/RTCRtpSender-setParameters.html

Bug: chromium:381407888, webrtc:391340599
Change-Id: I5991403b56c86ba97e670996c6687f6315dde304
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374043
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43797}
2025-01-24 05:37:17 -08:00
Tommi
a70cc7886c Make mid_ a private member variable
Bug: webrtc:42233761
Change-Id: I17458a5b8c2d1999b40e4272dd51502ca6099219
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374665
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43791}
2025-01-23 00:53:11 -08:00
Henrik Boström
79e5e721b5 Add unidirectional codec support ("offer to send" use case).
This CL implements allowing sendonly codecs in setCodecPreferences(),
i.e. this spec PR: https://github.com/w3c/webrtc-pc/pull/3018. It also
makes the setCodecPreferences() ignore level IDs in the filtering
algorithm (but not in the sCP method call) as per this spec PR:
https://github.com/w3c/webrtc-pc/pull/3023.

In short, before this CL, setCodecPreferences() threw an exception if a
codec was preferred that is not present in receiver codec capabilities.
After this CL, setCodecPreferences() allows you to prefer codecs that
are *either* in the sender capabilities *or* the receiver capabilities.
- This allows you to "offer to send", i.e. prefer sendonly codecs on a
  sendonly transceiver.
- The filtering on direction is handled by
  RtpTransceiver::filtered_codec_preferences() which is called during
  SDP offer/answer (sdp_offer_answer.cc).

Also as per spec changes, if this filtering results in not having any
codecs to offer or answer then this results in not having any codec
preferences as opposed to throwing an exception (old behavior).
- Two old peer_connection_media_unittest.cc tests are updated to
  reflect the API failing less.

This CL adds both unit tests (rtp_transceiver_unittest.cc) and full
stack integration tests (peer_connection_encodings_integrationtest.cc).
It also makes us pass the following Web Platform Tests in Chrome:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/webrtc/protocol/h265-level-id.https.html

Bug: chromium:381407888
Change-Id: I98a5ad1acccb56db0538e4d47975b8a725102c33
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374520
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43788}
2025-01-22 08:27:25 -08:00
Harald Alvestrand
1f9e6046dd Start deprecation process for non-Optional datachannel parameters
The old version of these returns -1 when the value is not set.
Optional is better.

Bug: webrtc:42220231
Change-Id: Ideb0f51fd8bb7b5aa490743eb3b5d95998efbd1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374483
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43786}
2025-01-22 04:10:16 -08:00
Tommi
76c8f303a8 Replace use of .name in test code with .mid()
Bug: webrtc:42233761
Change-Id: Iea64cc3d9831d59f4f937af6f779d99c276b3b8b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374664
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43782}
2025-01-21 10:25:53 -08:00
Tommi
7a0bdb602c Update PeerConnectionSdpMethods::AddRemoteCandidate
...to use string_view for the mid and prefer .mid() over .name for
ContentInfo.

Bug: webrtc:42233761
Change-Id: Ia9bfe1d7454759ff87295939cda6a71e53cb6b98
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374663
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43781}
2025-01-21 08:24:22 -08:00
Henrik Boström
860a13c6fd Misc improvements to RtpTransceiver unit tests and test utils.
In order to reduce the size and scope of a follow-up CL, this CL makes
some cleaning up and improvements to existing tests and adds some minor
test utility methods that will be used in the follow-up.

No change in behavior, this CL...
- Makes use of NiceMock in RtpTransceiver tests to avoid wall of text
  spam for various "uninteresting" method calls in all tests in this
  file.
- Refactors creating senders, receivers and transceivers to allow the
  follow-up CL to create such objects for kind "video" as well.
- Exposes cricket::FakeVideoEngine* to RtpTranscieverTest and allows
  adding unidirectional video codecs in the fake engine, to be used by
  the follow-up CL's tests.
- Allows creating fake video engine codecs from SdpVideoFormat in the
  fake decoder factory (already possible in the fake encoder factory).

Bug: chromium:381407888
Change-Id: Ie07eff79d832dd21800b95fd584891ebf4520798
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374900
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43776}
2025-01-20 23:55:17 -08:00
Evan Shrubsole
fa73a2ed79 Convert timeouts in integration_test_helpers to TimeDelta
Bug: webrtc:42223979
Change-Id: Ia77b34c5c30a32fcb520359b993ff0b976be378c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374880
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43771}
2025-01-20 02:58:26 -08:00
Evan Shrubsole
2a858e21f6 Migrate last uses of gunit.h macros
Bug: webrtc:381524905
Change-Id: I9bf00a61dfcc00355e81fea34625119ef3ac61b6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374860
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43769}
2025-01-20 02:06:48 -08:00
Fabian Reddig
a85040ffd9 Revert "Reland "Use Payload Type suggester for all codec merging""
This reverts commit f5d13267aee114aa60e9718fc6f5032c8a5450f3.

Reason for revert: Caused downstream test failures

Original change's description:
> Reland "Use Payload Type suggester for all codec merging"
>
> This reverts commit b7abaee819771ca297bac4c51ec0daf62bd9a3fc.
>
> Reason for revert: Suspicion that suspected breakage wasn't real
>
> Original change's description:
> > Revert "Use Payload Type suggester for all codec merging"
> >
> > This reverts commit 0bac2aae596771db020f01a57fee4828081fbc38.
> >
> > Reason for revert: Suspected breakages downstream
> >
> > Original change's description:
> > > Use Payload Type suggester for all codec merging
> > >
> > > Bug: webrtc:360058654
> > > Change-Id: Id475762253c427c1800c2352a60fc0121c2dc388
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364783
> > > Reviewed-by: Florent Castelli <orphis@webrtc.org>
> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > > Cr-Commit-Position: refs/heads/main@{#43267}
> >
> > Bug: webrtc:360058654, b/375132036
> > Change-Id: Ieda626270193e7e6c93903b3c03a691b2bf0c1e2
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/366540
> > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Reviewed-by: Florent Castelli <orphis@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#43290}
>
> Bug: webrtc:360058654, b/375132036
> Change-Id: Id6e72f7aac81023da43de7627c24dd1a792ea461
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374304
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43739}

Bug: webrtc:360058654, b/375132036
Change-Id: I3fb302d6ddb7d9e4b0acc3eefdac74edf55ca01a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374700
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43763}
2025-01-17 23:49:26 -08:00
Henrik Boström
9f68535e68 Fix setParameters() throwing when level-id does not match.
In order to align with this PR[1], setParameters() should not throw if
the H265 level ID we're trying to send does not match what was
negotiated. This was believed to be fixed by [2] but we were still
throwing due to a check on a different layer (media_engine.cc).

In order to reproduce the issue despite WebRTC lacking SW
encoder/decoder for H265, peer_connection_encodings_integrationtest.cc
gets a new test with real stack but fake encoder/decoder factory. This
allows negotiating H265 and doing SetParameters() even though the codec
is not processing any frames.
- Basic test coverage is added for singlecast and simulcast H265.
- Test coverage for the bug being fixed added.
- In Chrome the equivalent WPTs exists for when real HW is available
  here[3]. Those tests PASS with this CL (currently FAIL).

[1] https://github.com/w3c/webrtc-pc/pull/3023
[2] https://webrtc-review.googlesource.com/c/src/+/368781
[3] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/webrtc/protocol/h265-level-id.https.html

Bug: chromium:381407888
Change-Id: I3619a124586b8b26d3695cfad8890cf40bd475db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374164
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Jianlin Qiu <jianlin.qiu@intel.com>
Cr-Commit-Position: refs/heads/main@{#43759}
2025-01-17 09:17:11 -08:00
Tommi
762753d0a2 Slight restriction of access to ContentInfo and prefer mid to name.
As a first step, use .mid() instead of .name in JsepTransportController

Bug: webrtc:42233761
Change-Id: I23ab97609175f8dbfdf59ee41c4db42f21a9e9ad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374660
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43756}
2025-01-17 06:19:38 -08:00
Philipp Hancke
bce57cda1e Piggyback DTLS handshake in initial STUN packets
This change puts the DTLS handshake as payload of STUN packets with a custom STUN attribute (registered with the IANA) and starts the DTLS handshake before the ICE transport becomes writable. Effectively, STUN acts as a transport layer for DTLS during the handshake phase.

This will theoretically reduce the call setup time by one RTT for aggressive nomination or two RTTs for regular nomination.

The latest DTLS packet (flight) is cached and sent on every STUN request or response. DTLS packets are extracted from every authenticated STUN request or response and handled to the DTLS layer for processing.
The caching also increases the resilience to packet loss as STUN pacing is more aggressive (every 20ms) than the exponential backoff used by DTLS which should reduce call setup time in lossy networks.

If the other side of the connection does not support this feature the fallback to normal DTLS happens as soon as the ICE transport becomes writable. This also handles edge-cases like fragmentation of the DTLS handshake.

The feature is only supported when ECDSA certificates are used since RSA certificates are too large to transport as STUN attributes. The observed attributes for the server and client flights with the certificates were around 600 to 650 bytes. This may be further reduced by using raw public keys defined in RFC 7250.

This feature is disabled by default and guarded by the field trial
  WebRTC-IceHandshakeDtls
and requires experimentation and standardization before roll-out in the browser.

Parts of this landed in
  https://webrtc-review.googlesource.com/c/src/+/370679

BUG=webrtc:367395350

Change-Id: I4809438b2a267c4690a9b2bd6f1766d2f959500d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362480
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43742}
2025-01-15 07:54:23 -08:00
Philipp Hancke
cfaba8fd2d Measure SDP munging
by storing
  [[LastCreatedOffer]] / [[LastCreatedAnswer]]
which are similar to the W3C equivalent but as
description objects instead of serialized SDP strings.

While rejecting all SDP munging is not feasible, this lets us
measure and reject certain modifications gradually.

Chromium metrics CL:
  https://chromium-review.googlesource.com/c/chromium/src/+/6089633

This is measured at three points during the lifetime of a peerconnection:
* for the first SLD call
* when the connection is first established
* when the connection was established and is being closed

Note that the "first" SDP munging detected is returned which may hide that something uses more than one modification.

BUG=chromium:40567530

Change-Id: I964e3ee6e75f73b777d90556fac8691a6f3dc27f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370680
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Johannes Kron <kron@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43741}
2025-01-15 07:38:45 -08:00
Harald Alvestrand
f5d13267ae Reland "Use Payload Type suggester for all codec merging"
This reverts commit b7abaee819771ca297bac4c51ec0daf62bd9a3fc.

Reason for revert: Suspicion that suspected breakage wasn't real

Original change's description:
> Revert "Use Payload Type suggester for all codec merging"
>
> This reverts commit 0bac2aae596771db020f01a57fee4828081fbc38.
>
> Reason for revert: Suspected breakages downstream
>
> Original change's description:
> > Use Payload Type suggester for all codec merging
> >
> > Bug: webrtc:360058654
> > Change-Id: Id475762253c427c1800c2352a60fc0121c2dc388
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364783
> > Reviewed-by: Florent Castelli <orphis@webrtc.org>
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#43267}
>
> Bug: webrtc:360058654, b/375132036
> Change-Id: Ieda626270193e7e6c93903b3c03a691b2bf0c1e2
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/366540
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Florent Castelli <orphis@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43290}

Bug: webrtc:360058654, b/375132036
Change-Id: Id6e72f7aac81023da43de7627c24dd1a792ea461
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374304
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43739}
2025-01-15 02:17:56 -08:00
Philipp Hancke
da8a535ad4 Fix RTX/sCP behavior
which was not filtering RTX when it was removed from the codec preferences but RED was still there.

BUG=chromium:387077342

Change-Id: I7d14e8361c6405298b71718665194f2622e21501
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/373661
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43723}
2025-01-13 09:09:28 -08:00
Harald Alvestrand
f94bddf72c Split PushNewMediaChannelAndDeleteChannel
This admits to the fact that a transceiver's channel can't change, it's just
either created or deleted.

Bug: webrtc:42224170
Change-Id: I9a44bf0c0bace74eda6cdf1a1d6967eb8c697594
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372380
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43713}
2025-01-12 06:30:57 -08:00
Boris Tsirkin
825379f4dc Format /pc folder
Formatting done via:

git ls-files | grep -E '^pc\/.*\.(h|cc|mm)' | xargs clang-format -i

No-Iwyu: Includes didn't change and it isn't related to formatting
Bug: webrtc:42225392
Change-Id: I3d04503bab53c12927bf408dc63b92cde545b4c8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/373900
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43689}
2025-01-08 11:55:45 -08:00
Evan Shrubsole
3e8e4784ac Replace gunit.h macros with WaitUntil in pc/
Bug: webrtc:381524905
Change-Id: I15946ab73aaef2e830d6801451636e717708adbf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/373704
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43680}
2025-01-08 05:34:50 -08:00
Henrik Boström
897906d950 Revert "srtp: spanify Protect + Unprotect"
This reverts commit 9572b2fa5850da6d319b9efb5ee36290e2895f7f.

Reason for revert: Breaks internal tests

Original change's description:
> srtp: spanify Protect + Unprotect
>
> Makes SrtpSession and SrtpTransport use rtc::CopyOnWriteBuffer for the Protect and Unprotect operations instead of passing around void pointers.
>
> Also updates the unit tests to use CopyOnWriteBuffer instead of char arrays with a fixed length.
>
> BUG=webrtc:357776213
> No-Iwyu: missing include is a private libsrtp header
>
> Change-Id: I02a22ceb4e183e93c4ebd8c0a9c931404e0e32f3
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358442
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@meta.com>
> Cr-Commit-Position: refs/heads/main@{#43601}

Bug: webrtc:357776213
Change-Id: I5c36ecc2fd9ab672f61cd6b15398452cbd5e98a8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372200
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43608}
2024-12-19 00:15:22 -08:00
Harald Alvestrand
33f38f2f38 Add some tests for CodecList consistency
Bug: webrtc:360058654
Change-Id: Ida26eca237c4f882cf03204a3d87780c25c1890c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/371640
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43604}
2024-12-18 17:34:32 -08:00
Philipp Hancke
9572b2fa58 srtp: spanify Protect + Unprotect
Makes SrtpSession and SrtpTransport use rtc::CopyOnWriteBuffer for the Protect and Unprotect operations instead of passing around void pointers.

Also updates the unit tests to use CopyOnWriteBuffer instead of char arrays with a fixed length.

BUG=webrtc:357776213
No-Iwyu: missing include is a private libsrtp header

Change-Id: I02a22ceb4e183e93c4ebd8c0a9c931404e0e32f3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358442
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43601}
2024-12-18 09:17:26 -08:00
Evan Shrubsole
29af9f0c87 Switch peer_connection_encodings_integrationtest to WaitUntil
Demonstrates use of matchers and WaitUntil to have tests that are more
understandable during failure.

Drive by changes,
* Remove the `const` on RTCStats.id_ as to allow for the implicit copy
constructor.
* Add [[nodiscard]] to WaitUntil as it is not useful without checking
the return value.

Bug: webrtc:381524905
Change-Id: I379910ce0fc8d9d81c96b8f164aa5a040637c85a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370802
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43599}
2024-12-18 05:52:48 -08:00