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}
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}
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}
DTLS 1.3 encrypts more parts of the handshake so we move from
deep packet inspection to looking at the state of DTLS to
decide whether to intercept the packet.
BUG=webrtc:367395350
Change-Id: Idb1eda0437f24002f48381af5d6a167a4a153381
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374501
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43794}
This change resolves an issue that arises when there is a gap in the
sequence numbers of packets associated with a single frame.
Before this change, the H26x packet buffer could potentially assemble a
frame using only a subset of the packets in the buffer if a packet was
missing in the middle and a packet with a marker bit arrived.
To address this, the change introduces a check before assembling a
frame. This ensures that all packets belonging to a single frame are
correctly collected by iterating backward until the first packet in the
frame is identified.
Bug: webrtc:384391181
Change-Id: I4d09a3d6d569624ece204264cb32e5076ed090a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374183
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Jianlin Qiu <jianlin.qiu@intel.com>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43793}
This helps Java clients control the port range.
Bug: None
Change-Id: Icfe16cdfac4e08cd21346a3cb4bb65b9fb2fa0d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374841
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Youjie Zhou <youjiezhou@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43789}
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}
This is a reland of commit bcb19c00ba8ab1788ba3c08f28ee1b23e0cc77b9
Original change's description:
> Allow sending to separate payload types for each simulcast index.
>
> This change is for mixed-codec simulcast.
>
> By obtaining the payload type via RtpConfig::GetStreamConfig(),
> the correct payload type can be retrieved regardless of whether
> RtpConfig::stream_configs is initialized or not.
>
> Bug: webrtc:362277533
> Change-Id: I6b2a1ae66356b20a832565ce6729c3ce9e73a161
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364760
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Commit-Queue: Florent Castelli <orphis@webrtc.org>
> Reviewed-by: Florent Castelli <orphis@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43197}
Bug: webrtc:362277533
Change-Id: Ia82c3390cceb9f68315c2fd9ba5114693669af32
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374780
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43787}
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}
...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}
This adds an optional callback closure and an enum representing the error.
Bug: webrtc:390314937
Change-Id: If9a22dd6d90d5c4d94175e021511766ea49acec2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374420
Commit-Queue: Peter Hanspers <peterhanspers@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43780}
Drive-by: fix MakeVal in rtc_base/checks.h to ensure that StrCat is
used for types that have AbslStringify.
Bug: None
Change-Id: Ia78c65da18b4a826365a6a2c741f11809640197f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374345
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43779}
Needed for testing in a follow-up CL.
Using ToString rather than absl::StrCat because I want the name of the
enum (e.g. "INVALID_MODIFICATION") as opposed to the enum value (int).
Bug: none
Change-Id: I45a925fad65395d1e6a886a9f787c2f360fb8604
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374343
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43777}
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}
Experimentation shows only a slight increase in bitrate due to improved
BWE. There's no negative side-effects we have been able to see so far.
This CL flips the experiment to default-on but is kept around as a
kill-switch until the next milestone just in case something unexpected
is discovered.
Bug: webrtc:42226301
Change-Id: I4a0b1c85e912b909d7bff58d78966cf161857f7c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374182
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Erik Språng <sprang@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43773}
Need to clear frameInfos in case of reinit, as outdated items produce
incorrect decode time. This leds to render timestamps 'in future'
(VCMTiming::RenderTime) and rendering delays (low fps).
Bug: None
Change-Id: Iee569ff74fe3e0ff3610877472756cbbd59aba7a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374680
Auto-Submit: Anna Lemehova <anna.lemehova@gmail.com>
Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
Commit-Queue: Zoé Lepaul <xalep@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43772}
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}
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}
This resolves an issue where when packets appear out of order at the
beginning of a stream, packet_buffer.cc might drop the entire packet
buffer because it detects a "large negative jump" even though the
difference in sequence numbers is very minor and is caused by network
congestion / packet re-ordering. Currently, when the issue occurs, this
can cause video corruption/artifacts. More details and reproduction is
available on the attached webrtc bug report 390329776.
Bug: webrtc:390329776
Change-Id: Idb56eb2e066d596d8afd7ec904359baf0cb3feef
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374540
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43753}
the lack of this led to a DTLS restart in the default case.
Also reduce the log level from "ERROR" to "INFO".
BUG=webrtc:367395350
Change-Id: I52cd74f508ca4b4c28b11220ea82d95081558eee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374503
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43752}
Before this CL VP8 and AV1 used the same max QP=56. Tests show that at this QP AV1 delivers a worse PSNR than VP8. We want AV1 min quality to be not worse than VP8. This CL reduces the default max QP for AV1 to 52. With this value libaom AV1 encoder delivers PSNR close to libvpx VP8 at QP 56.
Bug: webrtc:351644568, b/369540380
Change-Id: I2e27ddab562f9c9710b11dc09076b03d7b308bb0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374041
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43751}