[vlc-devel] [PATCH 2/4] demux: mkv: truncate length on preskip, don't set negative pts

Francois Cartegnie fcvlcdev at free.fr
Thu Oct 1 12:05:45 CEST 2020


Le 01/10/2020 à 09:10, Steve Lhomme a écrit :
>>> +            if( track.i_codec_delay ) /* Handle pre-skip */
>>> +            {
>>> +                if( i_pts > track.i_codec_delay )
>>> +                {
>>> +                    p_block->i_length -= track.i_codec_delay;
>>
>> That looks suspicious. The delay should influence the PTS/DTS, not the
>> duration of a block. If you wanted to skip a part at the beginning of
>> a block you would also need to specify the offset to skip.

We have no per block metadata for that purpose, so that's how it is
notified to decoder.

Preskip is the amount of data which is used to initialize the decoder,
and does not output audio samples. The length of that block is minus prekip.

>>> +                }
>>> +                else
>>> +                {
>>> +                    vlc_tick_t skipped = i_pts - track.i_codec_delay;
>>
>> Here i_pts <= track.i_codec_delay. So this value is negative.
>>
>>> +                    if( p_block->i_length <= skipped )
>>
>> So this is always false.
> 
> OK it's not negative if i_pts == track.i_codec_delay. I think in this
> case we should not consider it as pre-roll. And CodecDelay is *not* a
> preroll anyway.

The preskip data skip offsets time by 20ms, so that makes no difference.
For opus and vorbis it is a delay from the pts.

>>
>>> +                    {
>>> +                        p_block->i_length = 0;
>>> +                        p_block->i_flags |= BLOCK_FLAG_PREROLL;
>>> +                    }
>>> +                    else p_block->i_length -= skipped;
>>
>> The block length is always expanded.
>>


-- 
Francois Cartegnie
VideoLAN - VLC Developer


More information about the vlc-devel mailing list