ModuleRtpRtcpImpl2: remove RTCP send polling.

This change migrates RTCP send polling happening in
ModuleRtpRtcpImpl2::Process to task queues.

ModuleRtpRtcpImpl2 would previously only cause RTCP sends while being
registered with a ProcessThread. This is now relaxed so that RTCP will
be sent regardless of ProcessThread registration status, and it seems
no tests cared.

Now there's only one piece of polling left in Process.

Bug: webrtc:11581
Change-Id: Ibdcffefccef7363f2089c34a9c7d694d222445c0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222603
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34350}
This commit is contained in:
Markus Handell
2021-06-21 18:57:36 +02:00
committed by WebRTC LUCI CQ
parent 20862093e5
commit 885d538cdd
6 changed files with 180 additions and 33 deletions

View File

@ -23,6 +23,7 @@
#include "api/rtp_headers.h"
#include "api/sequence_checker.h"
#include "api/task_queue/task_queue_base.h"
#include "api/units/time_delta.h"
#include "api/video/video_bitrate_allocation.h"
#include "modules/include/module_fec_types.h"
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
@ -32,7 +33,6 @@
#include "modules/rtp_rtcp/source/rtcp_sender.h"
#include "modules/rtp_rtcp/source/rtp_packet_history.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h"
#include "modules/rtp_rtcp/source/rtp_sender.h"
#include "modules/rtp_rtcp/source/rtp_sender_egress.h"
#include "rtc_base/gtest_prod_util.h"
@ -40,6 +40,8 @@
#include "rtc_base/system/no_unique_address.h"
#include "rtc_base/task_utils/pending_task_safety_flag.h"
#include "rtc_base/task_utils/repeating_task.h"
#include "rtc_base/task_utils/to_queued_task.h"
#include "rtc_base/thread_annotations.h"
namespace webrtc {
@ -200,7 +202,8 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
int64_t ExpectedRetransmissionTimeMs() const override;
// Force a send of an RTCP packet.
// Normal SR and RR are triggered via the process function.
// Normal SR and RR are triggered via the task queue that's current when this
// object is created.
int32_t SendRTCP(RTCPPacketType rtcpPacketType) override;
void GetSendStreamDataCounters(
@ -289,12 +292,28 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
// Returns true if the module is configured to store packets.
bool StorePackets() const;
// Used from RtcpSenderMediator to maybe send rtcp.
void MaybeSendRtcp() RTC_RUN_ON(worker_queue_);
// Called when |rtcp_sender_| informs of the next RTCP instant. The method may
// be called on various sequences, and is called under a RTCPSenderLock.
void ScheduleRtcpSendEvaluation(TimeDelta duration);
// Helper method combating too early delayed calls from task queues.
// TODO(bugs.webrtc.org/12889): Consider removing this function when the issue
// is resolved.
void MaybeSendRtcpAtOrAfterTimestamp(Timestamp execution_time)
RTC_RUN_ON(worker_queue_);
// Schedules a call to MaybeSendRtcpAtOrAfterTimestamp delayed by |duration|.
void ScheduleMaybeSendRtcpAtOrAfterTimestamp(Timestamp execution_time,
TimeDelta duration);
TaskQueueBase* const worker_queue_;
RTC_NO_UNIQUE_ADDRESS SequenceChecker process_thread_checker_;
RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_sequence_checker_;
std::unique_ptr<RtpSenderContext> rtp_sender_;
RTCPSender rtcp_sender_;
RTCPReceiver rtcp_receiver_;
@ -316,6 +335,8 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
// The processed RTT from RtcpRttStats.
mutable Mutex mutex_rtt_;
int64_t rtt_ms_ RTC_GUARDED_BY(mutex_rtt_);
RTC_NO_UNIQUE_ADDRESS ScopedTaskSafety task_safety_;
};
} // namespace webrtc