mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
qtmux: Chain up when releasing pad, and fix some locking.
Release pads by calling up into aggregator so it can do the right things. Don't clean up the pad until after that. Add some missing locks around some accesses to shared pad state. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/797>
This commit is contained in:
parent
95579a00c0
commit
537e7d873a
1 changed files with 13 additions and 4 deletions
|
@ -3371,6 +3371,7 @@ gst_qt_mux_start_file (GstQTMux * qtmux)
|
|||
gst_aggregator_update_segment (GST_AGGREGATOR (qtmux), &segment);
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (qtmux);
|
||||
qtmux->current_chunk_size = 0;
|
||||
qtmux->current_chunk_duration = 0;
|
||||
qtmux->current_chunk_offset = -1;
|
||||
|
@ -3378,7 +3379,6 @@ gst_qt_mux_start_file (GstQTMux * qtmux)
|
|||
qtmux->current_pad = NULL;
|
||||
qtmux->longest_chunk = GST_CLOCK_TIME_NONE;
|
||||
|
||||
GST_OBJECT_LOCK (qtmux);
|
||||
for (l = GST_ELEMENT_CAST (qtmux)->sinkpads; l; l = l->next) {
|
||||
GstQTMuxPad *qtpad = (GstQTMuxPad *) l->data;
|
||||
|
||||
|
@ -6904,17 +6904,21 @@ gst_qt_mux_release_pad (GstElement * element, GstPad * pad)
|
|||
|
||||
GST_DEBUG_OBJECT (element, "Releasing %s:%s", GST_DEBUG_PAD_NAME (pad));
|
||||
|
||||
gst_qt_mux_pad_reset (muxpad);
|
||||
/* Take a ref to the pad so we can clean it up after removing it from the element */
|
||||
pad = gst_object_ref (pad);
|
||||
|
||||
gst_element_remove_pad (element, pad);
|
||||
/* Do aggregate level cleanup */
|
||||
GST_ELEMENT_CLASS (parent_class)->release_pad (element, pad);
|
||||
|
||||
GST_OBJECT_LOCK (mux);
|
||||
if (mux->current_pad && GST_PAD (mux->current_pad) == pad) {
|
||||
mux->current_pad = NULL;
|
||||
mux->current_chunk_size = 0;
|
||||
mux->current_chunk_duration = 0;
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (mux);
|
||||
gst_qt_mux_pad_reset (muxpad);
|
||||
|
||||
if (GST_ELEMENT (mux)->sinkpads == NULL) {
|
||||
/* No more outstanding request pads, reset our counters */
|
||||
mux->video_pads = 0;
|
||||
|
@ -6922,6 +6926,8 @@ gst_qt_mux_release_pad (GstElement * element, GstPad * pad)
|
|||
mux->subtitle_pads = 0;
|
||||
}
|
||||
GST_OBJECT_UNLOCK (mux);
|
||||
|
||||
gst_object_unref (pad);
|
||||
}
|
||||
|
||||
static GstAggregatorPad *
|
||||
|
@ -6989,9 +6995,12 @@ gst_qt_mux_request_new_pad (GstElement * element,
|
|||
g_free (name);
|
||||
|
||||
/* set up pad */
|
||||
GST_OBJECT_LOCK (qtmux);
|
||||
gst_qt_mux_pad_reset (qtpad);
|
||||
qtpad->trak = atom_trak_new (qtmux->context);
|
||||
|
||||
atom_moov_add_trak (qtmux->moov, qtpad->trak);
|
||||
GST_OBJECT_UNLOCK (qtmux);
|
||||
|
||||
/* set up pad functions */
|
||||
qtpad->set_caps = setcaps_func;
|
||||
|
|
Loading…
Reference in a new issue