Index: webrtc/pc/rtcstatscollector.cc |
diff --git a/webrtc/pc/rtcstatscollector.cc b/webrtc/pc/rtcstatscollector.cc |
index 6344d87c105d8a7dd3c0334315c00be85d09acb0..e35731fb9bfec59854c71d2f7f73901a5545a184 100644 |
--- a/webrtc/pc/rtcstatscollector.cc |
+++ b/webrtc/pc/rtcstatscollector.cc |
@@ -36,10 +36,11 @@ std::string RTCCertificateIDFromFingerprint(const std::string& fingerprint) { |
std::string RTCCodecStatsIDFromDirectionMediaAndPayload( |
bool inbound, bool audio, uint32_t payload_type) { |
- // TODO(hbos): When we are able to handle multiple m= lines of the same media |
- // type (and multiple BaseChannels for the same type is possible?) this needs |
- // to be updated to differentiate the transport being used, and stats need to |
- // be collected for all of them. crbug.com/659117 |
+ // TODO(hbos): The present codec ID assignment is not sufficient to support |
+ // Unified Plan or unbundled connections in all cases. When we are able to |
+ // handle multiple m= lines of the same media type (and multiple BaseChannels |
+ // for the same type is possible?) this needs to be updated to differentiate |
+ // the transport being used, and stats need to be collected for all of them. |
if (inbound) { |
return audio ? "RTCCodec_InboundAudio_" + rtc::ToString<>(payload_type) |
: "RTCCodec_InboundVideo_" + rtc::ToString<>(payload_type); |
@@ -195,8 +196,6 @@ void SetInboundRTPStreamStatsFromMediaReceiverInfo( |
inbound_stats->ssrc = rtc::ToString<>(media_receiver_info.ssrc()); |
// TODO(hbos): Support the remote case. crbug.com/657855 |
inbound_stats->is_remote = false; |
- // TODO(hbos): Set |codec_id| when we have |RTCCodecStats|. Maybe relevant: |
- // |media_receiver_info.codec_name|. crbug.com/657854, 657855, 659117 |
hbos
2017/02/03 15:18:32
This is an old TODO that has already been resolved
|
inbound_stats->packets_received = |
static_cast<uint32_t>(media_receiver_info.packets_rcvd); |
inbound_stats->bytes_received = |
@@ -213,6 +212,11 @@ void SetInboundRTPStreamStatsFromVoiceReceiverInfo( |
SetInboundRTPStreamStatsFromMediaReceiverInfo( |
voice_receiver_info, inbound_audio); |
inbound_audio->media_type = "audio"; |
+ if (voice_receiver_info.codec_payload_type) { |
+ inbound_audio->codec_id = |
+ RTCCodecStatsIDFromDirectionMediaAndPayload( |
+ true, true, *voice_receiver_info.codec_payload_type); |
+ } |
hbos
2017/02/03 15:18:32
The refactoring was to move this to here. Previous
|
inbound_audio->jitter = |
static_cast<double>(voice_receiver_info.jitter_ms) / |
rtc::kNumMillisecsPerSec; |
@@ -226,6 +230,11 @@ void SetInboundRTPStreamStatsFromVideoReceiverInfo( |
SetInboundRTPStreamStatsFromMediaReceiverInfo( |
video_receiver_info, inbound_video); |
inbound_video->media_type = "video"; |
+ if (video_receiver_info.codec_payload_type) { |
+ inbound_video->codec_id = |
+ RTCCodecStatsIDFromDirectionMediaAndPayload( |
+ true, false, *video_receiver_info.codec_payload_type); |
+ } |
inbound_video->fir_count = |
static_cast<uint32_t>(video_receiver_info.firs_sent); |
inbound_video->pli_count = |
@@ -243,8 +252,6 @@ void SetOutboundRTPStreamStatsFromMediaSenderInfo( |
outbound_stats->ssrc = rtc::ToString<>(media_sender_info.ssrc()); |
// TODO(hbos): Support the remote case. crbug.com/657856 |
outbound_stats->is_remote = false; |
- // TODO(hbos): Set |codec_id| when we have |RTCCodecStats|. Maybe relevant: |
- // |media_sender_info.codec_name|. crbug.com/657854, 657856, 659117 |
outbound_stats->packets_sent = |
static_cast<uint32_t>(media_sender_info.packets_sent); |
outbound_stats->bytes_sent = |
@@ -261,6 +268,11 @@ void SetOutboundRTPStreamStatsFromVoiceSenderInfo( |
SetOutboundRTPStreamStatsFromMediaSenderInfo( |
voice_sender_info, outbound_audio); |
outbound_audio->media_type = "audio"; |
+ if (voice_sender_info.codec_payload_type) { |
+ outbound_audio->codec_id = |
+ RTCCodecStatsIDFromDirectionMediaAndPayload( |
+ false, true, *voice_sender_info.codec_payload_type); |
+ } |
// |fir_count|, |pli_count| and |sli_count| are only valid for video and are |
// purposefully left undefined for audio. |
} |
@@ -271,6 +283,11 @@ void SetOutboundRTPStreamStatsFromVideoSenderInfo( |
SetOutboundRTPStreamStatsFromMediaSenderInfo( |
video_sender_info, outbound_video); |
outbound_video->media_type = "video"; |
+ if (video_sender_info.codec_payload_type) { |
+ outbound_video->codec_id = |
+ RTCCodecStatsIDFromDirectionMediaAndPayload( |
+ false, false, *video_sender_info.codec_payload_type); |
+ } |
outbound_video->fir_count = |
static_cast<uint32_t>(video_sender_info.firs_rcvd); |
outbound_video->pli_count = |
@@ -938,11 +955,6 @@ void RTCStatsCollector::ProduceRTPStreamStats_n( |
voice_receiver_info.ssrc()); |
} |
inbound_audio->transport_id = transport_id; |
- if (voice_receiver_info.codec_payload_type) { |
- inbound_audio->codec_id = |
- RTCCodecStatsIDFromDirectionMediaAndPayload( |
- true, true, *voice_receiver_info.codec_payload_type); |
- } |
report->AddStats(std::move(inbound_audio)); |
} |
// Outbound |
@@ -971,11 +983,6 @@ void RTCStatsCollector::ProduceRTPStreamStats_n( |
voice_sender_info.ssrc()); |
} |
outbound_audio->transport_id = transport_id; |
- if (voice_sender_info.codec_payload_type) { |
- outbound_audio->codec_id = |
- RTCCodecStatsIDFromDirectionMediaAndPayload( |
- false, true, *voice_sender_info.codec_payload_type); |
- } |
report->AddStats(std::move(outbound_audio)); |
} |
} |
@@ -1010,11 +1017,6 @@ void RTCStatsCollector::ProduceRTPStreamStats_n( |
video_receiver_info.ssrc()); |
} |
inbound_video->transport_id = transport_id; |
- if (video_receiver_info.codec_payload_type) { |
- inbound_video->codec_id = |
- RTCCodecStatsIDFromDirectionMediaAndPayload( |
- true, false, *video_receiver_info.codec_payload_type); |
- } |
report->AddStats(std::move(inbound_video)); |
} |
// Outbound |
@@ -1043,11 +1045,6 @@ void RTCStatsCollector::ProduceRTPStreamStats_n( |
video_sender_info.ssrc()); |
} |
outbound_video->transport_id = transport_id; |
- if (video_sender_info.codec_payload_type) { |
- outbound_video->codec_id = |
- RTCCodecStatsIDFromDirectionMediaAndPayload( |
- false, false, *video_sender_info.codec_payload_type); |
- } |
report->AddStats(std::move(outbound_video)); |
} |
} |