X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fvda_h264.c;h=081c3660136feca6424c551a494ae792144516cf;hb=4f664d8aae8ccca33f39c2515484bd03e9d3f80d;hp=61fb3c02c959dfce2f7fd4667f89ef98ca684e21;hpb=f4cc19cdd082aa07db2f6fd1c5fbc2b674a74a63;p=ffmpeg diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c index 61fb3c02c95..081c3660136 100644 --- a/libavcodec/vda_h264.c +++ b/libavcodec/vda_h264.c @@ -380,24 +380,25 @@ static int vda_h264_end_frame(AVCodecContext *avctx) CFRelease(coded_frame); + if (!vda->frame) + return AVERROR_UNKNOWN; + if (status != kVDADecoderNoErr) { av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status); return AVERROR_UNKNOWN; } - if (vda->frame) { - av_buffer_unref(&frame->buf[0]); + av_buffer_unref(&frame->buf[0]); - frame->buf[0] = av_buffer_create((uint8_t*)vda->frame, - sizeof(vda->frame), - release_buffer, NULL, - AV_BUFFER_FLAG_READONLY); - if (!frame->buf) - return AVERROR(ENOMEM); + frame->buf[0] = av_buffer_create((uint8_t*)vda->frame, + sizeof(vda->frame), + release_buffer, NULL, + AV_BUFFER_FLAG_READONLY); + if (!frame->buf) + return AVERROR(ENOMEM); - frame->data[3] = (uint8_t*)vda->frame; - vda->frame = NULL; - } + frame->data[3] = (uint8_t*)vda->frame; + vda->frame = NULL; return 0; }