GNOME Bugzilla – Bug 755230
dashdemux: need for task_cancelled variable
Last modified: 2015-10-29 11:35:38 UTC
To stop the stream download task, a function can set the stream->demux->cancelled or stream->download_finished variables and signal the task. But a dash task can perform 3 downloads (header, index and media segment) (gst_adaptive_demux_stream_download_uri is called 3 times each time the task is run) so we need a separate flag to signal that download must stop and thread must exit as soon as possible. stream->demux->cancelled cannot be used because that is set only when all streams must stop. We cannot use that when trying to stop only tasks from old_streams list. stream->download_finished cannot be used because that signals normal thread operation and after a sleep on it the thread is allowed to perform a second download and sleep again. So, in order to force a demux task to exit without waiting on new downloads, we need a new variable (e.g. task_cancelled). It will be set to true from gst_adaptive_demux_stream_free and gst_adaptive_demux_stop_tasks. The gst_adaptive_demux_stream_download_uri function should check this at entry and exit with error if it is set.
implemented in https://bugzilla.gnome.org/show_bug.cgi?id=755169