[FFmpeg-devel] [PATCH 4/9] avcodec/videotoolbox: reset bitstream_size in end_frame

Aman Gupta ffmpeg at tmm1.net
Tue Sep 26 03:36:26 EEST 2017


From: Aman Gupta <aman at tmm1.net>

This allows decode_slice to be invoked multiple times before end_frame,
causing slices to accumulate before being fed into the VT decoder.

An upcoming commit will re-use decode_slice for SPS and PPS nalus, so
they can be propagated into the VT decoder session along with slide
data.
---
 libavcodec/videotoolbox.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 8ed56392cc..1de556f3e8 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -141,8 +141,6 @@ int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx,
     VTContext *vtctx = avctx->internal->hwaccel_priv_data;
     H264Context *h  = avctx->priv_data;
 
-    vtctx->bitstream_size = 0;
-
     if (h->is_avc == 1) {
         return videotoolbox_buffer_copy(vtctx, buffer, size);
     }
@@ -441,8 +439,10 @@ static int videotoolbox_h264_end_frame(AVCodecContext *avctx)
 {
     H264Context *h = avctx->priv_data;
     AVFrame *frame = h->cur_pic_ptr->f;
-
-    return videotoolbox_common_end_frame(avctx, frame);
+    VTContext *vtctx = avctx->internal->hwaccel_priv_data;
+    int ret = videotoolbox_common_end_frame(avctx, frame);
+    vtctx->bitstream_size = 0;
+    return ret;
 }
 
 static int videotoolbox_mpeg_start_frame(AVCodecContext *avctx,
-- 
2.13.5 (Apple Git-94)



More information about the ffmpeg-devel mailing list