| 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   for (const VideoCodec& codec : send_params_.codecs) { | 
|  | 1403     webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); | 
|  | 1404     video_media_info->send_codecs.insert( | 
|  | 1405         std::make_pair(codec_params.payload_type, std::move(codec_params))); | 
|  | 1406   } | 
|  | 1407   for (const VideoCodec& codec : recv_params_.codecs) { | 
|  | 1408     webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters(); | 
|  | 1409     video_media_info->receive_codecs.insert( | 
|  | 1410         std::make_pair(codec_params.payload_type, std::move(codec_params))); | 
|  | 1411   } | 
|  | 1412 } | 
|  | 1413 | 
| 1399 void WebRtcVideoChannel2::OnPacketReceived( | 1414 void WebRtcVideoChannel2::OnPacketReceived( | 
| 1400     rtc::CopyOnWriteBuffer* packet, | 1415     rtc::CopyOnWriteBuffer* packet, | 
| 1401     const rtc::PacketTime& packet_time) { | 1416     const rtc::PacketTime& packet_time) { | 
| 1402   const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, | 1417   const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, | 
| 1403                                               packet_time.not_before); | 1418                                               packet_time.not_before); | 
| 1404   const webrtc::PacketReceiver::DeliveryStatus delivery_result = | 1419   const webrtc::PacketReceiver::DeliveryStatus delivery_result = | 
| 1405       call_->Receiver()->DeliverPacket( | 1420       call_->Receiver()->DeliverPacket( | 
| 1406           webrtc::MediaType::VIDEO, | 1421           webrtc::MediaType::VIDEO, | 
| 1407           packet->cdata(), packet->size(), | 1422           packet->cdata(), packet->size(), | 
| 1408           webrtc_packet_time); | 1423           webrtc_packet_time); | 
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1993   } | 2008   } | 
| 1994 } | 2009 } | 
| 1995 | 2010 | 
| 1996 VideoSenderInfo WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo( | 2011 VideoSenderInfo WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo( | 
| 1997     bool log_stats) { | 2012     bool log_stats) { | 
| 1998   VideoSenderInfo info; | 2013   VideoSenderInfo info; | 
| 1999   RTC_DCHECK_RUN_ON(&thread_checker_); | 2014   RTC_DCHECK_RUN_ON(&thread_checker_); | 
| 2000   for (uint32_t ssrc : parameters_.config.rtp.ssrcs) | 2015   for (uint32_t ssrc : parameters_.config.rtp.ssrcs) | 
| 2001     info.add_ssrc(ssrc); | 2016     info.add_ssrc(ssrc); | 
| 2002 | 2017 | 
| 2003   if (parameters_.codec_settings) | 2018   if (parameters_.codec_settings) { | 
| 2004     info.codec_name = parameters_.codec_settings->codec.name; | 2019     info.codec_name = parameters_.codec_settings->codec.name; | 
|  | 2020     info.codec_payload_type = rtc::Optional<uint32_t>( | 
|  | 2021         static_cast<uint32_t>(parameters_.codec_settings->codec.id)); | 
|  | 2022   } | 
| 2005 | 2023 | 
| 2006   if (stream_ == NULL) | 2024   if (stream_ == NULL) | 
| 2007     return info; | 2025     return info; | 
| 2008 | 2026 | 
| 2009   webrtc::VideoSendStream::Stats stats = stream_->GetStats(); | 2027   webrtc::VideoSendStream::Stats stats = stream_->GetStats(); | 
| 2010 | 2028 | 
| 2011   if (log_stats) | 2029   if (log_stats) | 
| 2012     LOG(LS_INFO) << stats.ToString(rtc::TimeMillis()); | 2030     LOG(LS_INFO) << stats.ToString(rtc::TimeMillis()); | 
| 2013 | 2031 | 
| 2014   info.adapt_changes = stats.number_of_cpu_adapt_changes; | 2032   info.adapt_changes = stats.number_of_cpu_adapt_changes; | 
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2410 } | 2428 } | 
| 2411 | 2429 | 
| 2412 VideoReceiverInfo | 2430 VideoReceiverInfo | 
| 2413 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo( | 2431 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo( | 
| 2414     bool log_stats) { | 2432     bool log_stats) { | 
| 2415   VideoReceiverInfo info; | 2433   VideoReceiverInfo info; | 
| 2416   info.ssrc_groups = stream_params_.ssrc_groups; | 2434   info.ssrc_groups = stream_params_.ssrc_groups; | 
| 2417   info.add_ssrc(config_.rtp.remote_ssrc); | 2435   info.add_ssrc(config_.rtp.remote_ssrc); | 
| 2418   webrtc::VideoReceiveStream::Stats stats = stream_->GetStats(); | 2436   webrtc::VideoReceiveStream::Stats stats = stream_->GetStats(); | 
| 2419   info.decoder_implementation_name = stats.decoder_implementation_name; | 2437   info.decoder_implementation_name = stats.decoder_implementation_name; | 
|  | 2438   if (stats.current_payload_type != -1) { | 
|  | 2439     info.codec_payload_type = rtc::Optional<uint32_t>( | 
|  | 2440         static_cast<uint32_t>(stats.current_payload_type)); | 
|  | 2441   } | 
| 2420   info.bytes_rcvd = stats.rtp_stats.transmitted.payload_bytes + | 2442   info.bytes_rcvd = stats.rtp_stats.transmitted.payload_bytes + | 
| 2421                     stats.rtp_stats.transmitted.header_bytes + | 2443                     stats.rtp_stats.transmitted.header_bytes + | 
| 2422                     stats.rtp_stats.transmitted.padding_bytes; | 2444                     stats.rtp_stats.transmitted.padding_bytes; | 
| 2423   info.packets_rcvd = stats.rtp_stats.transmitted.packets; | 2445   info.packets_rcvd = stats.rtp_stats.transmitted.packets; | 
| 2424   info.packets_lost = stats.rtcp_stats.cumulative_lost; | 2446   info.packets_lost = stats.rtcp_stats.cumulative_lost; | 
| 2425   info.fraction_lost = | 2447   info.fraction_lost = | 
| 2426       static_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8); | 2448       static_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8); | 
| 2427 | 2449 | 
| 2428   info.framerate_rcvd = stats.network_frame_rate; | 2450   info.framerate_rcvd = stats.network_frame_rate; | 
| 2429   info.framerate_decoded = stats.decode_frame_rate; | 2451   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] != | 2596         rtx_mapping[video_codecs[i].codec.id] != | 
| 2575             ulpfec_config.red_payload_type) { | 2597             ulpfec_config.red_payload_type) { | 
| 2576       video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2598       video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 
| 2577     } | 2599     } | 
| 2578   } | 2600   } | 
| 2579 | 2601 | 
| 2580   return video_codecs; | 2602   return video_codecs; | 
| 2581 } | 2603 } | 
| 2582 | 2604 | 
| 2583 }  // namespace cricket | 2605 }  // namespace cricket | 
| OLD | NEW | 
|---|