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:
Tomas Gunnarsson
2021-01-17 16:14:52 +01:00
committed by Commit Bot
parent 8467cf27ac
commit e091fd21d6
4 changed files with 20 additions and 23 deletions

View File

@ -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);
}