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
This commit is contained in:
stefan@webrtc.org
2014-11-05 14:05:29 +00:00
parent a22a628356
commit 0bae1fab4a
26 changed files with 315 additions and 129 deletions

View File

@@ -1202,7 +1202,21 @@ void WebRtcVideoChannel2::FillReceiverStats(VideoMediaInfo* video_media_info) {
void WebRtcVideoChannel2::FillBandwidthEstimationStats(
VideoMediaInfo* video_media_info) {
// TODO(pbos): Implement.
BandwidthEstimationInfo bwe_info;
webrtc::Call::Stats stats = call_->GetStats();
bwe_info.available_send_bandwidth = stats.send_bandwidth_bps;
bwe_info.available_recv_bandwidth = stats.recv_bandwidth_bps;
bwe_info.bucket_delay = stats.pacer_delay_ms;
// Get send stream bitrate stats.
rtc::CritScope stream_lock(&stream_crit_);
for (std::map<uint32, WebRtcVideoSendStream*>::iterator stream =
send_streams_.begin();
stream != send_streams_.end();
++stream) {
stream->second->FillBandwidthEstimationInfo(&bwe_info);
}
video_media_info->bw_estimations.push_back(bwe_info);
}
bool WebRtcVideoChannel2::SetCapturer(uint32 ssrc, VideoCapturer* capturer) {
@@ -1842,12 +1856,12 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() {
info.framerate_input = stats.input_frame_rate;
info.framerate_sent = stats.encode_frame_rate;
for (std::map<uint32_t, webrtc::StreamStats>::iterator it =
for (std::map<uint32_t, webrtc::SsrcStats>::iterator it =
stats.substreams.begin();
it != stats.substreams.end();
++it) {
// TODO(pbos): Wire up additional stats, such as padding bytes.
webrtc::StreamStats stream_stats = it->second;
webrtc::SsrcStats stream_stats = it->second;
info.bytes_sent += stream_stats.rtp_stats.bytes +
stream_stats.rtp_stats.header_bytes +
stream_stats.rtp_stats.padding_bytes;
@@ -1857,7 +1871,7 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() {
if (!stats.substreams.empty()) {
// TODO(pbos): Report fraction lost per SSRC.
webrtc::StreamStats first_stream_stats = stats.substreams.begin()->second;
webrtc::SsrcStats first_stream_stats = stats.substreams.begin()->second;
info.fraction_lost =
static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) /
(1 << 8);
@@ -1884,6 +1898,23 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() {
return info;
}
void WebRtcVideoChannel2::WebRtcVideoSendStream::FillBandwidthEstimationInfo(
BandwidthEstimationInfo* bwe_info) {
rtc::CritScope cs(&lock_);
if (stream_ == NULL) {
return;
}
webrtc::VideoSendStream::Stats stats = stream_->GetStats();
for (std::map<uint32_t, webrtc::SsrcStats>::iterator it =
stats.substreams.begin();
it != stats.substreams.end();
++it) {
bwe_info->transmit_bitrate += it->second.total_bitrate_bps;
bwe_info->retransmit_bitrate += it->second.retransmit_bitrate_bps;
}
bwe_info->actual_enc_bitrate = stats.media_bitrate_bps;
}
void WebRtcVideoChannel2::WebRtcVideoSendStream::OnCpuResolutionRequest(
CoordinatedVideoAdapter::AdaptRequest adapt_request) {
rtc::CritScope cs(&lock_);

View File

@@ -315,6 +315,7 @@ class WebRtcVideoChannel2 : public rtc::MessageHandler,
void Stop();
VideoSenderInfo GetVideoSenderInfo();
void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info);
void OnCpuResolutionRequest(
CoordinatedVideoAdapter::AdaptRequest adapt_request);

View File

@@ -294,12 +294,9 @@ webrtc::PacketReceiver* FakeCall::Receiver() {
return NULL;
}
uint32_t FakeCall::SendBitrateEstimate() {
return 0;
}
uint32_t FakeCall::ReceiveBitrateEstimate() {
return 0;
webrtc::Call::Stats FakeCall::GetStats() const {
webrtc::Call::Stats stats;
return stats;
}
void FakeCall::SignalNetworkState(webrtc::Call::NetworkState state) {

View File

@@ -127,8 +127,7 @@ class FakeCall : public webrtc::Call {
webrtc::VideoReceiveStream* receive_stream) OVERRIDE;
virtual webrtc::PacketReceiver* Receiver() OVERRIDE;
virtual uint32_t SendBitrateEstimate() OVERRIDE;
virtual uint32_t ReceiveBitrateEstimate() OVERRIDE;
virtual webrtc::Call::Stats GetStats() const OVERRIDE;
virtual void SignalNetworkState(webrtc::Call::NetworkState state) OVERRIDE;