mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1429219: Ensure VP8 simulcast with temporal layers won't fail if there aren't enough bits r=drno
This commit is contained in:
parent
aa370f7694
commit
c359f64e82
@ -665,6 +665,7 @@ WebrtcVideoConduit::VideoStreamFactory::CreateEncoderStreams(int width, int heig
|
||||
video_stream.SetRid(simulcastEncoding.rid);
|
||||
|
||||
// leave vector temporal_layer_thresholds_bps empty for non-simulcast
|
||||
video_stream.temporal_layer_thresholds_bps.clear();
|
||||
if (config.number_of_streams > 1) {
|
||||
// XXX Note: in simulcast.cc in upstream code, the array value is
|
||||
// 3(-1) for all streams, though it's in an array, except for screencasts,
|
||||
@ -676,7 +677,6 @@ WebrtcVideoConduit::VideoStreamFactory::CreateEncoderStreams(int width, int heig
|
||||
// For VideoEncoderConfig::ContentType::kScreen, though, in
|
||||
// video_codec_initializer.cc it uses [0] to set the target bitrate
|
||||
// for the screenshare.
|
||||
video_stream.temporal_layer_thresholds_bps.clear();
|
||||
if (mConduit->mCodecMode == webrtc::VideoCodecMode::kScreensharing) {
|
||||
video_stream.temporal_layer_thresholds_bps.push_back(video_stream.target_bitrate_bps);
|
||||
} else {
|
||||
@ -684,8 +684,6 @@ WebrtcVideoConduit::VideoStreamFactory::CreateEncoderStreams(int width, int heig
|
||||
}
|
||||
// XXX Bug 1390215 investigate using more of
|
||||
// simulcast.cc:GetSimulcastConfig() or our own algorithm to replace it
|
||||
} else {
|
||||
video_stream.temporal_layer_thresholds_bps.clear();
|
||||
}
|
||||
|
||||
if (mConduit->mCurSendCodecConfig->mName == "H264") {
|
||||
|
@ -273,6 +273,7 @@ void VP8EncoderImpl::SetupTemporalLayers(int num_streams,
|
||||
const VideoCodec& codec) {
|
||||
RTC_DCHECK(codec.VP8().tl_factory != nullptr);
|
||||
const TemporalLayersFactory* tl_factory = codec.VP8().tl_factory;
|
||||
RTC_DCHECK(temporal_layers_.empty());
|
||||
if (num_streams == 1) {
|
||||
temporal_layers_.push_back(
|
||||
tl_factory->Create(0, num_temporal_layers, rand()));
|
||||
@ -497,7 +498,13 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
|
||||
|
||||
configurations_[0].rc_target_bitrate = stream_bitrates[stream_idx];
|
||||
temporal_layers_[stream_idx]->OnRatesUpdated(
|
||||
stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate);
|
||||
// VP8 fails to init a setup with temporal layers if
|
||||
// ts_target_bitrates[] are 0, so we need to supply enough bits to
|
||||
// ensure it configures. After that, normal bitrate updates should
|
||||
// work as designed, with the largest simulcast stream getting starved
|
||||
// if they're aren't enough bits.
|
||||
stream_bitrates[stream_idx] > 0 ? stream_bitrates[stream_idx] : inst->simulcastStream[stream_idx].minBitrate,
|
||||
inst->maxBitrate, inst->maxFramerate);
|
||||
temporal_layers_[stream_idx]->UpdateConfiguration(&configurations_[0]);
|
||||
--stream_idx;
|
||||
for (size_t i = 1; i < encoders_.size(); ++i, --stream_idx) {
|
||||
@ -519,7 +526,9 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
|
||||
SetStreamState(stream_bitrates[stream_idx] > 0, stream_idx);
|
||||
configurations_[i].rc_target_bitrate = stream_bitrates[stream_idx];
|
||||
temporal_layers_[stream_idx]->OnRatesUpdated(
|
||||
stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate);
|
||||
// here too - VP8 won't init if it thinks temporal layers have no bits
|
||||
stream_bitrates[stream_idx] > 0 ? stream_bitrates[stream_idx] : inst->simulcastStream[stream_idx].minBitrate,
|
||||
inst->maxBitrate, inst->maxFramerate);
|
||||
temporal_layers_[stream_idx]->UpdateConfiguration(&configurations_[i]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user