mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
hlsdemux: reuse the code in reset() to free resources in dispose()
This commit is contained in:
parent
5a40a62ff4
commit
fe883740c5
1 changed files with 9 additions and 17 deletions
|
@ -103,7 +103,7 @@ static gboolean gst_hls_demux_schedule (GstHLSDemux * demux);
|
||||||
static gboolean gst_hls_demux_switch_playlist (GstHLSDemux * demux);
|
static gboolean gst_hls_demux_switch_playlist (GstHLSDemux * demux);
|
||||||
static gboolean gst_hls_demux_get_next_fragment (GstHLSDemux * demux, gboolean retry);
|
static gboolean gst_hls_demux_get_next_fragment (GstHLSDemux * demux, gboolean retry);
|
||||||
static gboolean gst_hls_demux_update_playlist (GstHLSDemux * demux, gboolean retry);
|
static gboolean gst_hls_demux_update_playlist (GstHLSDemux * demux, gboolean retry);
|
||||||
static void gst_hls_demux_reset (GstHLSDemux * demux);
|
static void gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose);
|
||||||
static gboolean gst_hls_demux_set_location (GstHLSDemux * demux, const gchar * uri);
|
static gboolean gst_hls_demux_set_location (GstHLSDemux * demux, const gchar * uri);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -142,11 +142,6 @@ gst_hls_demux_dispose (GObject * obj)
|
||||||
g_cond_free (demux->fetcher_cond);
|
g_cond_free (demux->fetcher_cond);
|
||||||
g_mutex_free (demux->fetcher_lock);
|
g_mutex_free (demux->fetcher_lock);
|
||||||
|
|
||||||
if (demux->client) {
|
|
||||||
gst_m3u8_client_free (demux->client);
|
|
||||||
demux->client = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_cond_free (demux->thread_cond);
|
g_cond_free (demux->thread_cond);
|
||||||
g_mutex_free (demux->thread_lock);
|
g_mutex_free (demux->thread_lock);
|
||||||
|
|
||||||
|
@ -157,15 +152,11 @@ gst_hls_demux_dispose (GObject * obj)
|
||||||
gst_object_unref (demux->task);
|
gst_object_unref (demux->task);
|
||||||
g_static_rec_mutex_free (&demux->task_lock);
|
g_static_rec_mutex_free (&demux->task_lock);
|
||||||
|
|
||||||
while (!g_queue_is_empty (demux->queue)) {
|
|
||||||
GstBuffer *buf = g_queue_pop_head (demux->queue);
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
}
|
|
||||||
g_queue_free (demux->queue);
|
|
||||||
|
|
||||||
gst_object_unref (demux->fetcher_bus);
|
gst_object_unref (demux->fetcher_bus);
|
||||||
gst_object_unref (demux->fetcherpad);
|
gst_object_unref (demux->fetcherpad);
|
||||||
|
|
||||||
|
gst_hls_demux_reset (demux, TRUE);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (obj);
|
G_OBJECT_CLASS (parent_class)->dispose (obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +229,6 @@ gst_hls_demux_init (GstHLSDemux * demux, GstHLSDemuxClass * klass)
|
||||||
g_static_rec_mutex_init (&demux->task_lock);
|
g_static_rec_mutex_init (&demux->task_lock);
|
||||||
demux->task = gst_task_create ((GstTaskFunction) gst_hls_demux_loop, demux);
|
demux->task = gst_task_create ((GstTaskFunction) gst_hls_demux_loop, demux);
|
||||||
gst_task_set_lock (demux->task, &demux->task_lock);
|
gst_task_set_lock (demux->task, &demux->task_lock);
|
||||||
|
|
||||||
gst_hls_demux_reset (demux);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -288,7 +277,7 @@ gst_hls_demux_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
gst_hls_demux_reset (demux);
|
gst_hls_demux_reset (demux, FALSE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -577,7 +566,7 @@ gst_hls_demux_make_fetcher (GstHLSDemux * demux, const gchar * uri)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_hls_demux_reset (GstHLSDemux * demux)
|
gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose)
|
||||||
{
|
{
|
||||||
demux->need_cache = TRUE;
|
demux->need_cache = TRUE;
|
||||||
demux->thread_return = FALSE;
|
demux->thread_return = FALSE;
|
||||||
|
@ -601,7 +590,10 @@ gst_hls_demux_reset (GstHLSDemux * demux)
|
||||||
|
|
||||||
if (demux->client)
|
if (demux->client)
|
||||||
gst_m3u8_client_free (demux->client);
|
gst_m3u8_client_free (demux->client);
|
||||||
|
|
||||||
|
if (!dispose) {
|
||||||
demux->client = gst_m3u8_client_new ("");
|
demux->client = gst_m3u8_client_new ("");
|
||||||
|
}
|
||||||
|
|
||||||
while (!g_queue_is_empty (demux->queue)) {
|
while (!g_queue_is_empty (demux->queue)) {
|
||||||
GstBuffer *buf = g_queue_pop_head (demux->queue);
|
GstBuffer *buf = g_queue_pop_head (demux->queue);
|
||||||
|
|
Loading…
Reference in a new issue