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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 2863123002: Wire up BWE stats through WebrtcSession so that they are filled in both for audio and video calls. (Closed)
Patch Set: Comments addressed, generalized InvokeOnWorker(). Created 3 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 if (last_stats_log_ms_ == -1 || 1335 if (last_stats_log_ms_ == -1 ||
1336 now_ms - last_stats_log_ms_ > kStatsLogIntervalMs) { 1336 now_ms - last_stats_log_ms_ > kStatsLogIntervalMs) {
1337 last_stats_log_ms_ = now_ms; 1337 last_stats_log_ms_ = now_ms;
1338 log_stats = true; 1338 log_stats = true;
1339 } 1339 }
1340 1340
1341 info->Clear(); 1341 info->Clear();
1342 FillSenderStats(info, log_stats); 1342 FillSenderStats(info, log_stats);
1343 FillReceiverStats(info, log_stats); 1343 FillReceiverStats(info, log_stats);
1344 FillSendAndReceiveCodecStats(info); 1344 FillSendAndReceiveCodecStats(info);
1345 // TODO(holmer): We should either have rtt available as a metric on
1346 // VideoSend/ReceiveStreams, or we should remove rtt from VideoSenderInfo.
1345 webrtc::Call::Stats stats = call_->GetStats(); 1347 webrtc::Call::Stats stats = call_->GetStats();
hbos 2017/05/09 12:48:14 What are these stats, which contain send/recv_band
holmer 2017/05/30 14:44:28 The only reason I have to call Call::GetStats() is
hbos 2017/05/31 14:31:58 Here call_->GetStats() is invoked from WebRtcVideo
stefan-webrtc 2017/05/31 16:48:03 Ideally we should probably call Call::GetStats on
1346 FillBandwidthEstimationStats(stats, info);
1347 if (stats.rtt_ms != -1) { 1348 if (stats.rtt_ms != -1) {
1348 for (size_t i = 0; i < info->senders.size(); ++i) { 1349 for (size_t i = 0; i < info->senders.size(); ++i) {
1349 info->senders[i].rtt_ms = stats.rtt_ms; 1350 info->senders[i].rtt_ms = stats.rtt_ms;
1350 } 1351 }
1351 } 1352 }
1352 1353
1353 if (log_stats) 1354 if (log_stats)
1354 LOG(LS_INFO) << stats.ToString(now_ms); 1355 LOG(LS_INFO) << stats.ToString(now_ms);
1355 1356
1356 return true; 1357 return true;
(...skipping 14 matching lines...) Expand all
1371 bool log_stats) { 1372 bool log_stats) {
1372 rtc::CritScope stream_lock(&stream_crit_); 1373 rtc::CritScope stream_lock(&stream_crit_);
1373 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = 1374 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it =
1374 receive_streams_.begin(); 1375 receive_streams_.begin();
1375 it != receive_streams_.end(); ++it) { 1376 it != receive_streams_.end(); ++it) {
1376 video_media_info->receivers.push_back( 1377 video_media_info->receivers.push_back(
1377 it->second->GetVideoReceiverInfo(log_stats)); 1378 it->second->GetVideoReceiverInfo(log_stats));
1378 } 1379 }
1379 } 1380 }
1380 1381
1381 void WebRtcVideoChannel2::FillBandwidthEstimationStats( 1382 void WebRtcVideoChannel2::FillBitrateInfo(BandwidthEstimationInfo* bwe_info) {
hbos 2017/05/09 12:48:13 nit: Do we still have a need for a bwe pointer or
holmer 2017/05/30 14:44:28 We could, but it'd require that we copy the Bandwi
hbos 2017/05/31 14:31:58 Acknowledged.
1382 const webrtc::Call::Stats& stats,
1383 VideoMediaInfo* video_media_info) {
1384 BandwidthEstimationInfo bwe_info;
1385 bwe_info.available_send_bandwidth = stats.send_bandwidth_bps;
1386 bwe_info.available_recv_bandwidth = stats.recv_bandwidth_bps;
1387 bwe_info.bucket_delay = stats.pacer_delay_ms;
1388
1389 // Get send stream bitrate stats.
1390 rtc::CritScope stream_lock(&stream_crit_); 1383 rtc::CritScope stream_lock(&stream_crit_);
1391 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = 1384 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream =
1392 send_streams_.begin(); 1385 send_streams_.begin();
1393 stream != send_streams_.end(); ++stream) { 1386 stream != send_streams_.end(); ++stream) {
1394 stream->second->FillBandwidthEstimationInfo(&bwe_info); 1387 stream->second->FillBitrateInfo(bwe_info);
1395 } 1388 }
1396 video_media_info->bw_estimations.push_back(bwe_info);
1397 } 1389 }
1398 1390
1399 void WebRtcVideoChannel2::FillSendAndReceiveCodecStats( 1391 void WebRtcVideoChannel2::FillSendAndReceiveCodecStats(
1400 VideoMediaInfo* video_media_info) { 1392 VideoMediaInfo* video_media_info) {
1401 for (const VideoCodec& codec : send_params_.codecs) { 1393 for (const VideoCodec& codec : send_params_.codecs) {
1402 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); 1394 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters();
1403 video_media_info->send_codecs.insert( 1395 video_media_info->send_codecs.insert(
1404 std::make_pair(codec_params.payload_type, std::move(codec_params))); 1396 std::make_pair(codec_params.payload_type, std::move(codec_params)));
1405 } 1397 }
1406 for (const VideoCodec& codec : recv_params_.codecs) { 1398 for (const VideoCodec& codec : recv_params_.codecs) {
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 webrtc::VideoSendStream::StreamStats first_stream_stats = 2085 webrtc::VideoSendStream::StreamStats first_stream_stats =
2094 stats.substreams.begin()->second; 2086 stats.substreams.begin()->second;
2095 info.fraction_lost = 2087 info.fraction_lost =
2096 static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) / 2088 static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) /
2097 (1 << 8); 2089 (1 << 8);
2098 } 2090 }
2099 2091
2100 return info; 2092 return info;
2101 } 2093 }
2102 2094
2103 void WebRtcVideoChannel2::WebRtcVideoSendStream::FillBandwidthEstimationInfo( 2095 void WebRtcVideoChannel2::WebRtcVideoSendStream::FillBitrateInfo(
2104 BandwidthEstimationInfo* bwe_info) { 2096 BandwidthEstimationInfo* bwe_info) {
2105 RTC_DCHECK_RUN_ON(&thread_checker_); 2097 RTC_DCHECK_RUN_ON(&thread_checker_);
2106 if (stream_ == NULL) { 2098 if (stream_ == NULL) {
2107 return; 2099 return;
2108 } 2100 }
2109 webrtc::VideoSendStream::Stats stats = stream_->GetStats(); 2101 webrtc::VideoSendStream::Stats stats = stream_->GetStats();
2110 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = 2102 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it =
2111 stats.substreams.begin(); 2103 stats.substreams.begin();
2112 it != stats.substreams.end(); ++it) { 2104 it != stats.substreams.end(); ++it) {
2113 bwe_info->transmit_bitrate += it->second.total_bitrate_bps; 2105 bwe_info->transmit_bitrate += it->second.total_bitrate_bps;
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 rtx_mapping[video_codecs[i].codec.id] != 2591 rtx_mapping[video_codecs[i].codec.id] !=
2600 ulpfec_config.red_payload_type) { 2592 ulpfec_config.red_payload_type) {
2601 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2593 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2602 } 2594 }
2603 } 2595 }
2604 2596
2605 return video_codecs; 2597 return video_codecs;
2606 } 2598 }
2607 2599
2608 } // namespace cricket 2600 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698