| OLD | NEW |
| 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 Loading... |
| 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. | |
| 1384 webrtc::Call::Stats stats = call_->GetStats(); | 1382 webrtc::Call::Stats stats = call_->GetStats(); |
| 1383 FillBandwidthEstimationStats(stats, info); |
| 1385 if (stats.rtt_ms != -1) { | 1384 if (stats.rtt_ms != -1) { |
| 1386 for (size_t i = 0; i < info->senders.size(); ++i) { | 1385 for (size_t i = 0; i < info->senders.size(); ++i) { |
| 1387 info->senders[i].rtt_ms = stats.rtt_ms; | 1386 info->senders[i].rtt_ms = stats.rtt_ms; |
| 1388 } | 1387 } |
| 1389 } | 1388 } |
| 1390 | 1389 |
| 1391 if (log_stats) | 1390 if (log_stats) |
| 1392 LOG(LS_INFO) << stats.ToString(now_ms); | 1391 LOG(LS_INFO) << stats.ToString(now_ms); |
| 1393 | 1392 |
| 1394 return true; | 1393 return true; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1409 bool log_stats) { | 1408 bool log_stats) { |
| 1410 rtc::CritScope stream_lock(&stream_crit_); | 1409 rtc::CritScope stream_lock(&stream_crit_); |
| 1411 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = | 1410 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
| 1412 receive_streams_.begin(); | 1411 receive_streams_.begin(); |
| 1413 it != receive_streams_.end(); ++it) { | 1412 it != receive_streams_.end(); ++it) { |
| 1414 video_media_info->receivers.push_back( | 1413 video_media_info->receivers.push_back( |
| 1415 it->second->GetVideoReceiverInfo(log_stats)); | 1414 it->second->GetVideoReceiverInfo(log_stats)); |
| 1416 } | 1415 } |
| 1417 } | 1416 } |
| 1418 | 1417 |
| 1419 void WebRtcVideoChannel2::FillBitrateInfo(BandwidthEstimationInfo* bwe_info) { | 1418 void WebRtcVideoChannel2::FillBandwidthEstimationStats( |
| 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. |
| 1420 rtc::CritScope stream_lock(&stream_crit_); | 1427 rtc::CritScope stream_lock(&stream_crit_); |
| 1421 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = | 1428 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = |
| 1422 send_streams_.begin(); | 1429 send_streams_.begin(); |
| 1423 stream != send_streams_.end(); ++stream) { | 1430 stream != send_streams_.end(); ++stream) { |
| 1424 stream->second->FillBitrateInfo(bwe_info); | 1431 stream->second->FillBandwidthEstimationInfo(&bwe_info); |
| 1425 } | 1432 } |
| 1433 video_media_info->bw_estimations.push_back(bwe_info); |
| 1426 } | 1434 } |
| 1427 | 1435 |
| 1428 void WebRtcVideoChannel2::FillSendAndReceiveCodecStats( | 1436 void WebRtcVideoChannel2::FillSendAndReceiveCodecStats( |
| 1429 VideoMediaInfo* video_media_info) { | 1437 VideoMediaInfo* video_media_info) { |
| 1430 for (const VideoCodec& codec : send_params_.codecs) { | 1438 for (const VideoCodec& codec : send_params_.codecs) { |
| 1431 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); | 1439 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); |
| 1432 video_media_info->send_codecs.insert( | 1440 video_media_info->send_codecs.insert( |
| 1433 std::make_pair(codec_params.payload_type, std::move(codec_params))); | 1441 std::make_pair(codec_params.payload_type, std::move(codec_params))); |
| 1434 } | 1442 } |
| 1435 for (const VideoCodec& codec : recv_params_.codecs) { | 1443 for (const VideoCodec& codec : recv_params_.codecs) { |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 webrtc::VideoSendStream::StreamStats first_stream_stats = | 2142 webrtc::VideoSendStream::StreamStats first_stream_stats = |
| 2135 stats.substreams.begin()->second; | 2143 stats.substreams.begin()->second; |
| 2136 info.fraction_lost = | 2144 info.fraction_lost = |
| 2137 static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) / | 2145 static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) / |
| 2138 (1 << 8); | 2146 (1 << 8); |
| 2139 } | 2147 } |
| 2140 | 2148 |
| 2141 return info; | 2149 return info; |
| 2142 } | 2150 } |
| 2143 | 2151 |
| 2144 void WebRtcVideoChannel2::WebRtcVideoSendStream::FillBitrateInfo( | 2152 void WebRtcVideoChannel2::WebRtcVideoSendStream::FillBandwidthEstimationInfo( |
| 2145 BandwidthEstimationInfo* bwe_info) { | 2153 BandwidthEstimationInfo* bwe_info) { |
| 2146 RTC_DCHECK_RUN_ON(&thread_checker_); | 2154 RTC_DCHECK_RUN_ON(&thread_checker_); |
| 2147 if (stream_ == NULL) { | 2155 if (stream_ == NULL) { |
| 2148 return; | 2156 return; |
| 2149 } | 2157 } |
| 2150 webrtc::VideoSendStream::Stats stats = stream_->GetStats(); | 2158 webrtc::VideoSendStream::Stats stats = stream_->GetStats(); |
| 2151 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = | 2159 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = |
| 2152 stats.substreams.begin(); | 2160 stats.substreams.begin(); |
| 2153 it != stats.substreams.end(); ++it) { | 2161 it != stats.substreams.end(); ++it) { |
| 2154 bwe_info->transmit_bitrate += it->second.total_bitrate_bps; | 2162 bwe_info->transmit_bitrate += it->second.total_bitrate_bps; |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 rtx_mapping[video_codecs[i].codec.id] != | 2676 rtx_mapping[video_codecs[i].codec.id] != |
| 2669 ulpfec_config.red_payload_type) { | 2677 ulpfec_config.red_payload_type) { |
| 2670 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2678 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2671 } | 2679 } |
| 2672 } | 2680 } |
| 2673 | 2681 |
| 2674 return video_codecs; | 2682 return video_codecs; |
| 2675 } | 2683 } |
| 2676 | 2684 |
| 2677 } // namespace cricket | 2685 } // namespace cricket |
| OLD | NEW |