summaryrefslogtreecommitdiff
path: root/libavcodec/h264_refs.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-11-20 11:30:18 +0100
committerwm4 <nfxjfg@googlemail.com>2015-11-20 11:30:18 +0100
commit9747219958060d8c4f697df62e7f172c2a77e6c7 (patch)
tree8f9a3a48aac29fc0521cf5d46e8dfdfa59aeca68 /libavcodec/h264_refs.c
parent8eadabf941a908101c69706063415d4ab6a630da (diff)
avcodec/h264, videotoolbox: do not return invalid frames on failure
If videotoolbox_common_end_frame failed, then the AVFrame was returned to the API user with the dummy buffer (in AVFrame.buf[0]) still set, and the decode call indicating success. These "half-set" AVFrames with dummy buffer are a videotoolbox specific hack, because the decoder requires an allocated AVFrame for its internal logic. Videotoolbox on the other hand allocates its frame itself internally, and outputs it only on end_frame. At this point, the dummy buffer is replaced with the real frame (unless decoding fails).
Diffstat (limited to 'libavcodec/h264_refs.c')
-rw-r--r--libavcodec/h264_refs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 619f2edf84..9d0641a0db 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -515,7 +515,8 @@ void ff_h264_remove_all_refs(H264Context *h)
if (h->short_ref_count && !h->last_pic_for_ec.f->data[0]) {
ff_h264_unref_picture(h, &h->last_pic_for_ec);
- ff_h264_ref_picture(h, &h->last_pic_for_ec, h->short_ref[0]);
+ if (h->short_ref[0]->f->buf[0])
+ ff_h264_ref_picture(h, &h->last_pic_for_ec, h->short_ref[0]);
}
for (i = 0; i < h->short_ref_count; i++) {