]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_refs.c
avcodec/h264, videotoolbox: do not return invalid frames on failure
[ffmpeg] / libavcodec / h264_refs.c
index 619f2edf8448c947d253719421c47fe792554281..9d0641a0dbea58a11b5ec6f8806486b19903766f 100644 (file)
@@ -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++) {