diff mbox

[FFmpeg-devel] lavc/videotoolbox: fix failure to decode PAFF

Message ID 20180329041928.59469-1-rodger.combs@gmail.com
State Accepted
Commit 4c0798578cab410b4ad9c27bc47b5e09c9a66aba
Headers show

Commit Message

Rodger Combs March 29, 2018, 4:19 a.m. UTC
---
 libavcodec/videotoolbox.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Aman Karmani April 4, 2018, 1:24 a.m. UTC | #1
On Wed, Mar 28, 2018 at 9:19 PM, Rodger Combs <rodger.combs@gmail.com>
wrote:

> ---
>  libavcodec/videotoolbox.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index f82c31c5df..57b6698e1b 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -326,11 +326,8 @@ static int videotoolbox_set_frame(AVCodecContext
> *avctx, AVFrame *frame)
>
>      CVPixelBufferRef *ref = (CVPixelBufferRef *)frame->buf[0]->data;
>
> -    if (*ref) {
> -        av_log(avctx, AV_LOG_ERROR, "videotoolbox: frame already set?\n");
> -        av_frame_unref(frame);
> -        return AVERROR_EXTERNAL;
> -    }
> +    if (*ref)
> +        CVPixelBufferRelease(*ref);
>
>      *ref = vtctx->frame;
>      vtctx->frame = NULL;
>

LGTM. Do you have a sample PAFF file that now works after this patch?

Aman


> --
> 2.16.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
diff mbox

Patch

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index f82c31c5df..57b6698e1b 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -326,11 +326,8 @@  static int videotoolbox_set_frame(AVCodecContext *avctx, AVFrame *frame)
 
     CVPixelBufferRef *ref = (CVPixelBufferRef *)frame->buf[0]->data;
 
-    if (*ref) {
-        av_log(avctx, AV_LOG_ERROR, "videotoolbox: frame already set?\n");
-        av_frame_unref(frame);
-        return AVERROR_EXTERNAL;
-    }
+    if (*ref)
+        CVPixelBufferRelease(*ref);
 
     *ref = vtctx->frame;
     vtctx->frame = NULL;