This uses libSRTPs srtp_remove_stream()
https://github.com/cisco/libsrtp/blob/main/include/srtp.h#L597
method to remove SSRCs from the libSRTP session when they are removed
from the RTP demuxer. This works even when the stream was added
automatically via the ssrc_any_inbound mechanism.
Only streams for inbound SSRCs that were added explicitly via SDP negotiation are removed.
Guarded by WebRTC-SrtpRemoveReceiveStream field trial.
BUG=webrtc:15604
Change-Id: I655bde5f8ddf26ac91395ef54bd1b3c598813380
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324720
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#41105}
Remove unnecessary optimization from BaseChannel,
previous_demuxer_criteria_, that I'm not seeing as providing value.
Previously it was used to avoid a thread hop if a reconfiguration
wasn't needed, but the way that was done, wasn't thread safe. So after
addressing that issue, the variable more represents increased complexity
in the code than runtime efficiency.
Bug: webrtc:11993, webrtc:12230
Change-Id: Ic8e3e1d2f57e669a168cc7b5cf5d407133976e3c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244093
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35628}
Add TODO for accessing `previous_demuxer_criteria_`, currently accessed
from two threads (unsafe).
Changed RtpDemuxerCriteria to be a class, all members private with
accessor methods instead of direct variable access. Moving forward
this can allow for things like checking for thread/sequence and state
consistency.
Bug: webrtc:12517, webrtc:11993
Change-Id: I21c1b3067e988494ce6f4c6c85c62165801883bf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244083
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35616}
Since another CL [1] grew a bit in scope, this CL needs to land first,
coupled with downstream updates.
[1]: https://webrtc-review.googlesource.com/c/src/+/244083
Bug: webrtc:12517, webrtc:11993
Change-Id: I80d826a0d3f3240a2cecf8cbe09842cba0902b16
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244085
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35611}
Except for a use of std::multimap (for which there currently is no
drop-in replacement), use webrtc::flat_map and flat_set for increased
performance.
The number of ssrcs/mids/payload types/etc is likely to be small and is
generally updated very rarely, but looked up a lot.
RtpDemuxer::ResolveSink's use of std::map represents about 0.6% CPU in
heavily loaded media servers. It does quite a few map lookups, and by
taking advantage of the increased cache locality of the flat_map and
flat_set containers, performance should be increased.
A previous attempt to use std::unordered_map failed in change 216243,
which was reverted. This is the second attempt.
Bug: webrtc:12689
Change-Id: Ifdbec63b2fd8f2f52e45ebaf12834b11dd7a41c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224662
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34429}
While the savings were positive in Media Servers, there was a regression
in some scenarios (crbug.com/webrtc/12718) so let's revert it.
This partially reverts commit 553fd3220b.
Bug: webrtc:12718
Change-Id: If9252fd996ffc5efd7609eb4c7c0e7f001893676
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/220103
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34117}
The RtpDemuxer uses a number of maps, all of which can be made
unordered as they map SSRCs/MIDs/payload types/RSIDs etc - all of which
have no inherent ordering.
In busy media servers, the std::map operations can use ~0.5% CPU. After
this commit has landed, it will be evaluated and if it doesn't live up
to expected savings, it will be reverted.
Bug: webrtc:12689
Change-Id: I99e21c6b1ddb21dd9d47b0f9a891df5a2c3df59a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216243
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33846}
BaseChannel adds and removes receive streams on the worker thread
(UpdateRemoteStreams_w) and then posts a task to the network thread to
update the demuxer criteria. Until this happens, OnRtpPacket() keeps
forwarding "recently removed" ssrc packets to the WebRtcVideoChannel.
Furthermore WebRtcVideoChannel::OnPacketReceived() posts task from the
network thread to the worker thread, so even if the demuxer criteria was
instantly updated we would still have an issue of in-flight packets for
old ssrcs arriving late on the worker thread inside WebRtcVideoChannel.
The wrong ssrc could also arrive when the demuxer goes from forwarding
all packets to a single m= section to forwarding to different m=
sections. In this case we get packets with an ssrc for a recently
created m= section and the ssrc was never intended for our channel.
This is a problem because when WebRtcVideoChannel sees an unknown ssrc
it treats it as an unsignalled stream, creating and destroying default
streams which can be very expensive and introduce large delays when lots
of packets are queued up.
This CL addresses the issue with callbacks for when a demuxer criteria
update is pending and when it has completed. During this window of time,
WebRtcVideoChannel will drop packets for unknown ssrcs.
This approach fixes the race without introducing any new locks and
packets belonging to ssrcs that were not removed continue to be
forwarded even if a demuxer criteria update is pending. This should make
a=inactive for 50p receive streams a glitch-free experience.
Bug: webrtc:12258, chromium:1069603
Change-Id: I30d85f53d84e7eddf7d21380fb608631863aad21
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214964
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Taylor <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33757}
The demuxer variable is now being used from the same thread consistently
so it's safe to replace the lock with a sequence checker.
Down the line, we may move construction+use of the
RtpStreamReceiverController class in Call, over to the network thread.
This should be possible without further modifications to
RtpStreamReceiverController.
Bug: webrtc:11993, webrtc:11567
Change-Id: Iee8c31ddf9b26b39393f40b5b1d25343b0233ae3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/202245
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33016}
It was only used by RtcpDemuxer that is now deleted
Bug: None
Change-Id: Ief2c285e293cde3ed7576b194d2df137d6cbad38
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178902
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31760}
The MID header extension is handled by the RtpTransport
which lives above Call and takes care of demuxing to SSRC.
Bug: webrtc:4050
Change-Id: I27135e296ae9c7b15e926ba17547c26c75684ad6
Reviewed-on: https://webrtc-review.googlesource.com/65025
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22682}
In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC
from src/webrtc to src/ (in order to preserve an healthy git history).
This CL takes care of fixing header guards, #include paths, etc...
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578
Reviewed-on: https://webrtc-review.googlesource.com/1561
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19846}
In order to eliminate the WebRTC Subtree mirror in Chromium,
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}