From 4146dc905d2b7b222d1b47fa900242819c679e79 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 1 Aug 2019 15:02:23 +0900 Subject: [PATCH] qtdemux: Use empty-array safe way to cleanup GPtrArray Fix assertion fail GLib-CRITICAL **: g_ptr_array_remove_range: assertion 'index_ < rarray->len' failed --- gst/isomp4/qtdemux.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index d8c434e..6112f20 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -2174,10 +2174,8 @@ gst_qtdemux_reset (GstQTDemux * qtdemux, gboolean hard) if (hard) { qtdemux->segment_seqnum = GST_SEQNUM_INVALID; qtdemux->trickmode_interval = 0; - g_ptr_array_remove_range (qtdemux->active_streams, - 0, qtdemux->active_streams->len); - g_ptr_array_remove_range (qtdemux->old_streams, - 0, qtdemux->old_streams->len); + g_ptr_array_set_size (qtdemux->active_streams, 0); + g_ptr_array_set_size (qtdemux->old_streams, 0); qtdemux->n_video_streams = 0; qtdemux->n_audio_streams = 0; qtdemux->n_sub_streams = 0; @@ -2284,7 +2282,7 @@ gst_qtdemux_stream_concat (GstQTDemux * qtdemux, GPtrArray * dest, g_ptr_array_add (dest, gst_qtdemux_stream_ref (stream)); } - g_ptr_array_remove_range (src, 0, len); + g_ptr_array_set_size (src, 0); } static gboolean @@ -12909,9 +12907,7 @@ qtdemux_expose_streams (GstQTDemux * qtdemux) return GST_FLOW_ERROR; } - g_ptr_array_remove_range (qtdemux->old_streams, - 0, qtdemux->old_streams->len); - + g_ptr_array_set_size (qtdemux->old_streams, 0); qtdemux->need_segment = TRUE; return GST_FLOW_OK; @@ -12953,7 +12949,7 @@ qtdemux_expose_streams (GstQTDemux * qtdemux) } } - g_ptr_array_remove_range (qtdemux->old_streams, 0, qtdemux->old_streams->len); + g_ptr_array_set_size (qtdemux->old_streams, 0); /* check if we should post a redirect in case there is a single trak * and it is a redirecting trak */ -- 2.7.4