Call: Deduplicate SentPacket notifications
When bundling is in effect, multiple senders may be sharing the same transport. It means every |sent_packet| will be multiply notified from different channels, WebRtcVoiceMediaChannel or WebRtcVideoChannel. Record |last_sent_packet_| to deduplicate redundant notifications to downstream objects. This CL reduces 50% PostTask/Wakeup of Dynamic Mode Pacer. [1] https://datatracker.ietf.org/doc/html/rfc8829#section-4.1.1 [2] https://datatracker.ietf.org/doc/html/rfc8843 Bug: webrtc:13417 Change-Id: Ib121d5af07abe208bd7d36715a234f48cdabb032 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238720 Reviewed-by: Markus Handell <handellm@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Markus Handell <handellm@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35417}
This commit is contained in:
parent
5f34130f26
commit
61a8d9caaa
18
call/call.cc
18
call/call.cc
@ -466,6 +466,10 @@ class Call final : public webrtc::Call,
|
||||
|
||||
bool is_started_ RTC_GUARDED_BY(worker_thread_) = false;
|
||||
|
||||
RTC_NO_UNIQUE_ADDRESS SequenceChecker sent_packet_sequence_checker_;
|
||||
absl::optional<rtc::SentPacket> last_sent_packet_
|
||||
RTC_GUARDED_BY(sent_packet_sequence_checker_);
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(Call);
|
||||
};
|
||||
} // namespace internal
|
||||
@ -814,6 +818,7 @@ Call::Call(Clock* clock,
|
||||
RTC_DCHECK(worker_thread_->IsCurrent());
|
||||
|
||||
send_transport_sequence_checker_.Detach();
|
||||
sent_packet_sequence_checker_.Detach();
|
||||
|
||||
// Do not remove this call; it is here to convince the compiler that the
|
||||
// WebRTC source timestamp string needs to be in the final binary.
|
||||
@ -1382,6 +1387,19 @@ void Call::OnUpdateSyncGroup(webrtc::AudioReceiveStream& stream,
|
||||
}
|
||||
|
||||
void Call::OnSentPacket(const rtc::SentPacket& sent_packet) {
|
||||
// When bundling is in effect, multiple senders may be sharing the same
|
||||
// transport. It means every |sent_packet| will be multiply notified from
|
||||
// different channels, WebRtcVoiceMediaChannel or WebRtcVideoChannel. Record
|
||||
// |last_sent_packet_| to deduplicate redundant notifications to downstream
|
||||
// objects.
|
||||
RTC_DCHECK_RUN_ON(&sent_packet_sequence_checker_);
|
||||
if (last_sent_packet_.has_value() &&
|
||||
last_sent_packet_->packet_id == sent_packet.packet_id &&
|
||||
last_sent_packet_->send_time_ms == sent_packet.send_time_ms) {
|
||||
return;
|
||||
}
|
||||
last_sent_packet_ = sent_packet;
|
||||
|
||||
// In production and with most tests, this method will be called on the
|
||||
// network thread. However some test classes such as DirectTransport don't
|
||||
// incorporate a network thread. This means that tests for RtpSenderEgress
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user