mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
tsdemux: handle pcr_pid == 0x1fff
Streams without PCR make senses in HLS, where the playlist timestamps can be used to seek or calculate the duration. https://bugzilla.gnome.org/show_bug.cgi?id=608148
This commit is contained in:
parent
7a3d189250
commit
36e6590335
1 changed files with 18 additions and 1 deletions
|
@ -557,6 +557,7 @@ void
|
|||
mpegts_packetizer_clear (MpegTSPacketizer2 * packetizer)
|
||||
{
|
||||
guint i;
|
||||
MpegTSPCR *pcrtable;
|
||||
|
||||
packetizer->packet_size = 0;
|
||||
|
||||
|
@ -579,6 +580,10 @@ mpegts_packetizer_clear (MpegTSPacketizer2 * packetizer)
|
|||
packetizer->map_offset = 0;
|
||||
packetizer->last_in_time = GST_CLOCK_TIME_NONE;
|
||||
|
||||
pcrtable = packetizer->observations[packetizer->pcrtablelut[0x1fff]];
|
||||
if (pcrtable)
|
||||
pcrtable->base_time = GST_CLOCK_TIME_NONE;
|
||||
|
||||
/* Close current PCR group */
|
||||
PACKETIZER_GROUP_LOCK (packetizer);
|
||||
|
||||
|
@ -595,6 +600,7 @@ void
|
|||
mpegts_packetizer_flush (MpegTSPacketizer2 * packetizer, gboolean hard)
|
||||
{
|
||||
guint i;
|
||||
MpegTSPCR *pcrtable;
|
||||
GST_DEBUG ("Flushing");
|
||||
|
||||
if (packetizer->streams) {
|
||||
|
@ -614,6 +620,10 @@ mpegts_packetizer_flush (MpegTSPacketizer2 * packetizer, gboolean hard)
|
|||
packetizer->map_offset = 0;
|
||||
packetizer->last_in_time = GST_CLOCK_TIME_NONE;
|
||||
|
||||
pcrtable = packetizer->observations[packetizer->pcrtablelut[0x1fff]];
|
||||
if (pcrtable)
|
||||
pcrtable->base_time = GST_CLOCK_TIME_NONE;
|
||||
|
||||
/* Close current PCR group */
|
||||
PACKETIZER_GROUP_LOCK (packetizer);
|
||||
for (i = 0; i < MAX_PCR_OBS_CHANNELS; i++) {
|
||||
|
@ -2189,6 +2199,12 @@ mpegts_packetizer_pts_to_ts (MpegTSPacketizer2 * packetizer,
|
|||
PACKETIZER_GROUP_LOCK (packetizer);
|
||||
pcrtable = get_pcr_table (packetizer, pcr_pid);
|
||||
|
||||
if (!GST_CLOCK_TIME_IS_VALID (pcrtable->base_time) && pcr_pid == 0x1fff &&
|
||||
GST_CLOCK_TIME_IS_VALID (packetizer->last_in_time)) {
|
||||
pcrtable->base_time = packetizer->last_in_time;
|
||||
pcrtable->base_pcrtime = pts;
|
||||
}
|
||||
|
||||
/* Use clock skew if present */
|
||||
if (packetizer->calculate_skew
|
||||
&& GST_CLOCK_TIME_IS_VALID (pcrtable->base_time)) {
|
||||
|
@ -2206,7 +2222,8 @@ mpegts_packetizer_pts_to_ts (MpegTSPacketizer2 * packetizer,
|
|||
* That being said, this will only happen for the small interval of time
|
||||
* where PTS/DTS are wrapping just before we see the first reset/wrap PCR
|
||||
*/
|
||||
if (G_UNLIKELY (ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND))
|
||||
if (G_UNLIKELY (pcr_pid != 0x1fff &&
|
||||
ABSDIFF (res, pcrtable->last_pcrtime) > 15 * GST_SECOND))
|
||||
res = GST_CLOCK_TIME_NONE;
|
||||
else {
|
||||
GstClockTime tmp = pcrtable->base_time + pcrtable->skew;
|
||||
|
|
Loading…
Reference in a new issue