Change SetLocalContent in channel classes to avoid Invoke.
With these changes, we now often have 0 invokes and at most 1 when
calling SetLocalContent on a channel. Before we had at least 1 and
typically 2.
Summary of changes.
* Updating RtpExtension::DeduplicateHeaderExtensions to return a sorted
vector (+test) for easy detection of changes.
* Before updating the transport on the network thread, detect if
actual changes to the demuxer criteria or changes to the rtp header
extensions have been made.
* Consolidate both transport updates to a single call instead of two.
* Added DCHECK guards to catch regressions in number of invokes.
A possible upcoming improvement is to update the transport
asynchronously.
Bug: webrtc:13536
Change-Id: I71ef7b181635a796ffa1e3a02a0f661d28a4870c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244700
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35638}
diff --git a/api/rtp_parameters.h b/api/rtp_parameters.h
index 84f3a0e..45cedfd 100644
--- a/api/rtp_parameters.h
+++ b/api/rtp_parameters.h
@@ -286,6 +286,9 @@
bool encrypt);
// Returns a list of extensions where any extension URI is unique.
+ // The returned list will be sorted by uri first, then encrypt and id last.
+ // Having the list sorted allows the caller fo compare filtered lists for
+ // equality to detect when changes have been made.
static const std::vector<RtpExtension> DeduplicateHeaderExtensions(
const std::vector<RtpExtension>& extensions,
Filter filter);