Bug 1365090: use target bitrate instead of max for simulcast. r=bwc

MozReview-Commit-ID: GThcXHHnoCV

--HG--
extra : rebase_source : 352a82ad81858782898a10440ff77b4891af6a60
This commit is contained in:
Nils Ohlmeier [:drno] 2017-05-16 16:15:04 -07:00
parent 4d8185fc04
commit 4dd7f2dc11

View File

@ -426,7 +426,16 @@ bool VideoSendStream::ReconfigureVideoEncoder(
video_codec.minBitrate =
std::min(static_cast<uint16_t>(video_codec.minBitrate),
static_cast<uint16_t>(streams[i].min_bitrate_bps / 1000));
video_codec.maxBitrate += streams[i].max_bitrate_bps / 1000;
// SimulcastEncoderAdapter::GetStreamBitrate() expects to give the target
// rate to each of the lower layers and the remainder to the last layer.
// Giving max to everything results in lower layer to consume too much
// bandwidth and the top layer potentially not having enough bitrate left
// for its minimum.
if (i + 1 == streams.size()) {
video_codec.maxBitrate += streams[i].max_bitrate_bps / 1000;
} else {
video_codec.maxBitrate += streams[i].target_bitrate_bps / 1000;
}
video_codec.qpMax = std::max(video_codec.qpMax,
static_cast<unsigned int>(streams[i].max_qp));
}