Chromium Code Reviews| 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1335 int64_t now_ms = rtc::TimeMillis(); | 1335 int64_t now_ms = rtc::TimeMillis(); |
| 1336 if (last_stats_log_ms_ == -1 || | 1336 if (last_stats_log_ms_ == -1 || |
| 1337 now_ms - last_stats_log_ms_ > kStatsLogIntervalMs) { | 1337 now_ms - last_stats_log_ms_ > kStatsLogIntervalMs) { |
| 1338 last_stats_log_ms_ = now_ms; | 1338 last_stats_log_ms_ = now_ms; |
| 1339 log_stats = true; | 1339 log_stats = true; |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 info->Clear(); | 1342 info->Clear(); |
| 1343 FillSenderStats(info, log_stats); | 1343 FillSenderStats(info, log_stats); |
| 1344 FillReceiverStats(info, log_stats); | 1344 FillReceiverStats(info, log_stats); |
| 1345 FillSendAndReceiveCodecStats(info); | |
| 1345 webrtc::Call::Stats stats = call_->GetStats(); | 1346 webrtc::Call::Stats stats = call_->GetStats(); |
| 1346 FillBandwidthEstimationStats(stats, info); | 1347 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); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1389 // Get send stream bitrate stats. | 1390 // Get send stream bitrate stats. |
| 1390 rtc::CritScope stream_lock(&stream_crit_); | 1391 rtc::CritScope stream_lock(&stream_crit_); |
| 1391 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = | 1392 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = |
| 1392 send_streams_.begin(); | 1393 send_streams_.begin(); |
| 1393 stream != send_streams_.end(); ++stream) { | 1394 stream != send_streams_.end(); ++stream) { |
| 1394 stream->second->FillBandwidthEstimationInfo(&bwe_info); | 1395 stream->second->FillBandwidthEstimationInfo(&bwe_info); |
| 1395 } | 1396 } |
| 1396 video_media_info->bw_estimations.push_back(bwe_info); | 1397 video_media_info->bw_estimations.push_back(bwe_info); |
| 1397 } | 1398 } |
| 1398 | 1399 |
| 1400 void WebRtcVideoChannel2::FillSendAndReceiveCodecStats( | |
| 1401 VideoMediaInfo* video_media_info) { | |
| 1402 // Codec parameters are fetched from streams and from a common list. The | |
| 1403 // payload type -> parameters maps ensure that there are no duplicates based | |
| 1404 // on direction and payload type. | |
| 1405 { | |
| 1406 // Stream-specific codec parameters | |
| 1407 rtc::CritScope stream_lock(&stream_crit_); | |
| 1408 for (const std::pair<uint32_t, WebRtcVideoSendStream*>& pair : | |
| 1409 send_streams_) { | |
| 1410 webrtc::RtpParameters stream_params = pair.second->GetRtpParameters(); | |
| 1411 for (const webrtc::RtpCodecParameters& codec_params : | |
| 1412 stream_params.codecs) { | |
| 1413 video_media_info->send_codecs.insert( | |
| 1414 std::make_pair(codec_params.payload_type, codec_params)); | |
| 1415 } | |
| 1416 } | |
| 1417 for (const std::pair<uint32_t, WebRtcVideoReceiveStream*>& pair : | |
| 1418 receive_streams_) { | |
| 1419 for (const webrtc::VideoReceiveStream::Decoder& decoder : | |
| 1420 pair.second->config().decoders) { | |
| 1421 VideoCodec codec(decoder.payload_type, decoder.payload_name); | |
| 1422 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); | |
| 1423 video_media_info->receive_codecs.insert( | |
| 1424 std::make_pair(codec_params.payload_type, codec_params)); | |
| 1425 } | |
| 1426 } | |
| 1427 } | |
|
Taylor Brandstetter
2016/11/08 23:55:44
I think you can delete this block, since there sho
hbos
2016/11/11 11:20:05
Oh, that makes things simpler. Done.
| |
| 1428 // Common codec parameters | |
| 1429 for (const VideoCodec& codec : send_params_.codecs) { | |
| 1430 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); | |
| 1431 video_media_info->send_codecs.insert( | |
| 1432 std::make_pair(codec_params.payload_type, codec_params)); | |
| 1433 } | |
| 1434 for (const VideoCodec& codec : recv_params_.codecs) { | |
| 1435 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); | |
| 1436 video_media_info->receive_codecs.insert( | |
| 1437 std::make_pair(codec_params.payload_type, codec_params)); | |
| 1438 } | |
| 1439 } | |
| 1440 | |
| 1399 void WebRtcVideoChannel2::OnPacketReceived( | 1441 void WebRtcVideoChannel2::OnPacketReceived( |
| 1400 rtc::CopyOnWriteBuffer* packet, | 1442 rtc::CopyOnWriteBuffer* packet, |
| 1401 const rtc::PacketTime& packet_time) { | 1443 const rtc::PacketTime& packet_time) { |
| 1402 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, | 1444 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, |
| 1403 packet_time.not_before); | 1445 packet_time.not_before); |
| 1404 const webrtc::PacketReceiver::DeliveryStatus delivery_result = | 1446 const webrtc::PacketReceiver::DeliveryStatus delivery_result = |
| 1405 call_->Receiver()->DeliverPacket( | 1447 call_->Receiver()->DeliverPacket( |
| 1406 webrtc::MediaType::VIDEO, | 1448 webrtc::MediaType::VIDEO, |
| 1407 packet->cdata(), packet->size(), | 1449 packet->cdata(), packet->size(), |
| 1408 webrtc_packet_time); | 1450 webrtc_packet_time); |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1993 } | 2035 } |
| 1994 } | 2036 } |
| 1995 | 2037 |
| 1996 VideoSenderInfo WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo( | 2038 VideoSenderInfo WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo( |
| 1997 bool log_stats) { | 2039 bool log_stats) { |
| 1998 VideoSenderInfo info; | 2040 VideoSenderInfo info; |
| 1999 RTC_DCHECK_RUN_ON(&thread_checker_); | 2041 RTC_DCHECK_RUN_ON(&thread_checker_); |
| 2000 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) | 2042 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) |
| 2001 info.add_ssrc(ssrc); | 2043 info.add_ssrc(ssrc); |
| 2002 | 2044 |
| 2003 if (parameters_.codec_settings) | 2045 if (parameters_.codec_settings) { |
| 2004 info.codec_name = parameters_.codec_settings->codec.name; | 2046 info.codec_name = parameters_.codec_settings->codec.name; |
| 2047 info.codec_payload_type = rtc::Optional<uint32_t>( | |
| 2048 static_cast<uint32_t>(parameters_.codec_settings->codec.id)); | |
| 2049 } | |
| 2005 | 2050 |
| 2006 if (stream_ == NULL) | 2051 if (stream_ == NULL) |
| 2007 return info; | 2052 return info; |
| 2008 | 2053 |
| 2009 webrtc::VideoSendStream::Stats stats = stream_->GetStats(); | 2054 webrtc::VideoSendStream::Stats stats = stream_->GetStats(); |
| 2010 | 2055 |
| 2011 if (log_stats) | 2056 if (log_stats) |
| 2012 LOG(LS_INFO) << stats.ToString(rtc::TimeMillis()); | 2057 LOG(LS_INFO) << stats.ToString(rtc::TimeMillis()); |
| 2013 | 2058 |
| 2014 info.adapt_changes = stats.number_of_cpu_adapt_changes; | 2059 info.adapt_changes = stats.number_of_cpu_adapt_changes; |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2410 } | 2455 } |
| 2411 | 2456 |
| 2412 VideoReceiverInfo | 2457 VideoReceiverInfo |
| 2413 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo( | 2458 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo( |
| 2414 bool log_stats) { | 2459 bool log_stats) { |
| 2415 VideoReceiverInfo info; | 2460 VideoReceiverInfo info; |
| 2416 info.ssrc_groups = stream_params_.ssrc_groups; | 2461 info.ssrc_groups = stream_params_.ssrc_groups; |
| 2417 info.add_ssrc(config_.rtp.remote_ssrc); | 2462 info.add_ssrc(config_.rtp.remote_ssrc); |
| 2418 webrtc::VideoReceiveStream::Stats stats = stream_->GetStats(); | 2463 webrtc::VideoReceiveStream::Stats stats = stream_->GetStats(); |
| 2419 info.decoder_implementation_name = stats.decoder_implementation_name; | 2464 info.decoder_implementation_name = stats.decoder_implementation_name; |
| 2465 if (stats.current_payload_type != -1) { | |
| 2466 info.codec_payload_type = rtc::Optional<uint32_t>( | |
| 2467 static_cast<uint32_t>(stats.current_payload_type)); | |
| 2468 } | |
| 2420 info.bytes_rcvd = stats.rtp_stats.transmitted.payload_bytes + | 2469 info.bytes_rcvd = stats.rtp_stats.transmitted.payload_bytes + |
| 2421 stats.rtp_stats.transmitted.header_bytes + | 2470 stats.rtp_stats.transmitted.header_bytes + |
| 2422 stats.rtp_stats.transmitted.padding_bytes; | 2471 stats.rtp_stats.transmitted.padding_bytes; |
| 2423 info.packets_rcvd = stats.rtp_stats.transmitted.packets; | 2472 info.packets_rcvd = stats.rtp_stats.transmitted.packets; |
| 2424 info.packets_lost = stats.rtcp_stats.cumulative_lost; | 2473 info.packets_lost = stats.rtcp_stats.cumulative_lost; |
| 2425 info.fraction_lost = | 2474 info.fraction_lost = |
| 2426 static_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8); | 2475 static_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8); |
| 2427 | 2476 |
| 2428 info.framerate_rcvd = stats.network_frame_rate; | 2477 info.framerate_rcvd = stats.network_frame_rate; |
| 2429 info.framerate_decoded = stats.decode_frame_rate; | 2478 info.framerate_decoded = stats.decode_frame_rate; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2574 rtx_mapping[video_codecs[i].codec.id] != | 2623 rtx_mapping[video_codecs[i].codec.id] != |
| 2575 ulpfec_config.red_payload_type) { | 2624 ulpfec_config.red_payload_type) { |
| 2576 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2625 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2577 } | 2626 } |
| 2578 } | 2627 } |
| 2579 | 2628 |
| 2580 return video_codecs; | 2629 return video_codecs; |
| 2581 } | 2630 } |
| 2582 | 2631 |
| 2583 } // namespace cricket | 2632 } // namespace cricket |
| OLD | NEW |