mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
oggdemux: Move mutex/cond initialization/release
We only need to initialize the mutex/cond once when creating the element and then release them when we are done with the element. Avoids weird "mutex_clear called when still locked" issues
This commit is contained in:
parent
ce8f51e30e
commit
25fa4802fe
1 changed files with 8 additions and 6 deletions
|
@ -2313,6 +2313,10 @@ gst_ogg_demux_init (GstOggDemux * ogg)
|
||||||
|
|
||||||
g_mutex_init (&ogg->chain_lock);
|
g_mutex_init (&ogg->chain_lock);
|
||||||
g_mutex_init (&ogg->push_lock);
|
g_mutex_init (&ogg->push_lock);
|
||||||
|
g_mutex_init (&ogg->seek_event_mutex);
|
||||||
|
g_cond_init (&ogg->seek_event_cond);
|
||||||
|
g_cond_init (&ogg->thread_started_cond);
|
||||||
|
|
||||||
ogg->chains = g_array_new (FALSE, TRUE, sizeof (GstOggChain *));
|
ogg->chains = g_array_new (FALSE, TRUE, sizeof (GstOggChain *));
|
||||||
|
|
||||||
ogg->stats_nbisections = 0;
|
ogg->stats_nbisections = 0;
|
||||||
|
@ -2337,6 +2341,10 @@ gst_ogg_demux_finalize (GObject * object)
|
||||||
g_array_free (ogg->chains, TRUE);
|
g_array_free (ogg->chains, TRUE);
|
||||||
g_mutex_clear (&ogg->chain_lock);
|
g_mutex_clear (&ogg->chain_lock);
|
||||||
g_mutex_clear (&ogg->push_lock);
|
g_mutex_clear (&ogg->push_lock);
|
||||||
|
g_cond_clear (&ogg->seek_event_cond);
|
||||||
|
g_cond_clear (&ogg->thread_started_cond);
|
||||||
|
g_mutex_clear (&ogg->seek_event_mutex);
|
||||||
|
|
||||||
ogg_sync_clear (&ogg->sync);
|
ogg_sync_clear (&ogg->sync);
|
||||||
|
|
||||||
if (ogg->newsegment)
|
if (ogg->newsegment)
|
||||||
|
@ -5084,9 +5092,6 @@ gst_ogg_demux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
||||||
ogg->resync = FALSE;
|
ogg->resync = FALSE;
|
||||||
if (active) {
|
if (active) {
|
||||||
ogg->seek_event_thread_stop = FALSE;
|
ogg->seek_event_thread_stop = FALSE;
|
||||||
g_mutex_init (&ogg->seek_event_mutex);
|
|
||||||
g_cond_init (&ogg->seek_event_cond);
|
|
||||||
g_cond_init (&ogg->thread_started_cond);
|
|
||||||
ogg->seek_thread_started = FALSE;
|
ogg->seek_thread_started = FALSE;
|
||||||
ogg->seek_event_thread = g_thread_new ("seek_event_thread",
|
ogg->seek_event_thread = g_thread_new ("seek_event_thread",
|
||||||
(GThreadFunc) gst_ogg_demux_loop_push, gst_object_ref (ogg));
|
(GThreadFunc) gst_ogg_demux_loop_push, gst_object_ref (ogg));
|
||||||
|
@ -5104,9 +5109,6 @@ gst_ogg_demux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
||||||
g_cond_broadcast (&ogg->seek_event_cond);
|
g_cond_broadcast (&ogg->seek_event_cond);
|
||||||
g_mutex_unlock (&ogg->seek_event_mutex);
|
g_mutex_unlock (&ogg->seek_event_mutex);
|
||||||
g_thread_join (ogg->seek_event_thread);
|
g_thread_join (ogg->seek_event_thread);
|
||||||
g_cond_clear (&ogg->seek_event_cond);
|
|
||||||
g_cond_clear (&ogg->thread_started_cond);
|
|
||||||
g_mutex_clear (&ogg->seek_event_mutex);
|
|
||||||
ogg->seek_event_thread = NULL;
|
ogg->seek_event_thread = NULL;
|
||||||
}
|
}
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
|
|
Loading…
Reference in a new issue