alsasink: Fix stall for transition of alsasink from PAUSED to READY with USB speakerphone

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4642>
This commit is contained in:
Nicolas Beland 2023-05-15 15:57:15 -04:00 committed by GStreamer Marge Bot
parent 58f80c180c
commit 3a9c103b58
2 changed files with 1 additions and 8 deletions

View file

@ -259,7 +259,6 @@ gst_alsasink_init (GstAlsaSink * alsasink)
alsasink->is_paused = FALSE;
alsasink->after_paused = FALSE;
alsasink->hw_support_pause = FALSE;
alsasink->stop_streaming_threads = TRUE;
g_mutex_init (&alsasink->alsa_lock);
g_mutex_init (&alsasink->delay_lock);
@ -943,7 +942,6 @@ gst_alsasink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec)
alsa->channels, GST_AUDIO_BASE_SINK (alsa)->ringbuffer);
#endif /* SND_CHMAP_API_VERSION */
alsa->stop_streaming_threads = FALSE;
return TRUE;
/* ERRORS */
@ -1063,8 +1061,6 @@ gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length)
GST_ALSA_SINK_LOCK (asink);
while (cptr > 0) {
if (alsa->stop_streaming_threads)
goto write_error;
/* start by doing a blocking wait for free space. Set the timeout
* to 4 times the period time */
err = snd_pcm_wait (alsa->handle, (4 * alsa->period_time / 1000));
@ -1173,7 +1169,6 @@ gst_alsasink_pause (GstAudioSink * asink)
CHECK (snd_pcm_pause (alsa->handle, 1), pause_error);
GST_DEBUG_OBJECT (alsa, "pause done");
alsa->is_paused = TRUE;
alsa->stop_streaming_threads = TRUE;
GST_ALSA_SINK_UNLOCK (asink);
} else {
gst_alsasink_stop (asink);
@ -1186,6 +1181,7 @@ pause_error:
GST_ERROR_OBJECT (alsa, "alsa-pause: pcm pause error: %s",
snd_strerror (err));
GST_ALSA_SINK_UNLOCK (asink);
gst_alsasink_stop (asink);
return;
}
}
@ -1205,7 +1201,6 @@ gst_alsasink_resume (GstAudioSink * asink)
GST_ALSA_SINK_UNLOCK (asink);
}
alsa->stop_streaming_threads = FALSE;
return;
resume_error:
@ -1231,7 +1226,6 @@ gst_alsasink_stop (GstAudioSink * asink)
GST_DEBUG_OBJECT (alsa, "prepare");
CHECK (snd_pcm_prepare (alsa->handle), prepare_error);
GST_DEBUG_OBJECT (alsa, "stop done");
alsa->stop_streaming_threads = TRUE;
GST_ALSA_SINK_UNLOCK (asink);
return;

View file

@ -77,7 +77,6 @@ struct _GstAlsaSink {
gboolean is_paused;
gboolean after_paused;
gboolean hw_support_pause;
gboolean stop_streaming_threads;
snd_pcm_sframes_t pos_in_buffer;
GMutex alsa_lock;