mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
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:
parent
58f80c180c
commit
3a9c103b58
2 changed files with 1 additions and 8 deletions
|
@ -259,7 +259,6 @@ gst_alsasink_init (GstAlsaSink * alsasink)
|
||||||
alsasink->is_paused = FALSE;
|
alsasink->is_paused = FALSE;
|
||||||
alsasink->after_paused = FALSE;
|
alsasink->after_paused = FALSE;
|
||||||
alsasink->hw_support_pause = FALSE;
|
alsasink->hw_support_pause = FALSE;
|
||||||
alsasink->stop_streaming_threads = TRUE;
|
|
||||||
g_mutex_init (&alsasink->alsa_lock);
|
g_mutex_init (&alsasink->alsa_lock);
|
||||||
g_mutex_init (&alsasink->delay_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);
|
alsa->channels, GST_AUDIO_BASE_SINK (alsa)->ringbuffer);
|
||||||
#endif /* SND_CHMAP_API_VERSION */
|
#endif /* SND_CHMAP_API_VERSION */
|
||||||
|
|
||||||
alsa->stop_streaming_threads = FALSE;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -1063,8 +1061,6 @@ gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length)
|
||||||
|
|
||||||
GST_ALSA_SINK_LOCK (asink);
|
GST_ALSA_SINK_LOCK (asink);
|
||||||
while (cptr > 0) {
|
while (cptr > 0) {
|
||||||
if (alsa->stop_streaming_threads)
|
|
||||||
goto write_error;
|
|
||||||
/* start by doing a blocking wait for free space. Set the timeout
|
/* start by doing a blocking wait for free space. Set the timeout
|
||||||
* to 4 times the period time */
|
* to 4 times the period time */
|
||||||
err = snd_pcm_wait (alsa->handle, (4 * alsa->period_time / 1000));
|
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);
|
CHECK (snd_pcm_pause (alsa->handle, 1), pause_error);
|
||||||
GST_DEBUG_OBJECT (alsa, "pause done");
|
GST_DEBUG_OBJECT (alsa, "pause done");
|
||||||
alsa->is_paused = TRUE;
|
alsa->is_paused = TRUE;
|
||||||
alsa->stop_streaming_threads = TRUE;
|
|
||||||
GST_ALSA_SINK_UNLOCK (asink);
|
GST_ALSA_SINK_UNLOCK (asink);
|
||||||
} else {
|
} else {
|
||||||
gst_alsasink_stop (asink);
|
gst_alsasink_stop (asink);
|
||||||
|
@ -1186,6 +1181,7 @@ pause_error:
|
||||||
GST_ERROR_OBJECT (alsa, "alsa-pause: pcm pause error: %s",
|
GST_ERROR_OBJECT (alsa, "alsa-pause: pcm pause error: %s",
|
||||||
snd_strerror (err));
|
snd_strerror (err));
|
||||||
GST_ALSA_SINK_UNLOCK (asink);
|
GST_ALSA_SINK_UNLOCK (asink);
|
||||||
|
gst_alsasink_stop (asink);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1205,7 +1201,6 @@ gst_alsasink_resume (GstAudioSink * asink)
|
||||||
GST_ALSA_SINK_UNLOCK (asink);
|
GST_ALSA_SINK_UNLOCK (asink);
|
||||||
}
|
}
|
||||||
|
|
||||||
alsa->stop_streaming_threads = FALSE;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
resume_error:
|
resume_error:
|
||||||
|
@ -1231,7 +1226,6 @@ gst_alsasink_stop (GstAudioSink * asink)
|
||||||
GST_DEBUG_OBJECT (alsa, "prepare");
|
GST_DEBUG_OBJECT (alsa, "prepare");
|
||||||
CHECK (snd_pcm_prepare (alsa->handle), prepare_error);
|
CHECK (snd_pcm_prepare (alsa->handle), prepare_error);
|
||||||
GST_DEBUG_OBJECT (alsa, "stop done");
|
GST_DEBUG_OBJECT (alsa, "stop done");
|
||||||
alsa->stop_streaming_threads = TRUE;
|
|
||||||
GST_ALSA_SINK_UNLOCK (asink);
|
GST_ALSA_SINK_UNLOCK (asink);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -77,7 +77,6 @@ struct _GstAlsaSink {
|
||||||
gboolean is_paused;
|
gboolean is_paused;
|
||||||
gboolean after_paused;
|
gboolean after_paused;
|
||||||
gboolean hw_support_pause;
|
gboolean hw_support_pause;
|
||||||
gboolean stop_streaming_threads;
|
|
||||||
snd_pcm_sframes_t pos_in_buffer;
|
snd_pcm_sframes_t pos_in_buffer;
|
||||||
|
|
||||||
GMutex alsa_lock;
|
GMutex alsa_lock;
|
||||||
|
|
Loading…
Reference in a new issue