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}
This commit is contained in:
Tomas Gunnarsson
2022-01-06 12:36:04 +00:00
committed by WebRTC LUCI CQ
parent ac72dda645
commit c69453d93b
5 changed files with 142 additions and 50 deletions

View File

@ -286,6 +286,9 @@ struct RTC_EXPORT RtpExtension {
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);