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
This commit is contained in:
Edward Hervey 2016-07-12 15:58:40 +02:00 committed by Edward Hervey
parent 36e6590335
commit e2b98a7721

View file

@ -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);
}
}
}