[vlc-commits] demux: flac: set pcr before sending packet
Francois Cartegnie
git at videolan.org
Thu Feb 9 23:05:28 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb 9 23:01:27 2017 +0100| [06e7c4bdb15bea15c4f3bf6824b9fb3953c82b84] | committer: Francois Cartegnie
demux: flac: set pcr before sending packet
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06e7c4bdb15bea15c4f3bf6824b9fb3953c82b84
---
modules/demux/flac.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index fc2148e..b5cab9a 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -142,7 +142,7 @@ static int Open( vlc_object_t * p_this )
p_sys->p_packetizer = NULL;
p_sys->p_meta = NULL;
p_sys->i_length = 0;
- p_sys->i_pts = 0;
+ p_sys->i_pts = VLC_TS_INVALID;
p_sys->p_es = NULL;
p_sys->p_current_block = NULL;
TAB_INIT( p_sys->i_seekpoint, p_sys->seekpoint );
@@ -253,13 +253,16 @@ static int Demux( demux_t *p_demux )
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->p_packetizer->fmt_out);
}
- p_sys->i_pts = p_block_out->i_dts;
-
/* set PCR */
- es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts );
+ if( unlikely(p_sys->i_pts == VLC_TS_INVALID) )
+ es_out_Control( p_demux->out, ES_OUT_SET_PCR, __MAX(p_block_out->i_dts - 1, VLC_TS_0) );
+
+ p_sys->i_pts = p_block_out->i_dts;
es_out_Send( p_demux->out, p_sys->p_es, p_block_out );
+ es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_pts );
+
p_block_out = p_next;
}
break;
@@ -362,6 +365,7 @@ static int ControlSetTime( demux_t *p_demux, int64_t i_time )
if( vlc_stream_Seek( p_demux->s, p_sys->seekpoint[i]->i_byte_offset+p_sys->i_data_pos + i_delta_offset ) )
return VLC_EGENERIC;
}
+ p_sys->i_pts = VLC_TS_INVALID;
p_sys->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list