Browse Source

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.
Richard Stanway 8 years ago
parent
commit
41a1b09988
1 changed files with 10 additions and 0 deletions
  1. 10 0
      plugins/obs-outputs/rtmp-stream.c

+ 10 - 0
plugins/obs-outputs/rtmp-stream.c

@@ -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);
 			}