[vlc-devel] [PATCH 2/2] demux: mkv: self discard prerolled discardable content

Steve Lhomme robux4 at gmail.com
Thu Aug 4 12:20:01 CEST 2016


LGTM

On Thu, Aug 4, 2016 at 12:02 PM, Francois Cartegnie <fcvlcdev at free.fr> wrote:
> ---
>  modules/demux/mkv/mkv.cpp  |  3 ++-
>  modules/demux/mkv/util.cpp | 21 ++++++++++++++-------
>  modules/demux/mkv/util.hpp |  3 ++-
>  3 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
> index 0c90e4b..a0f71be 100644
> --- a/modules/demux/mkv/mkv.cpp
> +++ b/modules/demux/mkv/mkv.cpp
> @@ -680,7 +680,8 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
>          if( p_block->i_dts < p_sys->i_start_pts )
>              p_block->i_flags |= BLOCK_FLAG_PREROLL;
>
> -        send_Block( p_demux, &track, p_block, i_number_frames, i_duration );
> +        send_Block( p_demux, &track, p_block,
> +                    i_number_frames, i_duration, b_discardable_picture );
>
>          /* use time stamp only for first block */
>          i_pts = ( track.i_default_duration )?
> diff --git a/modules/demux/mkv/util.cpp b/modules/demux/mkv/util.cpp
> index 1740db6..72885a6 100644
> --- a/modules/demux/mkv/util.cpp
> +++ b/modules/demux/mkv/util.cpp
> @@ -245,11 +245,24 @@ void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, m
>      }
>  }
>
> -void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsigned int i_number_frames, mtime_t i_duration )
> +void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block,
> +                 unsigned int i_number_frames, mtime_t i_duration, bool b_discardable )
>  {
>      demux_sys_t        *p_sys = p_demux->p_sys;
>      matroska_segment_c *p_segment = p_sys->p_current_vsegment->CurrentSegment();
>
> +    if( p_block->i_dts > VLC_TS_INVALID &&
> +        ( p_tk->fmt.i_cat == VIDEO_ES || p_tk->fmt.i_cat == AUDIO_ES ) )
> +    {
> +        p_tk->i_last_dts = p_block->i_dts;
> +    }
> +
> +    if( b_discardable && (p_block->i_flags & BLOCK_FLAG_PREROLL) )
> +    {
> +        block_Release(p_block);
> +        return;
> +    }
> +
>      if( p_tk->fmt.i_cat == AUDIO_ES && p_tk->i_chans_to_reorder )
>      {
>          aout_ChannelReorder( p_block->p_buffer, p_block->i_buffer,
> @@ -257,12 +270,6 @@ void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsig
>                               p_tk->pi_chan_table, p_tk->fmt.i_codec );
>      }
>
> -    if( p_block->i_dts > VLC_TS_INVALID &&
> -        ( p_tk->fmt.i_cat == VIDEO_ES || p_tk->fmt.i_cat == AUDIO_ES ) )
> -    {
> -        p_tk->i_last_dts = p_block->i_dts;
> -    }
> -
>      if( !p_tk->b_no_duration )
>      {
>          p_block->i_length = i_duration * p_tk->f_timecodescale *
> diff --git a/modules/demux/mkv/util.hpp b/modules/demux/mkv/util.hpp
> index 5867d1d..d83289c 100644
> --- a/modules/demux/mkv/util.hpp
> +++ b/modules/demux/mkv/util.hpp
> @@ -32,7 +32,8 @@ block_t *block_zlib_decompress( vlc_object_t *p_this, block_t *p_in_block );
>
>  block_t *MemToBlock( uint8_t *p_mem, size_t i_mem, size_t offset);
>  void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, mtime_t i_pts);
> -void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsigned int i_number_frames, mtime_t i_duration );
> +void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block,
> +                 unsigned int i_number_frames, mtime_t i_duration, bool b_discard = false );
>
>
>  struct real_audio_private
> --
> 2.7.4
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list