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

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." Created 3 years, 6 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 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 if (last_stats_log_ms_ == -1 || 1372 if (last_stats_log_ms_ == -1 ||
1373 now_ms - last_stats_log_ms_ > kStatsLogIntervalMs) { 1373 now_ms - last_stats_log_ms_ > kStatsLogIntervalMs) {
1374 last_stats_log_ms_ = now_ms; 1374 last_stats_log_ms_ = now_ms;
1375 log_stats = true; 1375 log_stats = true;
1376 } 1376 }
1377 1377
1378 info->Clear(); 1378 info->Clear();
1379 FillSenderStats(info, log_stats); 1379 FillSenderStats(info, log_stats);
1380 FillReceiverStats(info, log_stats); 1380 FillReceiverStats(info, log_stats);
1381 FillSendAndReceiveCodecStats(info); 1381 FillSendAndReceiveCodecStats(info);
1382 // TODO(holmer): We should either have rtt available as a metric on
1383 // VideoSend/ReceiveStreams, or we should remove rtt from VideoSenderInfo.
1382 webrtc::Call::Stats stats = call_->GetStats(); 1384 webrtc::Call::Stats stats = call_->GetStats();
1383 FillBandwidthEstimationStats(stats, info);
1384 if (stats.rtt_ms != -1) { 1385 if (stats.rtt_ms != -1) {
1385 for (size_t i = 0; i < info->senders.size(); ++i) { 1386 for (size_t i = 0; i < info->senders.size(); ++i) {
1386 info->senders[i].rtt_ms = stats.rtt_ms; 1387 info->senders[i].rtt_ms = stats.rtt_ms;
1387 } 1388 }
1388 } 1389 }
1389 1390
1390 if (log_stats) 1391 if (log_stats)
1391 LOG(LS_INFO) << stats.ToString(now_ms); 1392 LOG(LS_INFO) << stats.ToString(now_ms);
1392 1393
1393 return true; 1394 return true;
(...skipping 14 matching lines...) Expand all
1408 bool log_stats) { 1409 bool log_stats) {
1409 rtc::CritScope stream_lock(&stream_crit_); 1410 rtc::CritScope stream_lock(&stream_crit_);
1410 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = 1411 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it =
1411 receive_streams_.begin(); 1412 receive_streams_.begin();
1412 it != receive_streams_.end(); ++it) { 1413 it != receive_streams_.end(); ++it) {
1413 video_media_info->receivers.push_back( 1414 video_media_info->receivers.push_back(
1414 it->second->GetVideoReceiverInfo(log_stats)); 1415 it->second->GetVideoReceiverInfo(log_stats));
1415 } 1416 }
1416 } 1417 }
1417 1418
1418 void WebRtcVideoChannel2::FillBandwidthEstimationStats( 1419 void WebRtcVideoChannel2::FillBitrateInfo(BandwidthEstimationInfo* bwe_info) {
1419 const webrtc::Call::Stats& stats,
1420 VideoMediaInfo* video_media_info) {
1421 BandwidthEstimationInfo bwe_info;
1422 bwe_info.available_send_bandwidth = stats.send_bandwidth_bps;
1423 bwe_info.available_recv_bandwidth = stats.recv_bandwidth_bps;
1424 bwe_info.bucket_delay = stats.pacer_delay_ms;
1425
1426 // Get send stream bitrate stats.
1427 rtc::CritScope stream_lock(&stream_crit_); 1420 rtc::CritScope stream_lock(&stream_crit_);
1428 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = 1421 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream =
1429 send_streams_.begin(); 1422 send_streams_.begin();
1430 stream != send_streams_.end(); ++stream) { 1423 stream != send_streams_.end(); ++stream) {
1431 stream->second->FillBandwidthEstimationInfo(&bwe_info); 1424 stream->second->FillBitrateInfo(bwe_info);
1432 } 1425 }
1433 video_media_info->bw_estimations.push_back(bwe_info);
1434 } 1426 }
1435 1427
1436 void WebRtcVideoChannel2::FillSendAndReceiveCodecStats( 1428 void WebRtcVideoChannel2::FillSendAndReceiveCodecStats(
1437 VideoMediaInfo* video_media_info) { 1429 VideoMediaInfo* video_media_info) {
1438 for (const VideoCodec& codec : send_params_.codecs) { 1430 for (const VideoCodec& codec : send_params_.codecs) {
1439 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); 1431 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters();
1440 video_media_info->send_codecs.insert( 1432 video_media_info->send_codecs.insert(
1441 std::make_pair(codec_params.payload_type, std::move(codec_params))); 1433 std::make_pair(codec_params.payload_type, std::move(codec_params)));
1442 } 1434 }
1443 for (const VideoCodec& codec : recv_params_.codecs) { 1435 for (const VideoCodec& codec : recv_params_.codecs) {
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 webrtc::VideoSendStream::StreamStats first_stream_stats = 2134 webrtc::VideoSendStream::StreamStats first_stream_stats =
2143 stats.substreams.begin()->second; 2135 stats.substreams.begin()->second;
2144 info.fraction_lost = 2136 info.fraction_lost =
2145 static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) / 2137 static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) /
2146 (1 << 8); 2138 (1 << 8);
2147 } 2139 }
2148 2140
2149 return info; 2141 return info;
2150 } 2142 }
2151 2143
2152 void WebRtcVideoChannel2::WebRtcVideoSendStream::FillBandwidthEstimationInfo( 2144 void WebRtcVideoChannel2::WebRtcVideoSendStream::FillBitrateInfo(
2153 BandwidthEstimationInfo* bwe_info) { 2145 BandwidthEstimationInfo* bwe_info) {
2154 RTC_DCHECK_RUN_ON(&thread_checker_); 2146 RTC_DCHECK_RUN_ON(&thread_checker_);
2155 if (stream_ == NULL) { 2147 if (stream_ == NULL) {
2156 return; 2148 return;
2157 } 2149 }
2158 webrtc::VideoSendStream::Stats stats = stream_->GetStats(); 2150 webrtc::VideoSendStream::Stats stats = stream_->GetStats();
2159 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = 2151 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it =
2160 stats.substreams.begin(); 2152 stats.substreams.begin();
2161 it != stats.substreams.end(); ++it) { 2153 it != stats.substreams.end(); ++it) {
2162 bwe_info->transmit_bitrate += it->second.total_bitrate_bps; 2154 bwe_info->transmit_bitrate += it->second.total_bitrate_bps;
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 rtx_mapping[video_codecs[i].codec.id] != 2668 rtx_mapping[video_codecs[i].codec.id] !=
2677 ulpfec_config.red_payload_type) { 2669 ulpfec_config.red_payload_type) {
2678 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2670 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2679 } 2671 }
2680 } 2672 }
2681 2673
2682 return video_codecs; 2674 return video_codecs;
2683 } 2675 }
2684 2676
2685 } // namespace cricket 2677 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698