obs-outputs: Improve new netcode if encoder reports 0 bitrate

Some encoders such as the AMD AMF encoder don't set their bitrate
property, so it gets returned as 0. This causes the new network code to
allocate a tiny buffer, resulting in output starvation and throttling
to the point of uselessness if low latency mode is also enabled.
This commit is contained in:
Richard Stanway 2017-08-29 23:47:52 +02:00
parent 4c58dcf65c
commit 41a1b09988
No known key found for this signature in database
GPG Key ID: AAC1E5265D71B3FD

View File

@ -658,6 +658,14 @@ static int init_send(struct rtmp_stream *stream)
obs_data_t *params = obs_encoder_get_settings(vencoder);
if (params) {
int bitrate = obs_data_get_int(params, "bitrate");
if (!bitrate) {
warn ("Video encoder didn't return a "
"valid bitrate, new network "
"code may function poorly. "
"Low latency mode disabled.");
stream->low_latency_mode = false;
bitrate = 10000;
}
total_bitrate += bitrate;
obs_data_release(params);
}
@ -668,6 +676,8 @@ static int init_send(struct rtmp_stream *stream)
obs_data_t *params = obs_encoder_get_settings(aencoder);
if (params) {
int bitrate = obs_data_get_int(params, "bitrate");
if (!bitrate)
bitrate = 160;
total_bitrate += bitrate;
obs_data_release(params);
}