[vlc-devel] [PATCH] scaletempo: also fix pts
Thomas Guillem
thomas at gllm.fr
Tue Feb 19 18:07:18 CET 2019
---
modules/audio_filter/scaletempo.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/modules/audio_filter/scaletempo.c b/modules/audio_filter/scaletempo.c
index bb6f703088..dd8401e07a 100644
--- a/modules/audio_filter/scaletempo.c
+++ b/modules/audio_filter/scaletempo.c
@@ -129,6 +129,8 @@ typedef struct
void *buf_pre_corr;
void *table_window;
unsigned(*best_overlap_offset)( filter_t *p_filter );
+
+ vlc_tick_t i_last_pts;
#ifdef PITCH_SHIFTER
/* pitch */
filter_t * resampler;
@@ -434,6 +436,7 @@ static int Open( vlc_object_t *p_this )
p_sys->bytes_queued = 0;
p_sys->bytes_to_slide = 0;
p_sys->frames_stride_error = 0;
+ p_sys->i_last_pts = VLC_TICK_INVALID;
if( reinit_buffers( p_filter ) != VLC_SUCCESS )
{
@@ -588,13 +591,20 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
offset_in += fill_queue( p_filter, p_in_buf->p_buffer,
p_in_buf->i_buffer, offset_in );
}
+
+ const vlc_tick_t i_pts = p->i_last_pts != VLC_TICK_INVALID ?
+ p->i_last_pts : p_in_buf->i_pts;
+ p->i_last_pts = VLC_TICK_INVALID;
+
p_out_buf->i_buffer = bytes_out;
p_out_buf->i_nb_samples = bytes_out / p->bytes_per_frame;
- p_out_buf->i_dts = p_in_buf->i_dts;
- p_out_buf->i_pts = p_in_buf->i_pts;
+ p_out_buf->i_dts = i_pts;
+ p_out_buf->i_pts = i_pts;
p_out_buf->i_length = p_in_buf->i_length * p_out_buf->i_buffer
/ p_in_buf->i_buffer;
}
+ else if( p->i_last_pts == VLC_TICK_INVALID )
+ p->i_last_pts = p_in_buf->i_pts;
block_Release( p_in_buf );
return p_out_buf;
--
2.20.1
More information about the vlc-devel
mailing list