[vlc-commits] demux: wav: fix wrong pts after a seek
Thomas Guillem
git at videolan.org
Mon Mar 16 13:31:38 CET 2020
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 12 14:51:07 2020 +0100| [7bad2a867f01786ace2e8ff074e5dcc19fb96063] | committer: Thomas Guillem
demux: wav: fix wrong pts after a seek
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7bad2a867f01786ace2e8ff074e5dcc19fb96063
---
modules/demux/wav.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index f91a3c3abc..4b0623412f 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -142,10 +142,33 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( p_sys->i_data_size > 0 )
i_end = p_sys->i_data_pos + p_sys->i_data_size;
- return demux_vaControlHelper( p_demux->s, p_sys->i_data_pos, i_end,
- p_sys->fmt.i_bitrate,
- p_sys->fmt.audio.i_blockalign,
- i_query, args );
+ int ret = demux_vaControlHelper( p_demux->s, p_sys->i_data_pos, i_end,
+ p_sys->fmt.i_bitrate,
+ p_sys->fmt.audio.i_blockalign,
+ i_query, args );
+ if( ret != VLC_SUCCESS )
+ return ret;
+
+ /* Update the date to the new seek point */
+ switch( i_query )
+ {
+ case DEMUX_SET_POSITION:
+ case DEMUX_SET_TIME:
+ {
+ uint64_t ofs = vlc_stream_Tell( p_demux->s );
+ if( unlikely( ofs < p_sys->i_data_pos ) )
+ return VLC_SUCCESS;
+
+ ofs -= p_sys->i_data_pos;
+ vlc_tick_t pts =
+ vlc_tick_from_samples( ofs * 8, p_sys->fmt.i_bitrate );
+ date_Set( &p_sys->pts, pts );
+ break;
+ }
+ default:
+ break;
+ }
+ return VLC_SUCCESS;
}
static int ChunkSkip( demux_t *p_demux, uint32_t i_size )
More information about the vlc-commits
mailing list