Browse Source

obs-ffmpeg: Use core count for output threads by default

Recent FFmpeg versions seem to have changed the default thread count for
most codecs to 1.  Use the max core count by default as it was
originally.
jp9000 9 years ago
parent
commit
bd70e73c25
1 changed files with 6 additions and 1 deletions
  1. 6 1
      plugins/obs-ffmpeg/obs-ffmpeg-output.c

+ 6 - 1
plugins/obs-ffmpeg/obs-ffmpeg-output.c

@@ -242,7 +242,12 @@ static bool create_video_stream(struct ffmpeg_data *data)
 	context->pix_fmt        = closest_format;
 	context->pix_fmt        = closest_format;
 	context->colorspace     = data->config.color_space;
 	context->colorspace     = data->config.color_space;
 	context->color_range    = data->config.color_range;
 	context->color_range    = data->config.color_range;
-	context->thread_count   = 0;
+
+	if (context->thread_count == 1) {
+		int caps = context->codec->capabilities;
+		context->thread_count = !!(caps & AV_CODEC_CAP_AUTO_THREADS) ?
+			0 : av_cpu_count();
+	}
 
 
 	data->video->time_base = context->time_base;
 	data->video->time_base = context->time_base;