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.
上级 4c58dcf6
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册