[vlc-commits] packetizer: hevc: hevc_get_xps_id should work on nal data only

Francois Cartegnie git at videolan.org
Tue Nov 21 18:21:43 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Nov 21 16:39:43 2017 +0100| [991db3b94305ecadccc32003ebee4752ced48ed1] | committer: Francois Cartegnie

packetizer: hevc: hevc_get_xps_id should work on nal data only

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

 modules/packetizer/hevc.c     | 5 ++++-
 modules/packetizer/hevc_nal.c | 2 +-
 modules/packetizer/hevc_nal.h | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 300318ac33..83c782a856 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -643,7 +643,10 @@ static block_t * ParseAUHead(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_na
         case HEVC_NAL_PPS:
         {
             uint8_t i_id;
-            if(hevc_get_xps_id(p_nalb->p_buffer, p_nalb->i_buffer, &i_id))
+            const uint8_t *p_xps = p_nalb->p_buffer;
+            size_t i_xps = p_nalb->i_buffer;
+            if(hxxx_strip_AnnexB_startcode(&p_xps, &i_xps) &&
+               hevc_get_xps_id(p_nalb->p_buffer, p_nalb->i_buffer, &i_id))
                 InsertXPS(p_dec, i_nal_type, i_id, p_nalb);
             break;
         }
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 6a098c388d..f7ad2a5406 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -515,7 +515,7 @@ static bool hevc_parse_vui_parameters_rbsp( bs_t *p_bs, hevc_vui_parameters_t *p
 /* Shortcut for retrieving vps/sps/pps id */
 bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id)
 {
-    if(unlikely(!hxxx_strip_AnnexB_startcode(&p_buf, &i_buf) || i_buf < 3))
+    if(i_buf < 3)
         return false;
     /* No need to lookup convert from emulation for that data */
     uint8_t i_nal_type = hevc_getNALType(p_buf);
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 9eff3e714e..047f554dd6 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -179,7 +179,7 @@ uint8_t hevc_get_slice_pps_id( const hevc_slice_segment_header_t * );
 uint8_t * hevc_hvcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
                                    size_t *pi_res, uint8_t *pi_nal_length_size );
 
-bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id);
+bool hevc_get_xps_id(const uint8_t *p_nalbuf, size_t i_nalbuf, uint8_t *pi_id);
 bool hevc_get_sps_profile_tier_level( const hevc_sequence_parameter_set_t *,
                                       uint8_t *pi_profile, uint8_t *pi_level );
 bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *, unsigned *p_w, unsigned *p_h,



More information about the vlc-commits mailing list