(Auto)update libjingle 66301332-> 66303009

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6064 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
buildbot@webrtc.org 2014-05-06 17:48:14 +00:00
parent e65c9a6e67
commit a18b4c96af
3 changed files with 58 additions and 43 deletions

View File

@ -596,12 +596,13 @@ class FakeWebRtcVideoEngine
}
void SetSendBandwidthEstimate(int channel, unsigned int send_bandwidth) {
WEBRTC_ASSERT_CHANNEL(channel);
channels_[channel]->send_bandwidth_ = send_bandwidth;
channels_[GetOriginalChannelId(channel)]->send_bandwidth_ = send_bandwidth;
}
void SetReceiveBandwidthEstimate(int channel,
unsigned int receive_bandwidth) {
WEBRTC_ASSERT_CHANNEL(channel);
channels_[channel]->receive_bandwidth_ = receive_bandwidth;
channels_[GetOriginalChannelId(channel)]->receive_bandwidth_ =
receive_bandwidth;
};
int GetRtxSendPayloadType(int channel) {
WEBRTC_CHECK_CHANNEL(channel);
@ -636,7 +637,11 @@ class FakeWebRtcVideoEngine
return -1;
}
Channel* ch = new Channel();
channels_[++last_channel_] = ch;
++last_channel_;
// The original channel of the first channel in a group refers to itself
// for code simplicity.
ch->original_channel_id_ = last_channel_;
channels_[last_channel_] = ch;
channel = last_channel_;
return 0;
};
@ -1121,6 +1126,7 @@ class FakeWebRtcVideoEngine
std::map<int, Channel*>::const_iterator it = channels_.find(channel);
// Assume the current video, fec and nack bitrate sums up to our estimate.
if (it->second->send) {
it = channels_.find(GetOriginalChannelId(channel));
*send_bandwidth_estimate = it->second->send_bandwidth_;
} else {
*send_bandwidth_estimate = 0;
@ -1132,7 +1138,7 @@ class FakeWebRtcVideoEngine
WEBRTC_CHECK_CHANNEL(channel);
std::map<int, Channel*>::const_iterator it = channels_.find(channel);
if (it->second->receive_) {
// For simplicity, assume all channels receive half of max send rate.
it = channels_.find(GetOriginalChannelId(channel));
*receive_bandwidth_estimate = it->second->receive_bandwidth_;
} else {
*receive_bandwidth_estimate = 0;

View File

@ -2483,13 +2483,6 @@ bool WebRtcVideoMediaChannel::GetStats(const StatsOptions& options,
LOG_RTCERR1(GetBandwidthUsage, channel_id);
}
unsigned int estimated_stream_send_bandwidth = 0;
if (engine_->vie()->rtp()->GetEstimatedSendBandwidth(
channel_id, &estimated_stream_send_bandwidth) == 0) {
estimated_send_bandwidth += estimated_stream_send_bandwidth;
} else {
LOG_RTCERR1(GetEstimatedSendBandwidth, channel_id);
}
unsigned int target_enc_stream_bitrate = 0;
if (engine_->vie()->codec()->GetCodecTargetBitrate(
channel_id, &target_enc_stream_bitrate) == 0) {
@ -2498,12 +2491,22 @@ bool WebRtcVideoMediaChannel::GetStats(const StatsOptions& options,
LOG_RTCERR1(GetCodecTargetBitrate, channel_id);
}
}
if (!send_channels_.empty()) {
// GetEstimatedSendBandwidth returns the estimated bandwidth for all video
// engine channels in a channel group. Any valid channel id will do as it
// is only used to access the right group of channels.
const int channel_id = send_channels_.begin()->second->channel_id();
// Get the send bandwidth available for this MediaChannel.
if (engine_->vie()->rtp()->GetEstimatedSendBandwidth(
channel_id, &estimated_send_bandwidth) != 0) {
LOG_RTCERR1(GetEstimatedSendBandwidth, channel_id);
}
}
} else {
LOG(LS_WARNING) << "GetStats: sender information not ready.";
}
// Get the SSRC and stats for each receiver, based on our own calculations.
unsigned int estimated_recv_bandwidth = 0;
for (RecvChannelMap::const_iterator it = recv_channels_.begin();
it != recv_channels_.end(); ++it) {
WebRtcVideoChannelRecvInfo* channel = it->second;
@ -2564,15 +2567,20 @@ bool WebRtcVideoMediaChannel::GetStats(const StatsOptions& options,
incoming_stream_rtcp_stats.fraction_lost) / (1 << 8);
}
info->receivers.push_back(rinfo);
unsigned int estimated_recv_stream_bandwidth = 0;
}
unsigned int estimated_recv_bandwidth = 0;
if (!recv_channels_.empty()) {
// GetEstimatedReceiveBandwidth returns the estimated bandwidth for all
// video engine channels in a channel group. Any valid channel id will do as
// it is only used to access the right group of channels.
const int channel_id = recv_channels_.begin()->second->channel_id();
// Gets the estimated receive bandwidth for the MediaChannel.
if (engine_->vie()->rtp()->GetEstimatedReceiveBandwidth(
channel->channel_id(), &estimated_recv_stream_bandwidth) == 0) {
estimated_recv_bandwidth += estimated_recv_stream_bandwidth;
} else {
LOG_RTCERR1(GetEstimatedReceiveBandwidth, channel->channel_id());
channel_id, &estimated_recv_bandwidth) != 0) {
LOG_RTCERR1(GetEstimatedReceiveBandwidth, channel_id);
}
}
// Build BandwidthEstimationInfo.
// TODO(zhurunz): Add real unittest for this.
BandwidthEstimationInfo bwe;

View File

