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:
parent
a822517ca9
commit
8e28f335f4
@ -2080,27 +2080,38 @@ mpegts_packetizer_offset_to_ts (MpegTSPacketizer2 * packetizer,
|
|||||||
|
|
||||||
pcrtable = get_pcr_table (packetizer, pid);
|
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");
|
GST_WARNING ("Not enough observations to return a duration estimate");
|
||||||
return GST_CLOCK_TIME_NONE;
|
return GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME : Refine this later to use neighbouring groups */
|
if (g_list_length (pcrtable->groups) > 1) {
|
||||||
tmp = g_list_last (pcrtable->groups);
|
GST_LOG ("Using last group");
|
||||||
last = tmp->data;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (last->flags & PCR_GROUP_FLAG_ESTIMATED))
|
/* FIXME : Refine this later to use neighbouring groups */
|
||||||
_reevaluate_group_pcr_offset (pcrtable, last);
|
tmp = g_list_last (pcrtable->groups);
|
||||||
|
last = tmp->data;
|
||||||
|
|
||||||
/* lastpcr is the full value in PCR from the first first chunk of data */
|
if (G_UNLIKELY (last->flags & PCR_GROUP_FLAG_ESTIMATED))
|
||||||
lastpcr = last->values[last->last_value].pcr + last->pcr_offset;
|
_reevaluate_group_pcr_offset (pcrtable, last);
|
||||||
/* lastoffset is the full offset from the first chunk of data */
|
|
||||||
lastoffset =
|
|
||||||
last->values[last->last_value].offset + last->first_offset -
|
|
||||||
packetizer->refoffset;
|
|
||||||
|
|
||||||
GST_DEBUG ("lastpcr:%" GST_TIME_FORMAT " lastoffset:%" G_GUINT64_FORMAT,
|
/* lastpcr is the full value in PCR from the first first chunk of data */
|
||||||
GST_TIME_ARGS (PCRTIME_TO_GSTTIME (lastpcr)), lastoffset);
|
lastpcr = last->values[last->last_value].pcr + last->pcr_offset;
|
||||||
|
/* lastoffset is the full offset from the first chunk of data */
|
||||||
|
lastoffset =
|
||||||
|
last->values[last->last_value].offset + last->first_offset -
|
||||||
|
packetizer->refoffset;
|
||||||
|
} 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) */
|
/* Convert byte difference into time difference (and transformed from 27MHz to 1GHz) */
|
||||||
res =
|
res =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user