mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-28 14:01:27 +00:00
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>
This commit is contained in:
parent
0352ff102d
commit
2cef68da69
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user