mpegtspacketizer: Fix duration evaluation in push mode

When working in push mode, we need to be able to evaluate the duration
based on a single group of observations.

To do that we use the current group values
This commit is contained in:
Edward Hervey 2014-06-10 14:27:01 +02:00
parent a822517ca9
commit 8e28f335f4

View file

@ -2080,11 +2080,14 @@ mpegts_packetizer_offset_to_ts (MpegTSPacketizer2 * packetizer,
pcrtable = get_pcr_table (packetizer, pid);
if (g_list_length (pcrtable->groups) < 2) {
if (g_list_length (pcrtable->groups) < 1) {
GST_WARNING ("Not enough observations to return a duration estimate");
return GST_CLOCK_TIME_NONE;
}
if (g_list_length (pcrtable->groups) > 1) {
GST_LOG ("Using last group");
/* FIXME : Refine this later to use neighbouring groups */
tmp = g_list_last (pcrtable->groups);
last = tmp->data;
@ -2098,9 +2101,17 @@ mpegts_packetizer_offset_to_ts (MpegTSPacketizer2 * packetizer,
lastoffset =
last->values[last->last_value].offset + last->first_offset -
packetizer->refoffset;
GST_DEBUG ("lastpcr:%" GST_TIME_FORMAT " lastoffset:%" G_GUINT64_FORMAT,
GST_TIME_ARGS (PCRTIME_TO_GSTTIME (lastpcr)), lastoffset);
} else {
PCROffsetCurrent *current = pcrtable->current;
/* If doing progressive read, use current */
GST_LOG ("Using current group");
lastpcr = current->group->pcr_offset + current->pending[current->last].pcr;
lastoffset = current->first_offset + current->pending[current->last].offset;
}
GST_DEBUG ("lastpcr:%" GST_TIME_FORMAT " lastoffset:%" G_GUINT64_FORMAT
" refoffset:%" G_GUINT64_FORMAT,
GST_TIME_ARGS (PCRTIME_TO_GSTTIME (lastpcr)), lastoffset,
packetizer->refoffset);
/* Convert byte difference into time difference (and transformed from 27MHz to 1GHz) */
res =