[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-3-g80b4457

Lennart Poettering gitmailer-noreply at 0pointer.de
Thu Sep 10 16:21:51 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  12c7460e404c94a364a23434ca28ec2bcc698431 (commit)

- Log -----------------------------------------------------------------
80b4457 alsa: properly report suspension error codes
bb36bb4 alsa: properly convert sample buffer sizes
5460967 libpulse: add new error code PA_ERR_BUSY
-----------------------------------------------------------------------

Summary of changes:
 src/modules/alsa/alsa-sink.c   |   23 ++++++++++++++---------
 src/modules/alsa/alsa-source.c |   22 +++++++++++++---------
 src/modules/alsa/alsa-util.c   |    6 +++---
 src/pulse/def.h                |    1 +
 src/pulse/error.c              |    4 +++-
 5 files changed, 34 insertions(+), 22 deletions(-)

-----------------------------------------------------------------------

commit 54609675e5bf50eaf405c8259129d074135de20a
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 11 01:20:45 2009 +0200

    libpulse: add new error code PA_ERR_BUSY

diff --git a/src/pulse/def.h b/src/pulse/def.h
index 08399ca..1a7da97 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -394,6 +394,7 @@ enum {
     PA_ERR_NOTIMPLEMENTED,         /**< Missing implementation. \since 0.9.15 */
     PA_ERR_FORKED,                 /**< The caller forked without calling execve() and tried to reuse the context. \since 0.9.15 */
     PA_ERR_IO,                     /**< An IO error happened. \since 0.9.16 */
+    PA_ERR_BUSY,                   /**< Device or resource busy. \since 0.9.17 */
     PA_ERR_MAX                     /**< Not really an error but the first invalid error code */
 };
 
diff --git a/src/pulse/error.c b/src/pulse/error.c
index 93a13fc..e827699 100644
--- a/src/pulse/error.c
+++ b/src/pulse/error.c
@@ -64,7 +64,9 @@ const char*pa_strerror(int error) {
         [PA_ERR_NOEXTENSION] = N_("No such extension"),
         [PA_ERR_OBSOLETE] = N_("Obsolete functionality"),
         [PA_ERR_NOTIMPLEMENTED] = N_("Missing implementation"),
-        [PA_ERR_FORKED] = N_("Client forked")
+        [PA_ERR_FORKED] = N_("Client forked"),
+        [PA_ERR_IO] = N_("Input/Output error"),
+        [PA_ERR_BUSY] = N_("Device or resource busy")
     };
 
     pa_init_i18n();

commit bb36bb4bbe1ee01fb95debdca79d9769851a06da
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 11 01:21:46 2009 +0200

    alsa: properly convert sample buffer sizes

diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index f934285..56d60df 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -275,11 +275,11 @@ int pa_alsa_set_hw_params(
     }
 
     if (_use_tsched && tsched_size > 0) {
-        _buffer_size = pa_convert_size(tsched_size, ss, &_ss);
+        _buffer_size = (snd_pcm_uframes_t) (((uint64_t) tsched_size * _ss.rate) / ss->rate);
         _period_size = _buffer_size;
     } else {
-        _period_size = pa_convert_size(_period_size, ss, &_ss);
-        _buffer_size = pa_convert_size(_buffer_size, ss, &_ss);
+        _period_size = (snd_pcm_uframes_t) (((uint64_t) _period_size * _ss.rate) / ss->rate);
+        _buffer_size = (snd_pcm_uframes_t) (((uint64_t) _buffer_size * _ss.rate) / ss->rate);
     }
 
     if (_buffer_size > 0 || _period_size > 0) {

commit 80b44574765738532bc688e5d6fa5b40dc61402b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 11 01:22:10 2009 +0200

    alsa: properly report suspension error codes

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 76cbe46..22e88b4 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1011,7 +1011,7 @@ fail:
         u->pcm_handle = NULL;
     }
 
-    return -1;
+    return -PA_ERR_IO;
 }
 
 /* Called from IO context */
@@ -1035,28 +1035,33 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
 
             switch ((pa_sink_state_t) PA_PTR_TO_UINT(data)) {
 
-                case PA_SINK_SUSPENDED:
+                case PA_SINK_SUSPENDED: {
+                    int r;
+
                     pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state));
 
-                    if (suspend(u) < 0)
-                        return -1;
+                    if ((r = suspend(u)) < 0)
+                        return r;
 
                     break;
+                }
 
                 case PA_SINK_IDLE:
-                case PA_SINK_RUNNING:
+                case PA_SINK_RUNNING: {
+                    int r;
 
                     if (u->sink->thread_info.state == PA_SINK_INIT) {
                         if (build_pollfd(u) < 0)
-                            return -1;
+                            return -PA_ERR_IO;
                     }
 
                     if (u->sink->thread_info.state == PA_SINK_SUSPENDED) {
-                        if (unsuspend(u) < 0)
-                            return -1;
+                        if ((r = unsuspend(u)) < 0)
+                            return r;
                     }
 
                     break;
+                }
 
                 case PA_SINK_UNLINKED:
                 case PA_SINK_INIT:
@@ -1084,7 +1089,7 @@ static int sink_set_state_cb(pa_sink *s, pa_sink_state_t new_state) {
         reserve_done(u);
     else if (old_state == PA_SINK_SUSPENDED && PA_SINK_IS_OPENED(new_state))
         if (reserve_init(u, u->device_name) < 0)
-            return -1;
+            return -PA_ERR_BUSY;
 
     return 0;
 }
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 88f2d8a..fa3ac0a 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -959,7 +959,7 @@ fail:
         u->pcm_handle = NULL;
     }
 
-    return -1;
+    return -PA_ERR_IO;
 }
 
 static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
@@ -982,30 +982,34 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
 
             switch ((pa_source_state_t) PA_PTR_TO_UINT(data)) {
 
-                case PA_SOURCE_SUSPENDED:
+                case PA_SOURCE_SUSPENDED: {
+                    int r;
                     pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state));
 
-                    if (suspend(u) < 0)
-                        return -1;
+                    if ((r = suspend(u)) < 0)
+                        return r;
 
                     break;
+                }
 
                 case PA_SOURCE_IDLE:
-                case PA_SOURCE_RUNNING:
+                case PA_SOURCE_RUNNING: {
+                    int r;
 
                     if (u->source->thread_info.state == PA_SOURCE_INIT) {
                         if (build_pollfd(u) < 0)
-                            return -1;
+                            return -PA_ERR_IO;
 
                         snd_pcm_start(u->pcm_handle);
                     }
 
                     if (u->source->thread_info.state == PA_SOURCE_SUSPENDED) {
-                        if (unsuspend(u) < 0)
-                            return -1;
+                        if ((r = unsuspend(u)) < 0)
+                            return r;
                     }
 
                     break;
+                }
 
                 case PA_SOURCE_UNLINKED:
                 case PA_SOURCE_INIT:
@@ -1033,7 +1037,7 @@ static int source_set_state_cb(pa_source *s, pa_source_state_t new_state) {
         reserve_done(u);
     else if (old_state == PA_SINK_SUSPENDED && PA_SINK_IS_OPENED(new_state))
         if (reserve_init(u, u->device_name) < 0)
-            return -1;
+            return -PA_ERR_BUSY;
 
     return 0;
 }

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list