mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
mpegtsdemux: only offset timestamps when live
This code is to sync to a live source when there is a delay between start and when we receive the first buffer, so it does not make sense in a non live case. This fixes playback of streams where the input timestamps are based off some arbitrary offset. https://bugzilla.gnome.org/show_bug.cgi?id=663756
This commit is contained in:
parent
811a2ef7aa
commit
09f0860a10
1 changed files with 12 additions and 5 deletions
|
@ -191,6 +191,7 @@ static gboolean gst_mpegts_demux_src_event (GstPad * pad, GstEvent * event);
|
|||
static GstFlowReturn gst_mpegts_demux_chain (GstPad * pad, GstBuffer * buffer);
|
||||
static gboolean gst_mpegts_demux_sink_setcaps (GstPad * pad, GstCaps * caps);
|
||||
|
||||
static gboolean gst_mpegts_demux_is_live (GstMpegTSDemux * demux);
|
||||
static GstClock *gst_mpegts_demux_provide_clock (GstElement * element);
|
||||
static gboolean gst_mpegts_demux_src_pad_query (GstPad * pad, GstQuery * query);
|
||||
static const GstQueryType *gst_mpegts_demux_src_pad_query_type (GstPad * pad);
|
||||
|
@ -1279,12 +1280,14 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first,
|
|||
|
||||
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (demux->in_gap))) {
|
||||
if (GST_CLOCK_TIME_IS_VALID (demux->first_buf_ts)
|
||||
&& GST_CLOCK_TIME_IS_VALID (filter->pts)) {
|
||||
&& GST_CLOCK_TIME_IS_VALID (filter->pts)
|
||||
&& gst_mpegts_demux_is_live (demux)) {
|
||||
int i;
|
||||
GstClockTime pts = GST_CLOCK_TIME_NONE;
|
||||
for (i = 0; i < MPEGTS_MAX_PID + 1; i++) {
|
||||
GstMpegTSStream *stream = demux->streams[i];
|
||||
if (stream && (pts == GST_CLOCK_TIME_NONE || stream->last_time < pts)) {
|
||||
if (stream && stream->last_time > 0 && (pts == GST_CLOCK_TIME_NONE
|
||||
|| stream->last_time < pts)) {
|
||||
pts = stream->last_time;
|
||||
}
|
||||
}
|
||||
|
@ -2952,14 +2955,12 @@ gst_mpegts_demux_sink_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_mpegts_demux_provides_clock (GstElement * element)
|
||||
gst_mpegts_demux_is_live (GstMpegTSDemux * demux)
|
||||
{
|
||||
GstMpegTSDemux *demux;
|
||||
GstQuery *query;
|
||||
gboolean is_live = FALSE;
|
||||
GstPad *peer;
|
||||
|
||||
demux = GST_MPEGTS_DEMUX (element);
|
||||
query = gst_query_new_latency ();
|
||||
peer = gst_pad_get_peer (demux->sinkpad);
|
||||
|
||||
|
@ -2973,6 +2974,12 @@ gst_mpegts_demux_provides_clock (GstElement * element)
|
|||
return is_live;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_mpegts_demux_provides_clock (GstElement * element)
|
||||
{
|
||||
return gst_mpegts_demux_is_live (GST_MPEGTS_DEMUX (element));
|
||||
}
|
||||
|
||||
static GstClock *
|
||||
gst_mpegts_demux_provide_clock (GstElement * element)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue