alsa-sink: Adds handling EAGAIN in try_recover 91/233491/7 submit/tizen/20200520.011942
authorJaechul Lee <jcsing.lee@samsung.com>
Fri, 15 May 2020 04:46:10 +0000 (13:46 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Tue, 19 May 2020 04:01:43 +0000 (13:01 +0900)
snd_pcm_avail returns a negative value sometimes. It depends on H/W. So,
trying to recover function was added and print out the state of the
buffer.

[Version] 13.0.7
[Issue Type] TSIX-3385

Change-Id: Ia5f97261d6216e2a64e40d0432e03c5c816ba022
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
packaging/pulseaudio.spec
src/modules/alsa/alsa-sink.c

index 1bb9278..813584f 100644 (file)
@@ -3,7 +3,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          13.0
-Release:          6
+Release:          7
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
index 06a093c..8103848 100644 (file)
@@ -508,7 +508,27 @@ static int try_recover(struct userdata *u, const char *call, int err) {
 
     pa_log_debug("%s: %s", call, pa_alsa_strerror(err));
 
+#ifdef __TIZEN__
+    if (err == -EAGAIN) {
+        snd_pcm_sframes_t avail;
+        snd_pcm_sframes_t delay;
+
+        snd_pcm_avail_delay(u->pcm_handle, &avail, &delay);
+
+        pa_log_error("%s: ringbuffer is full or stuck. avail(%d), delay(%d), state(%d)",
+                call, avail, delay, snd_pcm_state(u->pcm_handle));
+
+        /* It will wait for not EAGAIN state and call pcm_resume and prepare */
+        if (snd_pcm_recover(u->pcm_handle, -ESTRPIPE, 1) < 0)
+            pa_assert(err != -EAGAIN);
+
+        reset_vars(u);
+
+        return 0;
+    }
+#else
     pa_assert(err != -EAGAIN);
+#endif
 
     if (err == -EPIPE)
         pa_log_debug("%s: Buffer underrun!", call);