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

Side by Side Diff: webrtc/video/vie_channel.cc

Issue 1734933002: Move RTP stats histograms from VieChannel to SendStatisticsProxy. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Assert diff of RtpPacketCounter is valid Created 4 years, 9 months 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 | « webrtc/video/vie_channel.h ('k') | no next file » | 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 (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 vcm_->RegisterFrameTypeCallback(this); 158 vcm_->RegisterFrameTypeCallback(this);
159 vcm_->RegisterReceiveStatisticsCallback(this); 159 vcm_->RegisterReceiveStatisticsCallback(this);
160 vcm_->RegisterDecoderTimingCallback(this); 160 vcm_->RegisterDecoderTimingCallback(this);
161 vcm_->SetRenderDelay(kDefaultRenderDelayMs); 161 vcm_->SetRenderDelay(kDefaultRenderDelayMs);
162 } 162 }
163 return 0; 163 return 0;
164 } 164 }
165 165
166 ViEChannel::~ViEChannel() { 166 ViEChannel::~ViEChannel() {
167 UpdateHistograms();
168 // Make sure we don't get more callbacks from the RTP module. 167 // Make sure we don't get more callbacks from the RTP module.
169 module_process_thread_->DeRegisterModule( 168 module_process_thread_->DeRegisterModule(
170 vie_receiver_.GetReceiveStatistics()); 169 vie_receiver_.GetReceiveStatistics());
171 if (sender_) { 170 if (sender_) {
172 send_payload_router_->SetSendingRtpModules(std::vector<RtpRtcp*>()); 171 send_payload_router_->SetSendingRtpModules(std::vector<RtpRtcp*>());
173 } 172 }
174 for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i) 173 for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i)
175 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i], sender_); 174 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i], sender_);
176 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 175 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
177 module_process_thread_->DeRegisterModule(rtp_rtcp); 176 module_process_thread_->DeRegisterModule(rtp_rtcp);
178 delete rtp_rtcp; 177 delete rtp_rtcp;
179 } 178 }
180 } 179 }
181 180
182 void ViEChannel::UpdateHistograms() {
183 if (sender_) {
184 StreamDataCounters rtp;
185 StreamDataCounters rtx;
186 GetSendStreamDataCounters(&rtp, &rtx);
187 StreamDataCounters rtp_rtx = rtp;
188 rtp_rtx.Add(rtx);
189 int64_t elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(
190 Clock::GetRealTimeClock()->TimeInMilliseconds()) /
191 1000;
192 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
193 RTC_HISTOGRAM_COUNTS_100000(
194 "WebRTC.Video.BitrateSentInKbps",
195 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
196 1000));
197 RTC_HISTOGRAM_COUNTS_10000(
198 "WebRTC.Video.MediaBitrateSentInKbps",
199 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
200 RTC_HISTOGRAM_COUNTS_10000(
201 "WebRTC.Video.PaddingBitrateSentInKbps",
202 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
203 1000));
204 RTC_HISTOGRAM_COUNTS_10000(
205 "WebRTC.Video.RetransmittedBitrateSentInKbps",
206 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
207 elapsed_sec / 1000));
208 if (rtp_rtcp_modules_[0]->RtxSendStatus() != kRtxOff) {
209 RTC_HISTOGRAM_COUNTS_10000(
210 "WebRTC.Video.RtxBitrateSentInKbps",
211 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
212 1000));
213 }
214 bool fec_enabled = false;
215 uint8_t pltype_red;
216 uint8_t pltype_fec;
217 rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red,
218 &pltype_fec);
219 if (fec_enabled) {
220 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps",
221 static_cast<int>(rtp_rtx.fec.TotalBytes() *
222 8 / elapsed_sec / 1000));
223 }
224 }
225 }
226 }
227
228 int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, 181 int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec,
229 bool new_stream) { 182 bool new_stream) {
230 RTC_DCHECK(sender_); 183 RTC_DCHECK(sender_);
231 if (video_codec.codecType == kVideoCodecRED || 184 if (video_codec.codecType == kVideoCodecRED ||
232 video_codec.codecType == kVideoCodecULPFEC) { 185 video_codec.codecType == kVideoCodecULPFEC) {
233 LOG_F(LS_ERROR) << "Not a valid send codec " << video_codec.codecType; 186 LOG_F(LS_ERROR) << "Not a valid send codec " << video_codec.codecType;
234 return -1; 187 return -1;
235 } 188 }
236 if (kMaxSimulcastStreams < video_codec.numberOfSimulcastStreams) { 189 if (kMaxSimulcastStreams < video_codec.numberOfSimulcastStreams) {
237 LOG_F(LS_ERROR) << "Incorrect config " 190 LOG_F(LS_ERROR) << "Incorrect config "
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 rtc::CritScope lock(&crit_); 682 rtc::CritScope lock(&crit_);
730 receive_stats_callback_ = receive_statistics_proxy; 683 receive_stats_callback_ = receive_statistics_proxy;
731 } 684 }
732 685
733 void ViEChannel::SetIncomingVideoStream( 686 void ViEChannel::SetIncomingVideoStream(
734 IncomingVideoStream* incoming_video_stream) { 687 IncomingVideoStream* incoming_video_stream) {
735 rtc::CritScope lock(&crit_); 688 rtc::CritScope lock(&crit_);
736 incoming_video_stream_ = incoming_video_stream; 689 incoming_video_stream_ = incoming_video_stream;
737 } 690 }
738 } // namespace webrtc 691 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/vie_channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698