Bug 1766646 - Vendor libwebrtc from e091fd21d6

Upstream commit: https://webrtc.googlesource.com/src/+/e091fd21d6c70699c61f32f11b6687143fed3410
    Remove lock from RtpStreamReceiverController.

    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}
This commit is contained in:
Michael Froman 2022-04-28 16:52:02 -05:00 коммит произвёл Connor Sheehan
Родитель 57509e359f
Коммит 7076dbd200
6 изменённых файлов: 25 добавлений и 23 удалений

3
third_party/libwebrtc/README.moz-ff-commit поставляемый
Просмотреть файл

@ -2586,3 +2586,6 @@ be93b788c6
# MOZ_LIBWEBRTC_SRC=/home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src MOZ_LIBWEBRTC_COMMIT=mjfdev bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
8467cf27ac
# MOZ_LIBWEBRTC_SRC=/home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src MOZ_LIBWEBRTC_COMMIT=mjfdev bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
e091fd21d6

2
third_party/libwebrtc/README.mozilla поставляемый
Просмотреть файл

@ -1726,3 +1726,5 @@ libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwe
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-04-28T20:33:03.076436.
# python3 vendor-libwebrtc.py --from-local /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src --commit mjfdev libwebrtc
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-04-28T20:33:51.879551.
# python3 vendor-libwebrtc.py --from-local /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src --commit mjfdev libwebrtc
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-04-28T21:51:57.173011.

2
third_party/libwebrtc/call/rtp_demuxer.cc поставляемый
Просмотреть файл

@ -91,7 +91,7 @@ std::string RtpDemuxer::DescribePacket(const RtpPacketReceived& packet) {
return sb.Release();
}
RtpDemuxer::RtpDemuxer() = default;
RtpDemuxer::RtpDemuxer(bool use_mid /* = true*/) : use_mid_(use_mid) {}
RtpDemuxer::~RtpDemuxer() {
RTC_DCHECK(sink_by_mid_.empty());

8
third_party/libwebrtc/call/rtp_demuxer.h поставляемый
Просмотреть файл

@ -94,7 +94,7 @@ class RtpDemuxer {
// relevant for demuxing.
static std::string DescribePacket(const RtpPacketReceived& packet);
RtpDemuxer();
explicit RtpDemuxer(bool use_mid = true);
~RtpDemuxer();
RtpDemuxer(const RtpDemuxer&) = delete;
@ -132,10 +132,6 @@ class RtpDemuxer {
// if the packet was forwarded and false if the packet was dropped.
bool OnRtpPacket(const RtpPacketReceived& packet);
// Configure whether to look at the MID header extension when demuxing
// incoming RTP packets. By default this is enabled.
void set_use_mid(bool use_mid) { use_mid_ = use_mid; }
private:
// Returns true if adding a sink with the given criteria would cause conflicts
// with the existing criteria and should be rejected.
@ -191,7 +187,7 @@ class RtpDemuxer {
// Adds a binding from the SSRC to the given sink.
void AddSsrcSinkBinding(uint32_t ssrc, RtpPacketSinkInterface* sink);
bool use_mid_ = true;
const bool use_mid_;
};
} // namespace webrtc

Просмотреть файл

@ -37,11 +37,7 @@ RtpStreamReceiverController::Receiver::~Receiver() {
controller_->RemoveSink(sink_);
}
RtpStreamReceiverController::RtpStreamReceiverController() {
// At this level the demuxer is only configured to demux by SSRC, so don't
// worry about MIDs (MIDs are handled by upper layers).
demuxer_.set_use_mid(false);
}
RtpStreamReceiverController::RtpStreamReceiverController() {}
RtpStreamReceiverController::~RtpStreamReceiverController() = default;
@ -52,19 +48,19 @@ RtpStreamReceiverController::CreateReceiver(uint32_t ssrc,
}
bool RtpStreamReceiverController::OnRtpPacket(const RtpPacketReceived& packet) {
rtc::CritScope cs(&lock_);
RTC_DCHECK_RUN_ON(&demuxer_sequence_);
return demuxer_.OnRtpPacket(packet);
}
bool RtpStreamReceiverController::AddSink(uint32_t ssrc,
RtpPacketSinkInterface* sink) {
rtc::CritScope cs(&lock_);
RTC_DCHECK_RUN_ON(&demuxer_sequence_);
return demuxer_.AddSink(ssrc, sink);
}
size_t RtpStreamReceiverController::RemoveSink(
const RtpPacketSinkInterface* sink) {
rtc::CritScope cs(&lock_);
RTC_DCHECK_RUN_ON(&demuxer_sequence_);
return demuxer_.RemoveSink(sink);
}

Просмотреть файл

@ -14,7 +14,7 @@
#include "call/rtp_demuxer.h"
#include "call/rtp_stream_receiver_controller_interface.h"
#include "rtc_base/deprecated/recursive_critical_section.h"
#include "rtc_base/synchronization/sequence_checker.h"
namespace webrtc {
@ -58,13 +58,18 @@ class RtpStreamReceiverController
RtpPacketSinkInterface* const sink_;
};
// TODO(nisse): Move to a TaskQueue for synchronization. When used
// by Call, we expect construction and all methods but OnRtpPacket
// to be called on the same thread, and OnRtpPacket to be called
// by a single, but possibly distinct, thread. But applications not
// using Call may have use threads differently.
rtc::RecursiveCriticalSection lock_;
RtpDemuxer demuxer_ RTC_GUARDED_BY(&lock_);
// TODO(bugs.webrtc.org/11993): We expect construction and all methods to be
// called on the same thread/tq. Currently this is the worker thread
// (including OnRtpPacket) but a more natural fit would be the network thread.
// Using a sequence checker to ensure that usage is correct but at the same
// time not require a specific thread/tq, an instance of this class + the
// associated functionality should be easily moved from one execution context
// to another (i.e. when network packets don't hop to the worker thread inside
// of Call).
SequenceChecker demuxer_sequence_;
// At this level the demuxer is only configured to demux by SSRC, so don't
// worry about MIDs (MIDs are handled by upper layers).
RtpDemuxer demuxer_ RTC_GUARDED_BY(&demuxer_sequence_){false /*use_mid*/};
};
} // namespace webrtc