summaryrefslogtreecommitdiff
path: root/gst/mpegdemux/gstmpegtsdemux.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/mpegdemux/gstmpegtsdemux.c')
-rw-r--r--gst/mpegdemux/gstmpegtsdemux.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c
index 394d0b36d..5ee8daeb1 100644
--- a/gst/mpegdemux/gstmpegtsdemux.c
+++ b/gst/mpegdemux/gstmpegtsdemux.c
@@ -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);
@@ -1127,7 +1128,7 @@ gst_mpegts_demux_add_all_streams (GstMpegTSDemux * demux, GstClockTime pts)
}
if (!gst_mpegts_demux_fill_stream (stream, stream->filter.id,
stream->stream_type)) {
- GST_ERROR ("Unknown type for PID 0x%04x", stream->PID);
+ GST_WARNING_OBJECT (demux, "Unknown type for PID 0x%04x", stream->PID);
/* ignore */
continue;
}
@@ -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)
{