Falling back on single-stream on multiple SSRC.

Instead of failing, use one stream. Also clamp video min bitrate.

R=stefan@webrtc.org
BUG=1788

Review URL: https://webrtc-codereview.appspot.com/31949004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7615 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-11-04 15:29:29 +00:00
parent 28af64105b
commit 88ef632286
2 changed files with 12 additions and 5 deletions

View File

@ -249,8 +249,9 @@ std::vector<webrtc::VideoStream> WebRtcVideoEncoderFactory2::CreateVideoStreams(
const VideoOptions& options,
size_t num_streams) {
if (num_streams != 1) {
LOG(LS_ERROR) << "Unsupported number of streams: " << num_streams;
return std::vector<webrtc::VideoStream>();
LOG(LS_WARNING) << "Unsupported number of streams (" << num_streams
<< "), falling back to one.";
num_streams = 1;
}
webrtc::VideoStream stream;
@ -261,6 +262,12 @@ std::vector<webrtc::VideoStream> WebRtcVideoEncoderFactory2::CreateVideoStreams(
int min_bitrate = kMinVideoBitrate;
codec.GetParam(kCodecParamMinBitrate, &min_bitrate);
// Clamp the min video bitrate, this is set from JavaScript directly and needs
// to be sanitized.
if (min_bitrate < kMinVideoBitrate) {
min_bitrate = kMinVideoBitrate;
}
int max_bitrate = kMaxVideoBitrate;
codec.GetParam(kCodecParamMaxBitrate, &max_bitrate);
stream.min_bitrate_bps = min_bitrate * 1000;

View File

@ -1634,13 +1634,13 @@ TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) {
}
TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMinMaxBitrate) {
SetSendCodecsShouldWorkForBitrates("10", "20");
SetSendCodecsShouldWorkForBitrates("100", "200");
}
TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectsMaxLessThanMinBitrate) {
std::vector<VideoCodec> video_codecs = engine_.codecs();
video_codecs[0].params[kCodecParamMinBitrate] = "30";
video_codecs[0].params[kCodecParamMaxBitrate] = "20";
video_codecs[0].params[kCodecParamMinBitrate] = "300";
video_codecs[0].params[kCodecParamMaxBitrate] = "200";
EXPECT_FALSE(channel_->SetSendCodecs(video_codecs));
}