Move call to TransportFeedbackDemuxer::AddPacket to transport queue.

Before, this call was being made from the SendPacket path of the
pacer. The transport will post a task to the transport queue regardless
so this change moves the lock inside of the demuxer away from the
pacer and over to the transport queue.

Moving forward, the calls to register/unregister with the feedback
demuxer, will occur on the transport queue as well and we can change
the transport OnTransportFeedback() implementation to forward the
calls to the demuxer on the transport queue as well. That will bring
all calls into the same execution context and we won't need a lock.

Bug: webrtc:13517, webrtc:11993
Change-Id: If714ca6d2b164a1a2b6bcb8c99787372064a31a0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/248164
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35775}
This commit is contained in:
Tommi 2022-01-24 13:36:40 +01:00 committed by WebRTC LUCI CQ
parent 3088941a5e
commit 6f542d5e92
2 changed files with 5 additions and 2 deletions

View File

@ -559,11 +559,10 @@ void RtpTransportControllerSend::OnReceivedRtcpReceiverReport(
void RtpTransportControllerSend::OnAddPacket(
const RtpPacketSendInfo& packet_info) {
feedback_demuxer_.AddPacket(packet_info);
Timestamp creation_time = Timestamp::Millis(clock_->TimeInMilliseconds());
task_queue_.PostTask([this, packet_info, creation_time]() {
RTC_DCHECK_RUN_ON(&task_queue_);
feedback_demuxer_.AddPacket(packet_info);
transport_feedback_adapter_.AddPacket(
packet_info,
send_side_bwe_with_overhead_ ? transport_overhead_bytes_per_packet_ : 0,

View File

@ -44,6 +44,10 @@ void TransportFeedbackDemuxer::DeRegisterStreamFeedbackObserver(
}
void TransportFeedbackDemuxer::AddPacket(const RtpPacketSendInfo& packet_info) {
// Currently called on the send transport queue.
// TODO(tommi): When registration/unregistration as well as
// OnTransportFeedback callbacks occur on the transport queue, we can remove
// this lock.
MutexLock lock(&lock_);
StreamFeedbackObserver::StreamPacketInfo info;