static void gst_hls_demux_stop (GstHLSDemux * demux) { gst_uri_downloader_cancel (demux->downloader); if (GST_TASK_STATE (demux->updates_task) != GST_TASK_STOPPED) { demux->stop_stream_task = TRUE; gst_task_stop (demux->updates_task); GST_TASK_SIGNAL (demux->updates_task); } if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) gst_task_stop (demux->stream_task); }
static void gst_hls_demux_dispose (GObject * obj) { GstHLSDemux *demux = GST_HLS_DEMUX (obj); g_cond_free (demux->fetcher_cond); g_mutex_free (demux->fetcher_lock); g_cond_free (demux->thread_cond); g_mutex_free (demux->thread_lock); if (GST_TASK_STATE (demux->task) != GST_TASK_STOPPED) { gst_task_stop (demux->task); gst_task_join (demux->task); } gst_object_unref (demux->task); g_static_rec_mutex_free (&demux->task_lock); gst_object_unref (demux->fetcher_bus); gst_object_unref (demux->fetcherpad); gst_hls_demux_reset (demux, TRUE); gst_object_unref (demux->download); G_OBJECT_CLASS (parent_class)->dispose (obj); }
static void gst_hls_demux_stop (GstHLSDemux * demux) { gst_hls_demux_stop_fetcher (demux, TRUE); if (GST_TASK_STATE (demux->task) != GST_TASK_STOPPED) gst_task_stop (demux->task); g_cond_signal (demux->thread_cond); }
static void gst_hls_demux_dispose (GObject * obj) { GstHLSDemux *demux = GST_HLS_DEMUX (obj); if (demux->stream_task) { if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) { GST_DEBUG_OBJECT (demux, "Leaving streaming task"); gst_task_stop (demux->stream_task); gst_task_join (demux->stream_task); } gst_object_unref (demux->stream_task); g_rec_mutex_clear (&demux->stream_lock); demux->stream_task = NULL; } if (demux->updates_task) { if (GST_TASK_STATE (demux->updates_task) != GST_TASK_STOPPED) { GST_DEBUG_OBJECT (demux, "Leaving updates task"); gst_task_stop (demux->updates_task); gst_task_join (demux->updates_task); } gst_object_unref (demux->updates_task); g_mutex_clear (&demux->updates_timed_lock); g_rec_mutex_clear (&demux->updates_lock); demux->updates_task = NULL; } if (demux->downloader != NULL) { g_object_unref (demux->downloader); demux->downloader = NULL; } gst_hls_demux_reset (demux, TRUE); g_queue_free (demux->queue); G_OBJECT_CLASS (parent_class)->dispose (obj); }
static GstFlowReturn gst_v4l2_video_dec_finish (GstVideoDecoder * decoder) { GstV4l2VideoDec *self = GST_V4L2_VIDEO_DEC (decoder); GstFlowReturn ret = GST_FLOW_OK; GstBuffer *buffer; if (!g_atomic_int_get (&self->processing)) goto done; GST_DEBUG_OBJECT (self, "Finishing decoding"); GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); if (gst_v4l2_decoder_cmd (self->v4l2output, V4L2_DEC_CMD_STOP, 0)) { GstTask *task = decoder->srcpad->task; /* If the decoder stop command succeeded, just wait until processing is * finished */ GST_OBJECT_LOCK (task); while (GST_TASK_STATE (task) == GST_TASK_STARTED) GST_TASK_WAIT (task); GST_OBJECT_UNLOCK (task); ret = GST_FLOW_FLUSHING; } else { /* otherwise keep queuing empty buffers until the processing thread has * stopped, _pool_process() will return FLUSHING when that happened */ while (ret == GST_FLOW_OK) { buffer = gst_buffer_new (); ret = gst_v4l2_buffer_pool_process (GST_V4L2_BUFFER_POOL (self-> v4l2output->pool), &buffer); gst_buffer_unref (buffer); } } /* and ensure the processing thread has stopped in case another error * occured. */ gst_v4l2_object_unlock (self->v4l2capture); gst_pad_stop_task (decoder->srcpad); GST_VIDEO_DECODER_STREAM_LOCK (decoder); if (ret == GST_FLOW_FLUSHING) ret = self->output_flow; GST_DEBUG_OBJECT (decoder, "Done draining buffers"); done: return ret; }
static void gst_ss_demux_stop (GstSSDemux * demux, GstSSDemuxStream *stream) { if (GST_TASK_STATE (stream->stream_task) != GST_TASK_STOPPED) gst_task_stop (stream->stream_task); }