Wire up bandwidth stats to the new API and webrtcvideoengine2. Adds stats to verify bandwidth and pacer stats. BUG=1788 R=mflodman@webrtc.org, pbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/24969004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7634 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/video/call.cc b/webrtc/video/call.cc index b03b6c9..2b4f76f 100644 --- a/webrtc/video/call.cc +++ b/webrtc/video/call.cc
@@ -114,8 +114,7 @@ virtual void DestroyVideoReceiveStream( webrtc::VideoReceiveStream* receive_stream) OVERRIDE; - virtual uint32_t SendBitrateEstimate() OVERRIDE; - virtual uint32_t ReceiveBitrateEstimate() OVERRIDE; + virtual Stats GetStats() const OVERRIDE; virtual DeliveryStatus DeliverPacket(const uint8_t* packet, size_t length) OVERRIDE; @@ -321,14 +320,26 @@ delete receive_stream_impl; } -uint32_t Call::SendBitrateEstimate() { - // TODO(pbos): Return send-bitrate estimate - return 0; -} - -uint32_t Call::ReceiveBitrateEstimate() { - // TODO(pbos): Return receive-bitrate estimate - return 0; +Call::Stats Call::GetStats() const { + Stats stats; + // Ignoring return values. + uint32_t send_bandwidth = 0; + rtp_rtcp_->GetEstimatedSendBandwidth(base_channel_id_, &send_bandwidth); + stats.send_bandwidth_bps = send_bandwidth; + uint32_t recv_bandwidth = 0; + rtp_rtcp_->GetEstimatedReceiveBandwidth(base_channel_id_, &recv_bandwidth); + stats.recv_bandwidth_bps = recv_bandwidth; + { + ReadLockScoped read_lock(*send_crit_); + for (std::map<uint32_t, VideoSendStream*>::const_iterator it = + send_ssrcs_.begin(); + it != send_ssrcs_.end(); + ++it) { + stats.pacer_delay_ms = + std::max(it->second->GetPacerQueuingDelayMs(), stats.pacer_delay_ms); + } + } + return stats; } void Call::SignalNetworkState(NetworkState state) {