threads: Perform the generic progress cleanup more carefully.
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 11 Feb 2012 19:14:33 +0000 (20:14 +0100)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Sun, 13 May 2012 12:09:29 +0000 (14:09 +0200)
The cleanup is only done now when
a picture is returned (assuming that it has to be done when its returned)
a error is returned (assuming that there will be no further progress on the frame)
the codec is not h264 (this is still needed due to some deadlocks in realvideo)

This fixes a decoding regression with 00017.MTS

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 18a7f7465e7e6b9c3688ffc23230ae7a0639a771)

libavcodec/pthread.c

index 6ae763d..c58222b 100644 (file)
@@ -390,7 +390,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
 
         pthread_mutex_lock(&p->progress_mutex);
         for (i = 0; i < MAX_BUFFERS; i++)
-            if (p->progress_used[i]) {
+            if (p->progress_used[i] && (p->got_frame || p->result<0 || avctx->codec_id != CODEC_ID_H264)) {
                 p->progress[i][0] = INT_MAX;
                 p->progress[i][1] = INT_MAX;
             }