Commit a39dc142 authored by Edward Hervey's avatar Edward Hervey 🤘 Committed by Edward Hervey

mpegtspacketizer: Don't add existing values to group

If the last value is already identical, there is no need in adding it
yet-another-time
parent 88dbae3a
......@@ -1873,14 +1873,20 @@ _set_current_group (MpegTSPCR * pcrtable,
static inline void
_append_group_values (PCROffsetGroup * group, PCROffset pcroffset)
{
group->last_value++;
/* Resize values if needed */
if (G_UNLIKELY (group->nb_allocated == group->last_value)) {
group->nb_allocated += DEFAULT_ALLOCATED_OFFSET;
group->values =
g_realloc (group->values, group->nb_allocated * sizeof (PCROffset));
}
group->values[group->last_value] = pcroffset;
/* Only append if new values */
if (group->values[group->last_value].offset == pcroffset.offset &&
group->values[group->last_value].pcr == pcroffset.pcr) {
GST_DEBUG ("Same values, ignoring");
} else {
group->last_value++;
/* Resize values if needed */
if (G_UNLIKELY (group->nb_allocated == group->last_value)) {
group->nb_allocated += DEFAULT_ALLOCATED_OFFSET;
group->values =
g_realloc (group->values, group->nb_allocated * sizeof (PCROffset));
}
group->values[group->last_value] = pcroffset;
}
GST_DEBUG ("First PCR:%" GST_TIME_FORMAT " offset:%" G_GUINT64_FORMAT
" PCR_offset:%" GST_TIME_FORMAT,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment