summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2017-02-27 23:47:25 +1100
committerJan Schmidt <jan@centricular.com>2017-02-27 23:48:49 +1100
commit60810cd057da809c2ffeece11b9a286b87fa96d8 (patch)
tree86a9bac93e47c34821f2110c37a9081d95427622 /gst
parented1e4c16fb99c516af788bd29511cbd605db117b (diff)
downloadgstreamer-plugins-bad-60810cd057da809c2ffeece11b9a286b87fa96d8.tar.gz
tsparse: Convert PCR values immediately
Doing lazy conversion of PCR values doesn't work right when a PCR discont is encountered. Instead, convert PCR values to the continuous timestamp domain as soon as we encounter them and store that instead.
Diffstat (limited to 'gst')
-rw-r--r--gst/mpegtsdemux/mpegtsparse.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gst/mpegtsdemux/mpegtsparse.c b/gst/mpegtsdemux/mpegtsparse.c
index 7bf8fc4e3..8e227baad 100644
--- a/gst/mpegtsdemux/mpegtsparse.c
+++ b/gst/mpegtsdemux/mpegtsparse.c
@@ -706,7 +706,10 @@ mpegts_parse_inspect_packet (MpegTSBase * base, MpegTSPacketizerPacket * packet)
parse->pcr_pid = packet->pid;
/* Check the PCR-PID matches the program we want for multiple programs */
if (parse->pcr_pid == packet->pid) {
- parse->current_pcr = PCRTIME_TO_GSTTIME (packet->pcr);
+ parse->current_pcr = mpegts_packetizer_pts_to_ts (base->packetizer,
+ PCRTIME_TO_GSTTIME (packet->pcr), parse->pcr_pid);
+ GST_DEBUG ("Got new PCR %" GST_TIME_FORMAT " raw %" G_GUINT64_FORMAT,
+ GST_TIME_ARGS (parse->current_pcr), packet->pcr);
if (parse->base_pcr == GST_CLOCK_TIME_NONE) {
parse->base_pcr = parse->current_pcr;
}
@@ -739,7 +742,6 @@ get_pending_timestamp_diff (MpegTSParse2 * parse)
static GstFlowReturn
drain_pending_buffers (MpegTSParse2 * parse, gboolean drain_all)
{
- MpegTSBase *base = (MpegTSBase *) (parse);
GstFlowReturn ret = GST_FLOW_OK;
GstClockTime start_ts;
GstClockTime pcr = GST_CLOCK_TIME_NONE;
@@ -775,8 +777,7 @@ drain_pending_buffers (MpegTSParse2 * parse, gboolean drain_all)
return GST_FLOW_OK;
if (GST_CLOCK_TIME_IS_VALID (parse->current_pcr)) {
- pcr = mpegts_packetizer_pts_to_ts (base->packetizer,
- parse->current_pcr, parse->pcr_pid);
+ pcr = parse->current_pcr;
parse->current_pcr = GST_CLOCK_TIME_NONE;
}
@@ -868,8 +869,7 @@ mpegts_parse_input_done (MpegTSBase * base, GstBuffer * buffer)
GST_DEBUG_OBJECT (parse,
"InputTS %" GST_TIME_FORMAT " PCR %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_PTS (buffer)),
- GST_TIME_ARGS (mpegts_packetizer_pts_to_ts (base->packetizer,
- parse->current_pcr, parse->pcr_pid)));
+ GST_TIME_ARGS (parse->current_pcr));
}
if (parse->set_timestamps || parse->first) {