gst_audio_base_sink_render: using a GST_BUFFER_FLAG_GAP with an invalid timestamp will cause a crash in wait_event
Hi,
In the case where a pipeline uses something like appsrc ! gstqueue2 ! volume ! alsasink to feed raw pcm to an alsa device
If the appsrc sends buffer without setting pts/dts (not needed to play raw pcm) and for some reason the user sets the volume to 0
The volume filter will zero the input buffer, flag it as GST_BUFFER_FLAG_GAP and send it down the chain without modifying the timestamps.
When gst_audio_base_sink_render detects that it's a gap it will call gst_event_new_gap() which will return NULL since time is not a valid timestamp and the call to bclass->wait_event (most likely gst_audio_base_sink_wait_event) will try to derefence this null pointer in GST_EVENT_TYPE (event)
Hence causing a crash.
For the record my current workaround is to check if GST_CLOCK_TIME_IS_VALID (time) as well as GAP| trickmode before entering this block.
I tried fancier solutions like putting the following inside the block :
if (!GST_CLOCK_TIME_IS_VALID (time)) { time = gst_audio_base_sink_get_offset (sink); }
But this cause the gstqueue2 to permanently underrun, my guess would be that "sink->next_sample = -1;" will mess the further gst_audio_base_sink_get_offset calls and will kind of screw the whole wait_event mechanism but I didn't spent too much time analysing it.