[vlc-commits] codec: avcodec: drop frame internally

Francois Cartegnie git at videolan.org
Thu Apr 13 11:58:40 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Apr 13 10:30:24 2017 +0200| [3f5daf4d2f5501a5e8868bf2dbfccbe615cfdf5a] | committer: Francois Cartegnie

codec: avcodec: drop frame internally

output this is asynchronous.
nonsense to do this in a decoder push/pop sequence.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3f5daf4d2f5501a5e8868bf2dbfccbe615cfdf5a
---

 modules/codec/avcodec/video.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index c4dba69209..8454c78e90 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -868,6 +868,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
             p_block->i_dts = VLC_TS_INVALID;
         }
 
+#if LIBAVCODEC_VERSION_CHECK( 57, 0, 0xFFFFFFFFU, 64, 101 )
+        if( !b_need_output_picture )
+            pkt.flags |= AV_PKT_FLAG_DISCARD;
+#endif
+
         int ret = avcodec_send_packet(p_context, &pkt);
         if( ret != 0 && ret != AVERROR(EAGAIN) )
         {
@@ -945,13 +950,21 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
 
         update_late_frame_count( p_dec, p_block, current_time, i_pts);
 
-        if( !b_need_output_picture || ( !p_sys->p_va && !frame->linesize[0] ) ||
+        if( ( !p_sys->p_va && !frame->linesize[0] ) ||
            ( p_dec->b_frame_drop_allowed && (frame->flags & AV_FRAME_FLAG_CORRUPT) ) )
         {
             av_frame_free(&frame);
             continue;
         }
 
+#if !LIBAVCODEC_VERSION_CHECK( 57, 0, 0xFFFFFFFFU, 64, 101 )
+        if( !b_need_output_picture )
+        {
+            av_frame_free(&frame);
+            continue;
+        }
+#endif
+
         if( p_context->pix_fmt == AV_PIX_FMT_PAL8
          && !p_dec->fmt_out.video.p_palette )
         {



More information about the vlc-commits mailing list