diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-12-29 21:28:50 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-01-05 15:35:39 +0100 |
commit | 2cef68da69a17ed09c313ba3c3850ec1cc0a80e0 (patch) | |
tree | 6a07e94024e3564d92f5816c0ec0f69b16b62cde /libavcodec | |
parent | 0352ff102d62ee94e79e0baaf64d5ad4e66f907b (diff) | |
download | ffmpeg-2cef68da69a17ed09c313ba3c3850ec1cc0a80e0.tar.gz |
vda: error out if decoded CVPixelBuffer is empty
On some video samples, VDA silently fails to decode frames and returns
kVDADecoderNoErr. Error out in these cases to avoid producing AVFrames with
empty planes.
Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vda_h264.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c index c7f6a7432e..acefde67af 100644 --- a/libavcodec/vda_h264.c +++ b/libavcodec/vda_h264.c @@ -345,24 +345,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; } |