]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pthread_frame.c
Deprecate avctx.coded_frame
[ffmpeg] / libavcodec / pthread_frame.c
index a658f3eb7b3e8113f7e20e14a8bba853bbb13b7e..da339ccee87c891df3c3567ca557e2e5bdd37a32 100644 (file)
@@ -178,6 +178,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
 
     if (dst != src) {
         dst->time_base = src->time_base;
+        dst->framerate = src->framerate;
         dst->width     = src->width;
         dst->height    = src->height;
         dst->pix_fmt   = src->pix_fmt;
@@ -214,7 +215,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
     }
 
     if (for_user) {
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
         dst->coded_frame = src->coded_frame;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     } else {
         if (dst->codec->update_thread_context)
             err = dst->codec->update_thread_context(dst, src);
@@ -583,8 +588,15 @@ int ff_frame_thread_init(AVCodecContext *avctx)
     }
 
     avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext));
+    if (!fctx)
+        return AVERROR(ENOMEM);
 
     fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
+    if (!fctx->threads) {
+        av_freep(&avctx->internal->thread_ctx);
+        return AVERROR(ENOMEM);
+    }
+
     pthread_mutex_init(&fctx->buffer_mutex, NULL);
     fctx->delaying = 1;
 
@@ -600,6 +612,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
 
         p->frame = av_frame_alloc();
         if (!p->frame) {
+            av_freep(&copy);
             err = AVERROR(ENOMEM);
             goto error;
         }