summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-01-16 23:34:03 +0200
committerUoti Urpala <uau@mplayer2.org>2012-01-17 00:07:27 +0200
commitc4093e7d872d2daa485029b8b36661411387ef37 (patch)
tree2a584c94d46975f11a64376860f39bffdb6af958
parent6c57eeb7ad496afd1fd74b1133542e40e86b0875 (diff)
downloadmpv-c4093e7d872d2daa485029b8b36661411387ef37.tar.bz2
mpv-c4093e7d872d2daa485029b8b36661411387ef37.tar.xz
vd_ffmpeg: explicitly set thread count even if 1
Libav started automatically enabling threaded decoding a while ago. This is not safe, as it means callbacks can suddenly get called from other threads and outside calls to libavcodec. We need to know when threading will be used and disable thread-unsafe callbacks in those cases. Explicitly set thread count to 1 instead of leaving it at 0 (which triggers the autodetection) when we are not requesting more threads; this should make sure that autodetection on libavcodec side will not be used.
-rw-r--r--libmpcodecs/vd_ffmpeg.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index bed70543b2..0688aae7cc 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -315,8 +315,7 @@ static int init(sh_video_t *sh)
if (sh->bih)
avctx->bits_per_coded_sample = sh->bih->biBitCount;
- if (lavc_param->threads > 1)
- avctx->thread_count = lavc_param->threads;
+ avctx->thread_count = lavc_param->threads;
/* open it */
if (avcodec_open(avctx, lavc_codec) < 0) {