Bug 1595479 - Add RtcpEventObserver to RtcpReceiver; r=ng

Differential Revision: https://phabricator.services.mozilla.com/D57858

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dan Minor 2019-12-20 20:53:19 +00:00
Родитель 8ef8e3598b
Коммит f3e464071c
5 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -68,6 +68,9 @@ class RtpRtcp : public Module {
// stream.
RtcpBandwidthObserver* bandwidth_callback = nullptr;
// Called when we receive a RTCP bye or timeout
RtcpEventObserver* event_callback = nullptr;
TransportFeedbackObserver* transport_feedback_callback = nullptr;
VideoBitrateAllocationObserver* bitrate_allocation_observer = nullptr;
RtcpRttStats* rtt_stats = nullptr;

Просмотреть файл

@ -286,6 +286,14 @@ class RtcpBandwidthObserver {
virtual ~RtcpBandwidthObserver() {}
};
class RtcpEventObserver {
public:
virtual void OnRtcpBye() = 0;
virtual void OnRtcpTimeout() = 0;
virtual ~RtcpEventObserver() {}
};
struct PacketFeedback {
PacketFeedback(int64_t arrival_time_ms, uint16_t sequence_number)
: PacketFeedback(-1,

Просмотреть файл

@ -109,6 +109,7 @@ RTCPReceiver::RTCPReceiver(
bool receiver_only,
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcpBandwidthObserver* rtcp_bandwidth_observer,
RtcpEventObserver* rtcp_event_observer,
RtcpIntraFrameObserver* rtcp_intra_frame_observer,
TransportFeedbackObserver* transport_feedback_observer,
VideoBitrateAllocationObserver* bitrate_allocation_observer,
@ -117,6 +118,7 @@ RTCPReceiver::RTCPReceiver(
receiver_only_(receiver_only),
rtp_rtcp_(owner),
rtcp_bandwidth_observer_(rtcp_bandwidth_observer),
rtcp_event_observer_(rtcp_event_observer),
rtcp_intra_frame_observer_(rtcp_intra_frame_observer),
transport_feedback_observer_(transport_feedback_observer),
bitrate_allocation_observer_(bitrate_allocation_observer),
@ -555,6 +557,9 @@ bool RTCPReceiver::RtcpRrTimeout(int64_t rtcp_interval_ms) {
if (clock_->TimeInMilliseconds() > last_received_rb_ms_ + time_out_ms) {
// Reset the timer to only trigger one log.
last_received_rb_ms_ = 0;
if (rtcp_event_observer_) {
rtcp_event_observer_->OnRtcpTimeout();
}
return true;
}
return false;
@ -570,6 +575,9 @@ bool RTCPReceiver::RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms) {
last_increased_sequence_number_ms_ + time_out_ms) {
// Reset the timer to only trigger one log.
last_increased_sequence_number_ms_ = 0;
if (rtcp_event_observer_) {
rtcp_event_observer_->OnRtcpTimeout();
}
return true;
}
return false;
@ -674,6 +682,10 @@ void RTCPReceiver::HandleBye(const CommonHeader& rtcp_block) {
return;
}
if (rtcp_event_observer_) {
rtcp_event_observer_->OnRtcpBye();
}
// Clear our lists.
for (auto& reports_per_receiver : received_report_blocks_)
reports_per_receiver.second.erase(bye.sender_ssrc());

Просмотреть файл

@ -58,6 +58,7 @@ class RTCPReceiver {
bool receiver_only,
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcpBandwidthObserver* rtcp_bandwidth_observer,
RtcpEventObserver* rtcp_event_observer,
RtcpIntraFrameObserver* rtcp_intra_frame_observer,
TransportFeedbackObserver* transport_feedback_observer,
VideoBitrateAllocationObserver* bitrate_allocation_observer,
@ -220,6 +221,7 @@ class RTCPReceiver {
rtc::CriticalSection feedbacks_lock_;
RtcpBandwidthObserver* const rtcp_bandwidth_observer_;
RtcpEventObserver* const rtcp_event_observer_;
RtcpIntraFrameObserver* const rtcp_intra_frame_observer_;
TransportFeedbackObserver* const transport_feedback_observer_;
VideoBitrateAllocationObserver* const bitrate_allocation_observer_;

Просмотреть файл

@ -98,6 +98,7 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
configuration.receiver_only,
configuration.rtcp_packet_type_counter_observer,
configuration.bandwidth_callback,
configuration.event_callback,
configuration.intra_frame_callback,
configuration.transport_feedback_callback,
configuration.bitrate_allocation_observer,