summaryrefslogtreecommitdiff
path: root/gst/mpegtsdemux/tsdemux.c
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2016-07-12 15:58:40 +0200
committerEdward Hervey <bilboed@bilboed.com>2016-08-03 17:15:41 +0200
commite2b98a7721c7c81fd08813d1c575fc4ad81df38e (patch)
tree5d64b8b144095a78aa197e015abbbe554f655778 /gst/mpegtsdemux/tsdemux.c
parent36e6590335ba0551f0e1882d58cf24429b2ec066 (diff)
downloadgstreamer-plugins-bad-e2b98a7721c7c81fd08813d1c575fc4ad81df38e.tar.gz
tsdemux: Fix GAP synchronization without a valid PCR PID
For streams that don't have a valid PCR PID, we just use the latest PTS from any given stream. https://bugzilla.gnome.org/show_bug.cgi?id=608148
Diffstat (limited to 'gst/mpegtsdemux/tsdemux.c')
-rw-r--r--gst/mpegtsdemux/tsdemux.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index 4aa20d586..a6d0fab0c 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -2691,13 +2691,19 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream)
* hit this will trigger a gap check */
if (G_UNLIKELY (stream->pts != GST_CLOCK_TIME_NONE &&
stream->pts > stream->gap_ref_pts + 2 * GST_SECOND)) {
- GstClockTime curpcr =
- mpegts_packetizer_get_current_time (MPEG_TS_BASE_PACKETIZER (demux),
- demux->program->pcr_pid);
- if (curpcr == GST_CLOCK_TIME_NONE || curpcr < 800 * GST_MSECOND)
- goto beach;
- curpcr -= 800 * GST_MSECOND;
- gst_ts_demux_check_and_sync_streams (demux, curpcr);
+ if (demux->program->pcr_pid != 0x1fff) {
+ GstClockTime curpcr =
+ mpegts_packetizer_get_current_time (MPEG_TS_BASE_PACKETIZER (demux),
+ demux->program->pcr_pid);
+ if (curpcr == GST_CLOCK_TIME_NONE || curpcr < 800 * GST_MSECOND)
+ goto beach;
+ curpcr -= 800 * GST_MSECOND;
+ /* Use the current PCR (with a safety margin) to sync against */
+ gst_ts_demux_check_and_sync_streams (demux, curpcr);
+ } else {
+ /* If we don't have a PCR track, just use the current stream PTS */
+ gst_ts_demux_check_and_sync_streams (demux, stream->pts);
+ }
}
}