[vlc-commits] videotoolbox: h264: fix playback when slices are not tagged

Thomas Guillem git at videolan.org
Sun Jul 1 20:43:54 CEST 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 16 16:28:13 2018 +0100| [8c5532d5a45271b5796f53e0f3d9d4b006270a39] | committer: Jean-Baptiste Kempf

videotoolbox: h264: fix playback when slices are not tagged

Cf. 497efd3dafb94d6d7eece88955218813883e2ae4

We can't do that for HEVC (since it may cause iOS crashes) but there was no
report of keyframes issues with H264.

Fixes #19967

(cherry picked from commit bc1ee3dbc4d50602485254f9f6e9ed2bdad54fbf)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8c5532d5a45271b5796f53e0f3d9d4b006270a39
---

 modules/codec/videotoolbox.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 64e5815516..3cbf475511 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -166,6 +166,7 @@ struct decoder_sys_t
 
     bool                        b_vt_feed;
     bool                        b_vt_flush;
+    bool                        b_vt_need_keyframe;
     VTDecompressionSessionRef   session;
     CMVideoFormatDescriptionRef videoFormatDescription;
 
@@ -1396,6 +1397,7 @@ static int OpenDecoder(vlc_object_t *p_this)
     p_sys->pic_holder->nb_field_out = 0;
     p_sys->pic_holder->closed = false;
     p_sys->pic_holder->field_reorder_max = p_sys->i_pic_reorder_max * 2;
+    p_sys->b_vt_need_keyframe = false;
 
     vlc_mutex_init(&p_sys->lock);
 
@@ -1428,6 +1430,7 @@ static int OpenDecoder(vlc_object_t *p_this)
             p_sys->pf_get_extradata = GetDecoderExtradataHEVC;
             p_sys->pf_fill_reorder_info = FillReorderInfoHEVC;
             p_sys->b_poc_based_reorder = true;
+            p_sys->b_vt_need_keyframe = true;
             break;
 
         case kCMVideoCodecType_MPEG4Video:
@@ -1975,7 +1978,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
         }
     }
 
-    if (!p_sys->b_vt_feed && !p_info->b_keyframe)
+    if (!p_sys->b_vt_feed && p_sys->b_vt_need_keyframe && !p_info->b_keyframe)
     {
         free(p_info);
         goto skip;



More information about the vlc-commits mailing list