[pulseaudio-commits] r1645 - in /branches/lennart/src/modules: module-alsa-sink.c module-alsa-source.c module-oss.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat Aug 11 16:43:40 PDT 2007


Author: lennart
Date: Sun Aug 12 01:43:39 2007
New Revision: 1645

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1645&root=3Dpulseaudio&vi=
ew=3Drev
Log:
fix latency reporting for oss and alsa modules

Modified:
    branches/lennart/src/modules/module-alsa-sink.c
    branches/lennart/src/modules/module-alsa-source.c
    branches/lennart/src/modules/module-oss.c

Modified: branches/lennart/src/modules/module-alsa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-alsa-sink.c?rev=3D1645&root=3Dpulseaudio&r1=3D1644&r2=3D1645&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-alsa-sink.c (original)
+++ branches/lennart/src/modules/module-alsa-sink.c Sun Aug 12 01:43:39 2007
@@ -217,17 +217,18 @@
 =

 static pa_usec_t sink_get_latency(struct userdata *u) {
     pa_usec_t r =3D 0;
+    snd_pcm_status_t *status;
     snd_pcm_sframes_t frames =3D 0;
     int err;
-    =

-    pa_assert(u);
-
-    snd_pcm_avail_update(u->pcm_handle);
-
-    if ((err =3D snd_pcm_delay(u->pcm_handle, &frames)) < 0) {
+
+    snd_pcm_status_alloca(&status);
+    =

+    pa_assert(u);
+
+    if ((err =3D snd_pcm_status(u->pcm_handle, status)) < 0) =

         pa_log("Failed to get delay: %s", snd_strerror(err));
-        return 0;
-    }
+    else
+        frames =3D snd_pcm_status_get_delay(status);
 =

     if (frames > 0)
         r =3D pa_bytes_to_usec(frames * u->frame_size, &u->sink->sample_sp=
ec);
@@ -356,7 +357,7 @@
 =

             *((pa_usec_t*) data) =3D r;
 =

-            break;
+            return 0;
         }
 =

         case PA_SINK_MESSAGE_SET_STATE:

Modified: branches/lennart/src/modules/module-alsa-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-alsa-source.c?rev=3D1645&root=3Dpulseaudio&r1=3D1644&r2=3D1645&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-alsa-source.c (original)
+++ branches/lennart/src/modules/module-alsa-source.c Sun Aug 12 01:43:39 2=
007
@@ -209,17 +209,18 @@
 =

 static pa_usec_t source_get_latency(struct userdata *u) {
     pa_usec_t r =3D 0;
+    snd_pcm_status_t *status;
     snd_pcm_sframes_t frames =3D 0;
     int err;
-    =

-    pa_assert(u);
-
-    snd_pcm_avail_update(u->pcm_handle);
-
-    if ((err =3D snd_pcm_delay(u->pcm_handle, &frames)) < 0) {
+
+    snd_pcm_status_alloca(&status);
+    =

+    pa_assert(u);
+
+    if ((err =3D snd_pcm_status(u->pcm_handle, status)) < 0) =

         pa_log("Failed to get delay: %s", snd_strerror(err));
-        return 0;
-    }
+    else
+        frames =3D snd_pcm_status_get_delay(status);
 =

     if (frames > 0)
         r =3D pa_bytes_to_usec(frames * u->frame_size, &u->source->sample_=
spec);
@@ -345,7 +346,7 @@
 =

             *((pa_usec_t*) data) =3D r;
 =

-            break;
+            return 0;
         }
 =

         case PA_SOURCE_MESSAGE_SET_STATE:

Modified: branches/lennart/src/modules/module-oss.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-oss.c?rev=3D1645&root=3Dpulseaudio&r1=3D1644&r2=3D1645&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-oss.c (original)
+++ branches/lennart/src/modules/module-oss.c Sun Aug 12 01:43:39 2007
@@ -597,7 +597,7 @@
 =

             *((pa_usec_t*) data) =3D r;
 =

-            break;
+            return 0;
         }
 =

         case PA_SINK_MESSAGE_SET_STATE:




More information about the pulseaudio-commits mailing list