]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pthread.c
eamad: release the reference frame on video size changes
[ffmpeg] / libavcodec / pthread.c
index fb5c2f1e1e213916ac971e8d625ae8d6a621ac4c..454e51f55519edd88827e6d8645e8a40a80c54aa 100644 (file)
@@ -32,6 +32,7 @@
 #include <pthread.h>
 
 #include "avcodec.h"
+#include "internal.h"
 #include "thread.h"
 
 typedef int (action_func)(AVCodecContext *c, void *arg);
@@ -599,6 +600,10 @@ void ff_thread_finish_setup(AVCodecContext *avctx) {
 
     if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return;
 
+    if(p->state == STATE_SETUP_FINISHED){
+        av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n");
+    }
+
     pthread_mutex_lock(&p->progress_mutex);
     p->state = STATE_SETUP_FINISHED;
     pthread_cond_broadcast(&p->progress_cond);
@@ -783,6 +788,8 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
 
     f->owner = avctx;
 
+    ff_init_buffer_info(avctx, f);
+
     if (!(avctx->active_thread_type&FF_THREAD_FRAME)) {
         f->thread_opaque = NULL;
         return avctx->get_buffer(avctx, f);