diff options
author | Edward Hervey <edward@centricular.com> | 2016-11-24 11:11:35 +0100 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2016-11-24 11:15:22 +0100 |
commit | a39dc142e60a020c5b7f17271c4fccb7a4a6cd35 (patch) | |
tree | 9533a5fcb89f2f9b37a9878b2347bc0c22366149 | |
parent | 88dbae3ab9c195c1bbb01aecb4d8f13a4e6e1e79 (diff) |
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
-rw-r--r-- | gst/mpegtsdemux/mpegtspacketizer.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c index c51a1e5ee..cc46ebb25 100644 --- a/gst/mpegtsdemux/mpegtspacketizer.c +++ b/gst/mpegtsdemux/mpegtspacketizer.c @@ -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, |