[pulseaudio-commits] r1501 - /branches/lennart/src/modules/module-oss.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Mon Jun 25 15:54:07 PDT 2007
Author: lennart
Date: Tue Jun 26 00:54:06 2007
New Revision: 1501
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1501&root=3Dpulseaudio&vi=
ew=3Drev
Log:
Port module-oss to the new lock-free core
Modified:
branches/lennart/src/modules/module-oss.c
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=3D1501&root=3Dpulseaudio&r1=3D1500&r2=3D1501&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 Tue Jun 26 00:54:06 2007
@@ -56,6 +56,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
+#include <signal.h>
=
#include <pulse/xmalloc.h>
#include <pulse/util.h>
@@ -138,7 +139,7 @@
pa_assert(u->fd >=3D 0);
=
/* Let's suspend */
- ioctl(u->fd, SNDCTL_DSP_SYNC);
+ ioctl(u->fd, SNDCTL_DSP_SYNC, NULL);
close(u->fd);
u->fd =3D -1;
=
@@ -180,7 +181,7 @@
}
=
if (ioctl(u->fd, SNDCTL_DSP_GETBLKSIZE, &frag_size) < 0) {
- pa_log("SNDCTL_DSP_GETBLKSIZE: %s", pa_cstrerror(errno));
+ pa_log_warn("SNDCTL_DSP_GETBLKSIZE: %s", pa_cstrerror(errno));
goto fail;
}
=
@@ -256,9 +257,6 @@
=
case PA_SINK_MESSAGE_SET_STATE:
=
- if (PA_PTR_TO_UINT(data) !=3D PA_SINK_RUNNING && u->fd >=3D 0)
- ioctl(u->fd, SNDCTL_DSP_POST);
-
if (PA_PTR_TO_UINT(data) =3D=3D PA_SINK_SUSPENDED) {
pa_assert(u->sink->thread_info.state !=3D PA_SINK_SUSPENDE=
D);
=
@@ -425,10 +423,14 @@
pa_memchunk chunk;
int r;
=
+/* pa_log("loop"); */
+ =
/* Check whether there is a message for us to process */
if (pa_asyncmsgq_get(u->asyncmsgq, &object, &code, &data, &chunk, =
0) =3D=3D 0) {
int ret;
=
+/* pa_log("processing msg"); */
+
if (!object && code =3D=3D PA_MESSAGE_SHUTDOWN) {
pa_asyncmsgq_done(u->asyncmsgq, 0);
goto finish;
@@ -437,11 +439,13 @@
ret =3D pa_asyncmsgq_dispatch(object, code, data, &chunk);
pa_asyncmsgq_done(u->asyncmsgq, ret);
continue;
- }
+ } =
+
+/* pa_log("loop2"); */
=
/* Render some data and write it to the dsp */
=
- if (u->sink && u->sink->thread_info.state =3D=3D PA_SINK_RUNNING &=
& (pollfd[POLLFD_DSP].revents & POLLOUT)) {
+ if (u->sink && u->sink->thread_info.state !=3D PA_SINK_SUSPENDED &=
& (pollfd[POLLFD_DSP].revents & POLLOUT)) {
ssize_t l;
void *p;
int loop =3D 0;
@@ -476,6 +480,8 @@
t =3D pa_write(u->fd, (uint8_t*) p + u->memchunk.index, u-=
>memchunk.length, &write_type);
pa_memblock_release(u->memchunk.memblock);
=
+/* pa_log("wrote %i bytes", t); */
+ =
pa_assert(t !=3D 0);
=
if (t < 0) {
@@ -515,7 +521,7 @@
=
/* Try to read some data and pass it on to the source driver */
=
- if (u->source && u->source->thread_info.state =3D=3D PA_SOURCE_RUN=
NING && ((pollfd[POLLFD_DSP].revents & POLLIN))) {
+ if (u->source && u->source->thread_info.state !=3D PA_SOURCE_SUSPE=
NDED && ((pollfd[POLLFD_DSP].revents & POLLIN))) {
void *p;
ssize_t l;
pa_memchunk memchunk;
@@ -585,8 +591,8 @@
if (u->fd >=3D 0) {
pollfd[POLLFD_DSP].fd =3D u->fd;
pollfd[POLLFD_DSP].events =3D
- ((u->source && u->source->thread_info.state =3D=3D PA_SOUR=
CE_RUNNING) ? POLLIN : 0) |
- ((u->sink && u->sink->thread_info.state =3D=3D PA_SINK_RUN=
NING) ? POLLOUT : 0);
+ ((u->source && u->source->thread_info.state !=3D PA_SOURCE=
_SUSPENDED) ? POLLIN : 0) |
+ ((u->sink && u->sink->thread_info.state !=3D PA_SINK_SUSPE=
NDED) ? POLLOUT : 0);
}
=
/* Hmm, nothing to do. Let's sleep */
@@ -594,9 +600,9 @@
if (pa_asyncmsgq_before_poll(u->asyncmsgq) < 0)
continue;
=
-/* pa_log("polling for %u", pollfd[POLLFD_DSP].events); */
+/* pa_log("polling for %i", u->fd >=3D 0 ? pollfd[POLLFD_DSP].even=
ts : -1); */
r =3D poll(pollfd, u->fd >=3D 0 ? POLLFD_MAX : POLLFD_DSP, -1);
-/* pa_log("polling got %u", r > 0 ? pollfd[POLLFD_DSP].revents : 0=
); */
+/* pa_log("polling got dsp=3D%i amq=3D%i (%i)", r > 0 ? pollfd[POL=
LFD_DSP].revents : 0, r > 0 ? pollfd[POLLFD_ASYNCQ].revents : 0, r); */
=
pa_asyncmsgq_after_poll(u->asyncmsgq);
=
@@ -610,6 +616,8 @@
pa_log("poll() failed: %s", pa_cstrerror(errno));
goto fail;
}
+
+ pa_assert(r > 0);
=
if (pollfd[POLLFD_DSP].revents & ~(POLLOUT|POLLIN)) {
pa_log("DSP shutdown.");
@@ -708,9 +716,9 @@
u->core =3D c;
u->module =3D m;
m->userdata =3D u;
- u->use_getospace =3D u->use_getispace =3D 0;
- u->use_getodelay =3D 0;
- u->use_input_volume =3D u->use_pcm_volume =3D 0;
+ u->use_getospace =3D u->use_getispace =3D 1;
+ u->use_getodelay =3D 1;
+ u->use_input_volume =3D u->use_pcm_volume =3D 1;
u->mode =3D mode;
u->device_name =3D pa_xstrdup(p);
u->nfrags =3D nfrags;
More information about the pulseaudio-commits
mailing list