gstreamer/subprojects/gst-plugins-good/ext
Thibault Saunier 049859c2cb adaptivedemux2: Do not submit_transfer when cancelled
There is a race condition where transfer has not been submitted yet while the
request is cancelled which leads to the transfer state going back to
`DOWNLOAD_REQUEST_STATE_OPEN` and the user of the request to get signalled about
its completion (and the task actually happening after it was cancelled) leading
to assertions and misbehaviours.

To ensure that this race can't happen, we start differentiating between the
UNSENT and CANCELLED states as in the normal case, when entering `submit_request`
the state is UNSENT and at that point we need to know that it is not because
the request has been cancelled.

In practice this case lead to an assertion in
`gst_adaptive_demux2_stream_begin_download_uri` because in a previous call to
`gst_adaptive_demux2_stream_stop_default` we cancelled the previous request and
setup a new one while it had not been submitted yet and then got a `on_download_complete`
callback called from that previous cancelled request and then we tried to do
`download_request_set_uri` on a request that was still `in_use`, leading to
something like:

```
 #0: 0x0000000186655ec8 g_assert (request->in_use == FALSE)assert.c:0
 #1: 0x00000001127236b8 libgstadaptivedemux2.dylib`download_request_set_uri(request=0x000060000017cc00, uri="https://XXX/chunk-stream1-00002.webm", range_start=0, range_end=-1) at downloadrequest.c:361
 #2: 0x000000011271cee8 libgstadaptivedemux2.dylib`gst_adaptive_demux2_stream_begin_download_uri(stream=0x00000001330f1800, uri="https://XXX/chunk-stream1-00002.webm", start=0, end=-1) at gstadaptivedemux-stream.c:1447
 #3: 0x0000000112719898 libgstadaptivedemux2.dylib`gst_adaptive_demux2_stream_load_a_fragment [inlined] gst_adaptive_demux2_stream_download_fragment(stream=0x00000001330f1800) at gstadaptivedemux-stream.c:0
 #4: 0x00000001127197f8 libgstadaptivedemux2.dylib`gst_adaptive_demux2_stream_load_a_fragment(stream=0x00000001330f1800) at gstadaptivedemux-stream.c:1969
 #5: 0x000000011271c2a4 libgstadaptivedemux2.dylib`gst_adaptive_demux2_stream_next_download(stream=0x00000001330f1800) at gstadaptivedemux-stream.c:2112
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5435>
2023-10-05 20:55:00 +00:00
..
aalib meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
adaptivedemux2 adaptivedemux2: Do not submit_transfer when cancelled 2023-10-05 20:55:00 +00:00
amrnb amrnb, amrwbdec: move AMR-NB and AMR-WB plugins to -good 2023-05-02 23:33:12 +00:00
amrwbdec amrnb, amrwbdec: move AMR-NB and AMR-WB plugins to -good 2023-05-02 23:33:12 +00:00
cairo meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
dv meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
flac flacenc: Correctly handle up to 255 cue entries 2023-09-30 15:46:52 +00:00
gdk_pixbuf gdkpixbuf: drop use of GSlice 2023-01-24 15:25:06 +00:00
gtk gtk: Fix critical caused by pointer movement when stream is getting ready 2023-07-17 14:53:43 -04:00
jack jack: tone down log ERRORs in case no JACK server is running 2023-05-08 21:20:20 +00:00
jpeg jpegdec: be stricter when detecting interlaced video 2023-05-25 18:34:34 +00:00
lame meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
libcaca
libpng pngenc: Allocate a single GstMemory per frame 2023-07-05 08:41:14 +00:00
mpg123 meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
pulse pulsedeviceprovider: fix incorrect usage of GST_ELEMENT_ERROR 2023-09-19 14:13:49 +02:00
qt qml: Fix leftover reference to gstqsgtexture 2023-09-19 23:55:45 +00:00
qt6 qml6glmixer: add support for non-RGBA inputs 2023-09-07 02:12:29 +00:00
raw1394
shout2 shout2send: use version template in user-agent property 2023-08-07 10:41:16 +00:00
soup souphttpsrc: Chain finalize call to parent 2023-09-27 09:01:43 +02:00
speex meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
taglib meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
twolame meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
vpx GstCustomMeta: Use simplified API where possible 2023-09-27 18:46:34 +00:00
wavpack gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
meson.build amrnb, amrwbdec: move AMR-NB and AMR-WB plugins to -good 2023-05-02 23:33:12 +00:00