Allow RTP module thread checking to know PacketRouter status.

Since https://webrtc-review.googlesource.com/c/src/+/228433 both audio
and video now only call Get/SetRtpState while not registered to the
packet router.

We can thus remove the lock around packet sequencer and just use a
thread checker.

Bug: webrtc:11340
Change-Id: Ie6865cc96c36208700c31a75747ff4dd992ce68d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228435
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34755}
This commit is contained in:
Erik Språng
2021-08-13 16:12:41 +02:00
committed by WebRTC LUCI CQ
parent 05a9e5abd3
commit b6bbdeb24d
8 changed files with 70 additions and 49 deletions

View File

@ -169,6 +169,8 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
size_t ExpectedPerPacketOverhead() const override;
void OnPacketSendingThreadSwitched() override;
// RTCP part.
// Get RTCP status.
@ -269,12 +271,9 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
// If false, sequencing is owned by `packet_generator` and can happen on
// several threads. If true, sequencing always happens on the pacer thread.
const bool deferred_sequencing_;
// TODO(bugs.webrtc.org/11340): Remove lock one we can guarantee that
// setting/getting rtp state only happens after removal from packet sending
// code path.
mutable Mutex mutex_sequencer_;
SequenceChecker sequencing_checker;
// Handles sequence number assignment and padding timestamp generation.
PacketSequencer sequencer_ RTC_GUARDED_BY(mutex_sequencer_);
PacketSequencer sequencer RTC_GUARDED_BY(sequencing_checker);
// Handles final time timestamping/stats/etc and handover to Transport.
RtpSenderEgress packet_sender;
// If no paced sender configured, this class will be used to pass packets
@ -314,8 +313,7 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
TimeDelta duration);
TaskQueueBase* const worker_queue_;
RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_sequence_checker_;
RTC_NO_UNIQUE_ADDRESS SequenceChecker pacer_thread_checker_;
RTC_NO_UNIQUE_ADDRESS SequenceChecker rtcp_thread_checker_;
std::unique_ptr<RtpSenderContext> rtp_sender_;
RTCPSender rtcp_sender_;