hlsdemux2: Fix assertion on shutdown

After cancelling a DownloadRequest, the download helper may not do so
immediately, so we can't assert on the in_use flag. Also, since there's no
refcount on the preload hint struct in the download request callback data, make
sure no callbacks will be dispatched when we're going to free the preload hint
struct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883>
This commit is contained in:
Jan Schmidt 2022-10-14 06:41:21 +11:00 committed by GStreamer Marge Bot
parent 44107d0c4b
commit 70bfeff35d

View file

@ -65,8 +65,8 @@ gst_hls_demux_preload_request_free (GstHLSDemuxPreloadRequest * req)
gst_m3u8_preload_hint_unref (req->hint);
if (req->download_request != NULL) {
/* The download request must have been cancelled by the preload helper */
g_assert (req->download_request->in_use == FALSE);
/* The download request must have been cancelled by the preload helper,
* but cancellation is async, so we can't verify */
download_request_unref (req->download_request);
}
@ -376,6 +376,9 @@ gst_hls_demux_preloader_release_request (GstHLSDemuxPreloader * preloader,
G_GINT64_FORMAT " size %" G_GINT64_FORMAT, hint->hint_type, hint->uri,
hint->offset, hint->size);
/* We don't want any callbacks to happen after we cancel here */
download_request_set_callbacks (preload_req->download_request,
NULL, NULL, NULL, NULL, NULL);
downloadhelper_cancel_request (preloader->download_helper,
preload_req->download_request);
}