summaryrefslogtreecommitdiff
path: root/libavcodec/vda_h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-06 22:12:53 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-06 22:13:39 +0100
commit2ab6deb36f1904cf97b8f276414043b2f9574135 (patch)
tree96dac194b4076b14f229efda39e2d56752525926 /libavcodec/vda_h264.c
parent9198397115bfef265ebb1ab04e4991defa908d11 (diff)
parent2cef68da69a17ed09c313ba3c3850ec1cc0a80e0 (diff)
Merge commit '2cef68da69a17ed09c313ba3c3850ec1cc0a80e0'
* commit '2cef68da69a17ed09c313ba3c3850ec1cc0a80e0': vda: error out if decoded CVPixelBuffer is empty Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vda_h264.c')
-rw-r--r--libavcodec/vda_h264.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c
index 61fb3c02c9..081c366013 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;
}