Browse code

mpeg12: Ignore slice threading if hwaccel is active

Slice threading does not work with hardware acceleration, as decoding
is per-picture. This fixes Bugzilla #542.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit 93a51984a27f3ba84d4e6f13d0c704ee9891603e)

Conflicts:
libavcodec/mpeg12dec.c

RĂ©mi Denis-Courmont authored on 2013/07/25 01:50:43
Showing 1 changed files
... ...
@@ -2277,7 +2277,8 @@ static int decode_chunks(AVCodecContext *avctx,
2277 2277
         buf_ptr = avpriv_mpv_find_start_code(buf_ptr, buf_end, &start_code);
2278 2278
         if (start_code > 0x1ff) {
2279 2279
             if (s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT) {
2280
-                if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
2280
+                if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
2281
+                    !avctx->hwaccel) {
2281 2282
                     int i;
2282 2283
                     av_assert0(avctx->thread_count > 1);
2283 2284
 
... ...
@@ -2337,7 +2338,8 @@ static int decode_chunks(AVCodecContext *avctx,
2337 2337
                 s2->intra_dc_precision= 3;
2338 2338
                 s2->intra_matrix[0]= 1;
2339 2339
             }
2340
-            if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) && s->slice_count) {
2340
+            if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
2341
+                !avctx->hwaccel && s->slice_count) {
2341 2342
                 int i;
2342 2343
 
2343 2344
                 avctx->execute(avctx, slice_decode_thread,
... ...
@@ -2504,7 +2506,8 @@ static int decode_chunks(AVCodecContext *avctx,
2504 2504
                     break;
2505 2505
                 }
2506 2506
 
2507
-                if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
2507
+                if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
2508
+                    !avctx->hwaccel) {
2508 2509
                     int threshold = (s2->mb_height * s->slice_count +
2509 2510
                                      s2->slice_context_count / 2) /
2510 2511
                                     s2->slice_context_count;