From: Rafał Dzięgiel Date: Fri, 7 May 2021 08:44:15 +0000 (+0200) Subject: matroska: Ref index table when updating track info X-Git-Tag: 1.20.0~300 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=41385ab6f7e2464d4b364e52a1a27334108b226b;p=platform%2Fupstream%2Fgstreamer.git matroska: Ref index table when updating track info Track index table array was being lost during track info update. Ref it over to updated info, so it can be used for finding nearest seek points. Part-of: --- diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c index ae35884..52a76b9 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c @@ -3512,6 +3512,12 @@ gst_matroska_demux_update_tracks (GstMatroskaDemux * demux, GstEbmlRead * ebml) new_track->pad = old_track->pad; new_track->index = old_track->index; new_track->pos = old_track->pos; + + /* If index table is empty, do not ref it, we will try to fallback + * to the generic one from read-common in such case */ + if (old_track->index_table && old_track->index_table->len > 0) + new_track->index_table = g_array_ref (old_track->index_table); + g_ptr_array_index (demux->common.src, old_track_index) = new_track; gst_pad_set_element_private (new_track->pad, new_track); diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-read-common.c b/subprojects/gst-plugins-good/gst/matroska/matroska-read-common.c index 2b63c03..eb31764 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-read-common.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-read-common.c @@ -591,10 +591,12 @@ gst_matroska_read_common_do_index_seek (GstMatroskaReadCommon * common, GArray *index; /* find entry just before or at the requested position */ - if (track && track->index_table) + if (track && track->index_table) { index = track->index_table; - else + } else { + GST_DEBUG_OBJECT (common->sinkpad, "Missing track index table"); index = common->index; + } if (!index || !index->len) return NULL;