@ -1529,26 +1529,28 @@ TEST_F(WebRtcVideoEngineTestFake, MultipleSendStreamsWithOneCapturer) {
}
// Disabled since its flaky: b/11288120
TEST_F(WebRtcVideoEngineTestFake, DISABLED_SendReceiveBitratesStats) {
TEST_F(WebRtcVideoEngineTestFake, SendReceiveBitratesStats) {
EXPECT_TRUE(SetupEngine());
cricket::VideoOptions options;
options.conference_mode.Set(true);
EXPECT_TRUE(channel_->SetOptions(options));
EXPECT_TRUE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(1)));
int send_channel = vie_.GetLastChannel();
int first_send_channel = vie_.GetLastChannel();
EXPECT_TRUE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(2)));
int second_send_channel = vie_.GetLastChannel();
cricket::VideoCodec codec(kVP8Codec720p);
std::vector<cricket::VideoCodec> codec_list;
codec_list.push_back(codec);
EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(2)));
int first_receive_channel = vie_.GetLastChannel();
EXPECT_NE(send_channel, first_receive_channel);
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(3)));
int first_receive_channel = vie_.GetLastChannel();
EXPECT_NE(first_send_channel, first_receive_channel);
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(4)));
int second_receive_channel = vie_.GetLastChannel();
EXPECT_NE(first_receive_channel, second_receive_channel);
@ -1563,21 +1565,20 @@ TEST_F(WebRtcVideoEngineTestFake, DISABLED_SendReceiveBitratesStats) {
ASSERT_EQ(0, info.bw_estimations[0].target_enc_bitrate);
// Start sending and receiving on one of the channels and verify bitrates.
EXPECT_EQ(0, vie_.StartSend(send_channel));
EXPECT_EQ(0, vie_.StartSend(first_send_channel));
int send_video_bitrate = 800;
int send_fec_bitrate = 100;
int send_nack_bitrate = 20;
int send_total_bitrate = send_video_bitrate + send_fec_bitrate +
send_nack_bitrate;
int send_bandwidth = 950;
vie_.SetSendBitrates(send_channel, send_video_bitrate, send_fec_bitrate,
int send_bandwidth = 1900;
vie_.SetSendBitrates(first_send_channel, send_video_bitrate, send_fec_bitrate,
send_nack_bitrate);
vie_.SetSendBandwidthEstimate(send_channel, send_bandwidth);
vie_.SetSendBandwidthEstimate(first_send_channel, send_bandwidth);
EXPECT_EQ(0, vie_.StartReceive(first_receive_channel));
int first_channel_receive_bandwidth = 600;
vie_.SetReceiveBandwidthEstimate(first_receive_channel,
first_channel_receive_bandwidth);
int receive_bandwidth = 600;
vie_.SetReceiveBandwidthEstimate(first_receive_channel, receive_bandwidth);
info.Clear();
EXPECT_TRUE(channel_->GetStats(cricket::StatsOptions(), &info));
@ -1586,26 +1587,26 @@ TEST_F(WebRtcVideoEngineTestFake, DISABLED_SendReceiveBitratesStats) {
ASSERT_EQ(send_total_bitrate, info.bw_estimations[0].transmit_bitrate);
ASSERT_EQ(send_nack_bitrate, info.bw_estimations[0].retransmit_bitrate);
ASSERT_EQ(send_bandwidth, info.bw_estimations[0].available_send_bandwidth);
ASSERT_EQ(first_channel_receive_bandwidth,
info.bw_estimations[0].available_recv_bandwidth);
ASSERT_EQ(receive_bandwidth, info.bw_estimations[0].available_recv_bandwidth);
ASSERT_EQ(send_video_bitrate, info.bw_estimations[0].target_enc_bitrate);
// Start receiving on the second channel and verify received rate.
EXPECT_EQ(0, vie_.StartSend(second_send_channel));
vie_.SetSendBitrates(second_send_channel,
send_video_bitrate,
send_fec_bitrate,
send_nack_bitrate);
EXPECT_EQ(0, vie_.StartReceive(second_receive_channel));
int second_channel_receive_bandwidth = 100;
vie_.SetReceiveBandwidthEstimate(second_receive_channel,
second_channel_receive_bandwidth);
info.Clear();
EXPECT_TRUE(channel_->GetStats(cricket::StatsOptions(), &info));
ASSERT_EQ(1U, info.bw_estimations.size());
ASSERT_EQ(send_video_bitrate, info.bw_estimations[0].actual_enc_bitrate);
ASSERT_EQ(send_total_bitrate, info.bw_estimations[0].transmit_bitrate);
ASSERT_EQ(send_nack_bitrate, info.bw_estimations[0].retransmit_bitrate);
ASSERT_EQ(2 * send_video_bitrate, info.bw_estimations[0].actual_enc_bitrate);
ASSERT_EQ(2 * send_total_bitrate, info.bw_estimations[0].transmit_bitrate);
ASSERT_EQ(2 * send_nack_bitrate, info.bw_estimations[0].retransmit_bitrate);
ASSERT_EQ(send_bandwidth, info.bw_estimations[0].available_send_bandwidth);
ASSERT_EQ(first_channel_receive_bandwidth + second_channel_receive_bandwidth,
info.bw_estimations[0].available_recv_bandwidth);
ASSERT_EQ(send_video_bitrate, info.bw_estimations[0].target_enc_bitrate);
ASSERT_EQ(receive_bandwidth, info.bw_estimations[0].available_recv_bandwidth);
ASSERT_EQ(2 * send_video_bitrate, info.bw_estimations[0].target_enc_bitrate);
}
TEST_F(WebRtcVideoEngineTestFake, TestSetAdaptInputToCpuUsage) {