From 77eab79386f96852bed8f6fe04a799e36e0acfda Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Thu, 12 Jun 2014 15:31:50 +0200 Subject: ff_video_decoder: fix multithreading #6. Make sure thread count is sane. --- src/combined/ffmpeg/ff_video_decoder.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 6c0918007..b36075a4f 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -916,6 +916,10 @@ static void thread_count_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; class->thread_count = entry->num_value; + if (class->thread_count < 1) + class->thread_count = 1; + else if (class->thread_count > 8) + class->thread_count = 8; } static void pp_quality_cb(void *user_data, xine_cfg_entry_t *entry) { @@ -2623,6 +2627,10 @@ void *init_video_plugin (xine_t *xine, void *data) { "decoding thread per logical CPU (typically 1 to 4).\n" "A change of this setting will take effect with playing the next stream."), 10, thread_count_cb, this); + if (this->thread_count < 1) + this->thread_count = 1; + else if (this->thread_count > 8) + this->thread_count = 8; this->skip_loop_filter_enum = xine->config->register_enum(config, "video.processing.ffmpeg_skip_loop_filter", 0, (char **)skip_loop_filter_enum_names, -- cgit v1.2.3