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

Thomas Guillem git at videolan.org
Fri Mar 16 18:58:56 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 16 16:28:13 2018 +0100| [bc1ee3dbc4d50602485254f9f6e9ed2bdad54fbf] | committer: Thomas Guillem

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

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

 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 8c92d6bb5a..6c5c0d342f 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -164,6 +164,7 @@ struct decoder_sys_t
 
     bool                        b_vt_feed;
     bool                        b_vt_flush;
+    bool                        b_vt_need_keyframe;
     VTDecompressionSessionRef   session;
     CMVideoFormatDescriptionRef videoFormatDescription;
 
@@ -1391,6 +1392,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);
 
@@ -1423,6 +1425,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:
@@ -1973,7 +1976,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