mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
audiobasesink: Make sure the ringbuffer is started before waiting
Don't call the basesink wait_event implementation until we're sure the ringbuffer is running, because it might wait on a non-running clock.
This commit is contained in:
parent
8557eead82
commit
1df69786c3
1 changed files with 16 additions and 6 deletions
|
@ -1033,6 +1033,22 @@ gst_audio_base_sink_wait_event (GstBaseSink * bsink, GstEvent * event)
|
|||
GstAudioBaseSink *sink = GST_AUDIO_BASE_SINK (bsink);
|
||||
GstFlowReturn ret;
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
case GST_EVENT_GAP:
|
||||
/* We must have a negotiated format before starting the ringbuffer */
|
||||
if (G_UNLIKELY (!gst_audio_ring_buffer_is_acquired (sink->ringbuffer))) {
|
||||
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL),
|
||||
("Sink not negotiated before GAP event."));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
gst_audio_base_sink_force_start (sink);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ret = GST_BASE_SINK_CLASS (parent_class)->wait_event (bsink, event);
|
||||
if (ret != GST_FLOW_OK)
|
||||
return ret;
|
||||
|
@ -1046,12 +1062,6 @@ gst_audio_base_sink_wait_event (GstBaseSink * bsink, GstEvent * event)
|
|||
GstMapInfo minfo;
|
||||
|
||||
spec = &sink->ringbuffer->spec;
|
||||
if (G_UNLIKELY (spec->info.rate == 0)) {
|
||||
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL),
|
||||
("Sink not negotiated before GAP event."));
|
||||
ret = GST_FLOW_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
gst_event_parse_gap (event, ×tamp, &duration);
|
||||
|
||||
|
|
Loading…
Reference in a new issue