diff options
-rw-r--r-- | libhb/decavcodec.c | 6 | ||||
-rw-r--r-- | libhb/hb.c | 4 | ||||
-rw-r--r-- | libhb/stream.c | 1 |
3 files changed, 8 insertions, 3 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 568d2c7c4..6d9632bab 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -1165,7 +1165,8 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, hb_ff_set_sample_fmt( pv->context, codec ); hb_avcodec_open( pv->context, codec, 0 ); hb_avcodec_close( pv->context ); - hb_avcodec_open( pv->context, codec, HB_FFMPEG_THREADS_AUTO ); + // disable threaded decoding for scan, can cause crashes + hb_avcodec_open( pv->context, codec, pv->job ? HB_FFMPEG_THREADS_AUTO : 0 ); } if( in->start >= 0 ) @@ -1284,7 +1285,8 @@ static void init_ffmpeg_context( hb_work_object_t *w ) { AVCodec *codec = avcodec_find_decoder( pv->context->codec_id ); hb_ff_set_sample_fmt( pv->context, codec ); - hb_avcodec_open( pv->context, codec, HB_FFMPEG_THREADS_AUTO ); + // disable threaded decoding for scan, can cause crashes + hb_avcodec_open( pv->context, codec, pv->job ? HB_FFMPEG_THREADS_AUTO : 0 ); } // set up our best guess at the frame duration. // the frame rate in the codec is usually bogus but it's sometimes diff --git a/libhb/hb.c b/libhb/hb.c index b1050e0e0..981a2ed21 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -111,6 +111,10 @@ int hb_avcodec_open(AVCodecContext *avctx, AVCodec *codec, int thread_count) avctx->thread_type = FF_THREAD_FRAME|FF_THREAD_SLICE; avctx->thread_safe_callbacks = 1; } + else + { + avctx->thread_count = 1; + } ret = avcodec_open(avctx, codec); return ret; diff --git a/libhb/stream.c b/libhb/stream.c index 48fbe68a7..f48b61923 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -3123,7 +3123,6 @@ static void ffmpeg_add_codec( hb_stream_t *stream, int stream_index ) context->error_concealment = FF_EC_GUESS_MVS|FF_EC_DEBLOCK; AVCodec *codec = avcodec_find_decoder( context->codec_id ); hb_ff_set_sample_fmt( context, codec ); - hb_avcodec_open( context, codec, HB_FFMPEG_THREADS_AUTO ); } // The ffmpeg stream reader / parser shares a lot of state with the |