mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
tsparse: fix timestamps not updating after a PMT change
The PCRs stay locked onto the same PID as before the change, but the relevant PID has no reason to be the same after it. https://bugzilla.gnome.org/show_bug.cgi?id=745102
This commit is contained in:
parent
ade79a9ad2
commit
68f57d20b9
2 changed files with 18 additions and 3 deletions
|
@ -234,8 +234,10 @@ mpegts_parse_reset (MpegTSBase * base)
|
|||
|
||||
parse->current_pcr = GST_CLOCK_TIME_NONE;
|
||||
parse->previous_pcr = GST_CLOCK_TIME_NONE;
|
||||
parse->base_pcr = GST_CLOCK_TIME_NONE;
|
||||
parse->bytes_since_pcr = 0;
|
||||
parse->pcr_pid = parse->user_pcr_pid;
|
||||
parse->ts_offset = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -360,6 +362,9 @@ push_event (MpegTSBase * base, GstEvent * event)
|
|||
if (G_UNLIKELY (GST_EVENT_TYPE (event) == GST_EVENT_EOS))
|
||||
drain_pending_buffers (parse, TRUE);
|
||||
|
||||
if (G_UNLIKELY (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT))
|
||||
parse->ts_offset = 0;
|
||||
|
||||
for (tmp = parse->srcpads; tmp; tmp = tmp->next) {
|
||||
GstPad *pad = (GstPad *) tmp->data;
|
||||
if (pad) {
|
||||
|
@ -680,8 +685,12 @@ mpegts_parse_inspect_packet (MpegTSBase * base, MpegTSPacketizerPacket * packet)
|
|||
if (parse->pcr_pid == -1)
|
||||
parse->pcr_pid = packet->pid;
|
||||
/* Check the PCR-PID matches the program we want for multiple programs */
|
||||
if (parse->pcr_pid == packet->pid)
|
||||
if (parse->pcr_pid == packet->pid) {
|
||||
parse->current_pcr = PCRTIME_TO_GSTTIME (packet->pcr);
|
||||
if (parse->base_pcr == GST_CLOCK_TIME_NONE) {
|
||||
parse->base_pcr = parse->current_pcr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -807,8 +816,8 @@ drain_pending_buffers (MpegTSParse2 * parse, gboolean drain_all)
|
|||
"InputTS %" GST_TIME_FORMAT " out %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GST_BUFFER_PTS (buffer)), GST_TIME_ARGS (out_ts));
|
||||
|
||||
GST_BUFFER_PTS (buffer) = out_ts;
|
||||
GST_BUFFER_DTS (buffer) = out_ts;
|
||||
GST_BUFFER_PTS (buffer) = out_ts + parse->ts_offset;
|
||||
GST_BUFFER_DTS (buffer) = out_ts + parse->ts_offset;
|
||||
if (ret == GST_FLOW_OK)
|
||||
ret = gst_pad_push (parse->srcpad, buffer);
|
||||
else
|
||||
|
@ -914,6 +923,10 @@ mpegts_parse_program_stopped (MpegTSBase * base, MpegTSBaseProgram * program)
|
|||
tspad->program = NULL;
|
||||
parseprogram->tspad = NULL;
|
||||
}
|
||||
|
||||
parse->pcr_pid = -1;
|
||||
parse->ts_offset += parse->current_pcr - parse->base_pcr;
|
||||
parse->base_pcr = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -52,6 +52,8 @@ struct _MpegTSParse2 {
|
|||
guint group_id;
|
||||
|
||||
GstClockTime smoothing_latency;
|
||||
GstClockTime base_pcr;
|
||||
GstClockTime ts_offset;
|
||||
GstClockTime current_pcr;
|
||||
gint user_pcr_pid;
|
||||
gint pcr_pid;
|
||||
|
|
Loading…
Reference in a new issue