diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc index 5c88e01c13..24f6fe1abb 100644 --- a/audio/audio_send_stream.cc +++ b/audio/audio_send_stream.cc @@ -434,6 +434,8 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats( stats.apm_statistics = audio_state_->audio_processing()->GetStatistics(has_remote_tracks); + stats.report_block_datas = std::move(call_stats.report_block_datas); + return stats; } diff --git a/audio/channel_send.cc b/audio/channel_send.cc index 38e89d8e3d..793a7dd263 100644 --- a/audio/channel_send.cc +++ b/audio/channel_send.cc @@ -1079,6 +1079,7 @@ CallSendStatistics ChannelSend::GetRTCPStatistics() const { stats.packetsSent = rtp_stats.transmitted.packets + rtx_stats.transmitted.packets; stats.retransmitted_packets_sent = rtp_stats.retransmitted.packets; + stats.report_block_datas = _rtpRtcpModule->GetLatestReportBlockData(); return stats; } diff --git a/audio/channel_send.h b/audio/channel_send.h index fb98be3c55..2762f5360b 100644 --- a/audio/channel_send.h +++ b/audio/channel_send.h @@ -22,6 +22,7 @@ #include "api/media_transport_config.h" #include "api/media_transport_interface.h" #include "api/task_queue/task_queue_factory.h" +#include "modules/rtp_rtcp/include/report_block_data.h" #include "modules/rtp_rtcp/include/rtp_rtcp.h" #include "modules/rtp_rtcp/source/rtp_sender_audio.h" @@ -41,6 +42,11 @@ struct CallSendStatistics { int packetsSent; // https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedpacketssent uint64_t retransmitted_packets_sent; + // A snapshot of Report Blocks with additional data of interest to statistics. + // Within this list, the sender-source SSRC pair is unique and per-pair the + // ReportBlockData represents the latest Report Block that was received for + // that pair. + std::vector report_block_datas; }; // See section 6.4.2 in http://www.ietf.org/rfc/rfc3550.txt for details. diff --git a/call/BUILD.gn b/call/BUILD.gn index 64cba5079b..1696478ded 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -44,6 +44,7 @@ rtc_source_set("call_interfaces") { "../modules/audio_processing", "../modules/audio_processing:api", "../modules/audio_processing:audio_processing_statistics", + "../modules/rtp_rtcp:rtp_rtcp_format", "../modules/utility", "../rtc_base", "../rtc_base:audio_format_to_string", diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h index b21b2ef342..d8fdddb764 100644 --- a/call/audio_send_stream.h +++ b/call/audio_send_stream.h @@ -29,6 +29,7 @@ #include "api/scoped_refptr.h" #include "call/rtp_config.h" #include "modules/audio_processing/include/audio_processing_statistics.h" +#include "modules/rtp_rtcp/include/report_block_data.h" namespace webrtc { @@ -66,6 +67,11 @@ class AudioSendStream { AudioProcessingStats apm_statistics; int64_t target_bitrate_bps = 0; + // A snapshot of Report Blocks with additional data of interest to + // statistics. Within this list, the sender-source SSRC pair is unique and + // per-pair the ReportBlockData represents the latest Report Block that was + // received for that pair. + std::vector report_block_datas; }; struct Config { diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc index 435b3abad0..55a2826ca9 100644 --- a/media/engine/webrtc_voice_engine.cc +++ b/media/engine/webrtc_voice_engine.cc @@ -2215,6 +2215,7 @@ bool WebRtcVoiceMediaChannel::GetStats(VoiceMediaInfo* info) { sinfo.typing_noise_detected = (send_ ? stats.typing_noise_detected : false); sinfo.ana_statistics = stats.ana_statistics; sinfo.apm_statistics = stats.apm_statistics; + sinfo.report_block_datas = std::move(stats.report_block_datas); info->senders.push_back(sinfo); } diff --git a/modules/rtp_rtcp/include/rtp_rtcp.h b/modules/rtp_rtcp/include/rtp_rtcp.h index 216f758d63..22de74ef57 100644 --- a/modules/rtp_rtcp/include/rtp_rtcp.h +++ b/modules/rtp_rtcp/include/rtp_rtcp.h @@ -350,8 +350,15 @@ class RtpRtcp : public Module, public RtcpFeedbackSenderInterface { // Returns received RTCP report block. // Returns -1 on failure else 0. + // TODO(https://crbug.com/webrtc/10678): Remove this in favor of + // GetLatestReportBlockData(). virtual int32_t RemoteRTCPStat( std::vector* receive_blocks) const = 0; + // A snapshot of Report Blocks with additional data of interest to statistics. + // Within this list, the sender-source SSRC pair is unique and per-pair the + // ReportBlockData represents the latest Report Block that was received for + // that pair. + virtual std::vector GetLatestReportBlockData() const = 0; // (APP) Sets application specific data. // Returns -1 on failure else 0. diff --git a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h index eaad03d9a6..b1ec2ca728 100644 --- a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h +++ b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h @@ -126,6 +126,7 @@ class MockRtpRtcp : public RtpRtcp { void(bool, uint32_t, struct RtpPacketLossStats*)); MOCK_CONST_METHOD1(RemoteRTCPStat, int32_t(std::vector* receive_blocks)); + MOCK_CONST_METHOD0(GetLatestReportBlockData, std::vector()); MOCK_METHOD4(SetRTCPApplicationSpecificData, int32_t(uint8_t sub_type, uint32_t name, diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 1d7f048e4b..4855775beb 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -589,6 +589,11 @@ int32_t ModuleRtpRtcpImpl::RemoteRTCPStat( return rtcp_receiver_.StatisticsReceived(receive_blocks); } +std::vector ModuleRtpRtcpImpl::GetLatestReportBlockData() + const { + return rtcp_receiver_.GetLatestReportBlockData(); +} + // (REMB) Receiver Estimated Max Bitrate. void ModuleRtpRtcpImpl::SetRemb(int64_t bitrate_bps, std::vector ssrcs) { diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h index 71a856cfe5..286a8af5fd 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -200,6 +200,11 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp { // Get received RTCP report, report block. int32_t RemoteRTCPStat( std::vector* receive_blocks) const override; + // A snapshot of the most recent Report Block with additional data of + // interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats. + // Within this list, the ReportBlockData::RTCPReportBlock::source_ssrc(), + // which is the SSRC of the corresponding outbound RTP stream, is unique. + std::vector GetLatestReportBlockData() const override; // (REMB) Receiver Estimated Max Bitrate. void SetRemb(int64_t bitrate_bps, std::vector ssrcs) override;