[audio] Plumbing of ReportBlockData from RTCPReceiver to MediaSenderInfo

This is part of implementing RTCRemoteInboundRtpStreamStats. The CL was
split up into smaller pieces for reviewability. Spec:
https://w3c.github.io/webrtc-stats/#dom-rtcremoteinboundrtpstreamstats

In [1], ReportBlockData was implemented and tested.
This CL adds the plumbing to make it available in MediaSenderInfo for
audio streams, but the code is not wired up to make use of these stats.

In follow-up CL [2], ReportBlockData will be used to implement
RTCRemoteInboundRtpStreamStats. The follow-up CL will add integration
tests exercising the full code path.

[1] https://webrtc-review.googlesource.com/c/src/+/136584
[2] https://webrtc-review.googlesource.com/c/src/+/138067

Bug: webrtc:10455
Change-Id: Id8940090cc9c121e8f06ccdb068a22ce24c07092
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138066
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28072}
This commit is contained in:
Henrik Boström
2019-05-27 12:19:33 +02:00
committed by Commit Bot
parent 87e3f9d116
commit 6e436d1cc0
10 changed files with 35 additions and 0 deletions

View File

@ -434,6 +434,8 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
stats.apm_statistics = stats.apm_statistics =
audio_state_->audio_processing()->GetStatistics(has_remote_tracks); audio_state_->audio_processing()->GetStatistics(has_remote_tracks);
stats.report_block_datas = std::move(call_stats.report_block_datas);
return stats; return stats;
} }

View File

@ -1079,6 +1079,7 @@ CallSendStatistics ChannelSend::GetRTCPStatistics() const {
stats.packetsSent = stats.packetsSent =
rtp_stats.transmitted.packets + rtx_stats.transmitted.packets; rtp_stats.transmitted.packets + rtx_stats.transmitted.packets;
stats.retransmitted_packets_sent = rtp_stats.retransmitted.packets; stats.retransmitted_packets_sent = rtp_stats.retransmitted.packets;
stats.report_block_datas = _rtpRtcpModule->GetLatestReportBlockData();
return stats; return stats;
} }

View File

@ -22,6 +22,7 @@
#include "api/media_transport_config.h" #include "api/media_transport_config.h"
#include "api/media_transport_interface.h" #include "api/media_transport_interface.h"
#include "api/task_queue/task_queue_factory.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/include/rtp_rtcp.h"
#include "modules/rtp_rtcp/source/rtp_sender_audio.h" #include "modules/rtp_rtcp/source/rtp_sender_audio.h"
@ -41,6 +42,11 @@ struct CallSendStatistics {
int packetsSent; int packetsSent;
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedpacketssent // https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedpacketssent
uint64_t retransmitted_packets_sent; 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<ReportBlockData> report_block_datas;
}; };
// See section 6.4.2 in http://www.ietf.org/rfc/rfc3550.txt for details. // See section 6.4.2 in http://www.ietf.org/rfc/rfc3550.txt for details.

View File

@ -44,6 +44,7 @@ rtc_source_set("call_interfaces") {
"../modules/audio_processing", "../modules/audio_processing",
"../modules/audio_processing:api", "../modules/audio_processing:api",
"../modules/audio_processing:audio_processing_statistics", "../modules/audio_processing:audio_processing_statistics",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../modules/utility", "../modules/utility",
"../rtc_base", "../rtc_base",
"../rtc_base:audio_format_to_string", "../rtc_base:audio_format_to_string",

View File

@ -29,6 +29,7 @@
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "call/rtp_config.h" #include "call/rtp_config.h"
#include "modules/audio_processing/include/audio_processing_statistics.h" #include "modules/audio_processing/include/audio_processing_statistics.h"
#include "modules/rtp_rtcp/include/report_block_data.h"
namespace webrtc { namespace webrtc {
@ -66,6 +67,11 @@ class AudioSendStream {
AudioProcessingStats apm_statistics; AudioProcessingStats apm_statistics;
int64_t target_bitrate_bps = 0; 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<ReportBlockData> report_block_datas;
}; };
struct Config { struct Config {

View File

@ -2215,6 +2215,7 @@ bool WebRtcVoiceMediaChannel::GetStats(VoiceMediaInfo* info) {
sinfo.typing_noise_detected = (send_ ? stats.typing_noise_detected : false); sinfo.typing_noise_detected = (send_ ? stats.typing_noise_detected : false);
sinfo.ana_statistics = stats.ana_statistics; sinfo.ana_statistics = stats.ana_statistics;
sinfo.apm_statistics = stats.apm_statistics; sinfo.apm_statistics = stats.apm_statistics;
sinfo.report_block_datas = std::move(stats.report_block_datas);
info->senders.push_back(sinfo); info->senders.push_back(sinfo);
} }

View File

@ -350,8 +350,15 @@ class RtpRtcp : public Module, public RtcpFeedbackSenderInterface {
// Returns received RTCP report block. // Returns received RTCP report block.
// Returns -1 on failure else 0. // Returns -1 on failure else 0.
// TODO(https://crbug.com/webrtc/10678): Remove this in favor of
// GetLatestReportBlockData().
virtual int32_t RemoteRTCPStat( virtual int32_t RemoteRTCPStat(
std::vector<RTCPReportBlock>* receive_blocks) const = 0; std::vector<RTCPReportBlock>* 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<ReportBlockData> GetLatestReportBlockData() const = 0;
// (APP) Sets application specific data. // (APP) Sets application specific data.
// Returns -1 on failure else 0. // Returns -1 on failure else 0.

View File

@ -126,6 +126,7 @@ class MockRtpRtcp : public RtpRtcp {
void(bool, uint32_t, struct RtpPacketLossStats*)); void(bool, uint32_t, struct RtpPacketLossStats*));
MOCK_CONST_METHOD1(RemoteRTCPStat, MOCK_CONST_METHOD1(RemoteRTCPStat,
int32_t(std::vector<RTCPReportBlock>* receive_blocks)); int32_t(std::vector<RTCPReportBlock>* receive_blocks));
MOCK_CONST_METHOD0(GetLatestReportBlockData, std::vector<ReportBlockData>());
MOCK_METHOD4(SetRTCPApplicationSpecificData, MOCK_METHOD4(SetRTCPApplicationSpecificData,
int32_t(uint8_t sub_type, int32_t(uint8_t sub_type,
uint32_t name, uint32_t name,

View File

@ -589,6 +589,11 @@ int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(
return rtcp_receiver_.StatisticsReceived(receive_blocks); return rtcp_receiver_.StatisticsReceived(receive_blocks);
} }
std::vector<ReportBlockData> ModuleRtpRtcpImpl::GetLatestReportBlockData()
const {
return rtcp_receiver_.GetLatestReportBlockData();
}
// (REMB) Receiver Estimated Max Bitrate. // (REMB) Receiver Estimated Max Bitrate.
void ModuleRtpRtcpImpl::SetRemb(int64_t bitrate_bps, void ModuleRtpRtcpImpl::SetRemb(int64_t bitrate_bps,
std::vector<uint32_t> ssrcs) { std::vector<uint32_t> ssrcs) {

View File

@ -200,6 +200,11 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
// Get received RTCP report, report block. // Get received RTCP report, report block.
int32_t RemoteRTCPStat( int32_t RemoteRTCPStat(
std::vector<RTCPReportBlock>* receive_blocks) const override; std::vector<RTCPReportBlock>* 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<ReportBlockData> GetLatestReportBlockData() const override;
// (REMB) Receiver Estimated Max Bitrate. // (REMB) Receiver Estimated Max Bitrate.
void SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs) override; void SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs) override;