Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: webrtc/api/rtcstatscollector.cc

Issue 2515293002: RTCInboundRTPStreamStats's [fir/pli/nack]_count are collected for video. (Closed)
Patch Set: Added comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/api/rtcstatscollector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 } 101 }
102 102
103 void SetMediaStreamTrackStatsFromMediaStreamTrackInterface( 103 void SetMediaStreamTrackStatsFromMediaStreamTrackInterface(
104 const MediaStreamTrackInterface& track, 104 const MediaStreamTrackInterface& track,
105 RTCMediaStreamTrackStats* track_stats) { 105 RTCMediaStreamTrackStats* track_stats) {
106 track_stats->track_identifier = track.id(); 106 track_stats->track_identifier = track.id();
107 track_stats->ended = (track.state() == MediaStreamTrackInterface::kEnded); 107 track_stats->ended = (track.state() == MediaStreamTrackInterface::kEnded);
108 } 108 }
109 109
110 // Provides the media independent counters (both audio and video).
110 void SetInboundRTPStreamStatsFromMediaReceiverInfo( 111 void SetInboundRTPStreamStatsFromMediaReceiverInfo(
111 const cricket::MediaReceiverInfo& media_receiver_info, 112 const cricket::MediaReceiverInfo& media_receiver_info,
112 RTCInboundRTPStreamStats* inbound_stats) { 113 RTCInboundRTPStreamStats* inbound_stats) {
113 RTC_DCHECK(inbound_stats); 114 RTC_DCHECK(inbound_stats);
114 inbound_stats->ssrc = rtc::ToString<>(media_receiver_info.ssrc()); 115 inbound_stats->ssrc = rtc::ToString<>(media_receiver_info.ssrc());
115 // TODO(hbos): Support the remote case. crbug.com/657855 116 // TODO(hbos): Support the remote case. crbug.com/657855
116 inbound_stats->is_remote = false; 117 inbound_stats->is_remote = false;
117 // TODO(hbos): Set |codec_id| when we have |RTCCodecStats|. Maybe relevant: 118 // TODO(hbos): Set |codec_id| when we have |RTCCodecStats|. Maybe relevant:
118 // |media_receiver_info.codec_name|. crbug.com/657854, 657855, 659117 119 // |media_receiver_info.codec_name|. crbug.com/657854, 657855, 659117
119 inbound_stats->packets_received = 120 inbound_stats->packets_received =
120 static_cast<uint32_t>(media_receiver_info.packets_rcvd); 121 static_cast<uint32_t>(media_receiver_info.packets_rcvd);
121 inbound_stats->bytes_received = 122 inbound_stats->bytes_received =
122 static_cast<uint64_t>(media_receiver_info.bytes_rcvd); 123 static_cast<uint64_t>(media_receiver_info.bytes_rcvd);
123 inbound_stats->fraction_lost = 124 inbound_stats->fraction_lost =
124 static_cast<double>(media_receiver_info.fraction_lost); 125 static_cast<double>(media_receiver_info.fraction_lost);
125 } 126 }
126 127
127 void SetInboundRTPStreamStatsFromVoiceReceiverInfo( 128 void SetInboundRTPStreamStatsFromVoiceReceiverInfo(
128 const cricket::VoiceReceiverInfo& voice_receiver_info, 129 const cricket::VoiceReceiverInfo& voice_receiver_info,
129 RTCInboundRTPStreamStats* inbound_stats) { 130 RTCInboundRTPStreamStats* inbound_audio) {
130 SetInboundRTPStreamStatsFromMediaReceiverInfo( 131 SetInboundRTPStreamStatsFromMediaReceiverInfo(
131 voice_receiver_info, inbound_stats); 132 voice_receiver_info, inbound_audio);
132 inbound_stats->media_type = "audio"; 133 inbound_audio->media_type = "audio";
133 inbound_stats->jitter = 134 inbound_audio->jitter =
134 static_cast<double>(voice_receiver_info.jitter_ms) / 135 static_cast<double>(voice_receiver_info.jitter_ms) /
135 rtc::kNumMillisecsPerSec; 136 rtc::kNumMillisecsPerSec;
137 // |fir_count|, |pli_count| and |sli_count| are only valid for video and are
138 // purposefully left undefined for audio.
136 } 139 }
137 140
138 void SetInboundRTPStreamStatsFromVideoReceiverInfo( 141 void SetInboundRTPStreamStatsFromVideoReceiverInfo(
139 const cricket::VideoReceiverInfo& video_receiver_info, 142 const cricket::VideoReceiverInfo& video_receiver_info,
140 RTCInboundRTPStreamStats* inbound_stats) { 143 RTCInboundRTPStreamStats* inbound_video) {
141 SetInboundRTPStreamStatsFromMediaReceiverInfo( 144 SetInboundRTPStreamStatsFromMediaReceiverInfo(
142 video_receiver_info, inbound_stats); 145 video_receiver_info, inbound_video);
143 inbound_stats->media_type = "video"; 146 inbound_video->media_type = "video";
147 inbound_video->fir_count =
148 static_cast<uint32_t>(video_receiver_info.firs_sent);
149 inbound_video->pli_count =
150 static_cast<uint32_t>(video_receiver_info.plis_sent);
151 inbound_video->nack_count =
152 static_cast<uint32_t>(video_receiver_info.nacks_sent);
144 } 153 }
145 154
155 // Provides the media independent counters (both audio and video).
146 void SetOutboundRTPStreamStatsFromMediaSenderInfo( 156 void SetOutboundRTPStreamStatsFromMediaSenderInfo(
147 const cricket::MediaSenderInfo& media_sender_info, 157 const cricket::MediaSenderInfo& media_sender_info,
148 RTCOutboundRTPStreamStats* outbound_stats) { 158 RTCOutboundRTPStreamStats* outbound_stats) {
149 RTC_DCHECK(outbound_stats); 159 RTC_DCHECK(outbound_stats);
150 outbound_stats->ssrc = rtc::ToString<>(media_sender_info.ssrc()); 160 outbound_stats->ssrc = rtc::ToString<>(media_sender_info.ssrc());
151 // TODO(hbos): Support the remote case. crbug.com/657856 161 // TODO(hbos): Support the remote case. crbug.com/657856
152 outbound_stats->is_remote = false; 162 outbound_stats->is_remote = false;
153 // TODO(hbos): Set |codec_id| when we have |RTCCodecStats|. Maybe relevant: 163 // TODO(hbos): Set |codec_id| when we have |RTCCodecStats|. Maybe relevant:
154 // |media_sender_info.codec_name|. crbug.com/657854, 657856, 659117 164 // |media_sender_info.codec_name|. crbug.com/657854, 657856, 659117
155 outbound_stats->packets_sent = 165 outbound_stats->packets_sent =
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 const std::string& type) { 813 const std::string& type) {
804 return CandidateTypeToRTCIceCandidateType(type); 814 return CandidateTypeToRTCIceCandidateType(type);
805 } 815 }
806 816
807 const char* DataStateToRTCDataChannelStateForTesting( 817 const char* DataStateToRTCDataChannelStateForTesting(
808 DataChannelInterface::DataState state) { 818 DataChannelInterface::DataState state) {
809 return DataStateToRTCDataChannelState(state); 819 return DataStateToRTCDataChannelState(state);
810 } 820 }
811 821
812 } // namespace webrtc 822 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/rtcstatscollector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698