mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 23:57:59 +01:00
RtpSenderEgress::SendPacket: avoid PostTasks.
Under the combined network/worker thread project, tasks are unnecessarily posted to the same thread. Avoid this by posting only if invoked on a diffferent sequence. TESTED=presubmit + local Meet calls. Bug: webrtc:137439 Change-Id: I9befde0583b214ebe014617695c2eb9f047de8a0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295869 Commit-Queue: Markus Handell <handellm@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39472}
This commit is contained in:
parent
28c4986e1b
commit
c35a3f13c7
1 changed files with 14 additions and 7 deletions
|
@ -277,13 +277,20 @@ void RtpSenderEgress::SendPacket(RtpPacketToSend* packet,
|
|||
RtpPacketMediaType packet_type = *packet->packet_type();
|
||||
RtpPacketCounter counter(*packet);
|
||||
size_t size = packet->size();
|
||||
worker_queue_->PostTask(
|
||||
SafeTask(task_safety_.flag(), [this, now, packet_ssrc, packet_type,
|
||||
counter = std::move(counter), size]() {
|
||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||
UpdateRtpStats(now, packet_ssrc, packet_type, std::move(counter),
|
||||
size);
|
||||
}));
|
||||
// TODO(bugs.webrtc.org/137439): clean up task posting when the combined
|
||||
// network/worker project launches.
|
||||
if (TaskQueueBase::Current() != worker_queue_) {
|
||||
worker_queue_->PostTask(
|
||||
SafeTask(task_safety_.flag(), [this, now, packet_ssrc, packet_type,
|
||||
counter = std::move(counter), size]() {
|
||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||
UpdateRtpStats(now, packet_ssrc, packet_type, std::move(counter),
|
||||
size);
|
||||
}));
|
||||
} else {
|
||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||
UpdateRtpStats(now, packet_ssrc, packet_type, std::move(counter), size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue