Commit 26cfb659 authored by François Cartegnie's avatar François Cartegnie 🤞

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

parent 619d1d9d
......@@ -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 );
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment