[vlc-commits] demux: hevc: only compute dts on new base layer VCL

Francois Cartegnie git at videolan.org
Tue Dec 22 17:49:54 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec 22 17:46:56 2015 +0100| [26cfb65905b8df3438767bd913d3190f83b8cb64] | committer: Francois Cartegnie

demux: hevc: only compute dts on new base layer VCL

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

 modules/demux/mpeg/hevc.c     |    4 +++-
 modules/packetizer/hevc_nal.h |    5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mpeg/hevc.c b/modules/demux/mpeg/hevc.c
index b3a2c8b..a0c5306 100644
--- a/modules/demux/mpeg/hevc.c
+++ b/modules/demux/mpeg/hevc.c
@@ -201,6 +201,7 @@ static int Demux( demux_t *p_demux)
             p_block_out->i_pts = VLC_TS_INVALID;
 
             uint8_t nal_type = (p_block_out->p_buffer[4] & 0x7E) >> 1;
+            uint8_t nal_layer = hevc_getNALLayer(&p_block_out->p_buffer[4]);
 
             /*Get fps from vps if available and not already forced*/
             if( p_sys->frame_rate_den == 0 &&
@@ -219,7 +220,8 @@ static int Demux( demux_t *p_demux)
             }
 
             /* Update DTS only on VCL NAL*/
-            if( nal_type < HEVC_NAL_VPS && p_sys->frame_rate_den )
+            if( nal_type < HEVC_NAL_VPS && p_sys->frame_rate_den &&
+                nal_layer == 0 )  /* Only on base layer */
             {
                 es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts );
                 date_Increment( &p_sys->dts, 1 );
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 5829905..f6e0262 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -135,6 +135,11 @@ static inline bool hevc_ishvcC( const uint8_t *p_buf, size_t i_buf )
            );
 }
 
+static inline uint8_t hevc_getNALLayer( const uint8_t *p_buf )
+{
+    return ((p_buf[0] & 0x01) << 6) | (p_buf[1] >> 3);
+}
+
 /* NAL decoding */
 typedef struct hevc_video_parameter_set_t hevc_video_parameter_set_t;
 typedef struct hevc_sequence_parameter_set_t hevc_sequence_parameter_set_t;



More information about the vlc-commits mailing list