Update of /cvsroot/alsa/alsa-kernel/core/oss
In directory sc8-pr-cvs1:/tmp/cvs-serv28848

Modified Files:
        pcm_oss.c 
Log Message:
Fixed compilation for the sync code commited by mistake.
Fixed possible race in sync1 code (schedule call) and used schedule_timeout.


Index: pcm_oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/pcm_oss.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- pcm_oss.c   29 Sep 2003 18:16:18 -0000      1.51
+++ pcm_oss.c   30 Sep 2003 07:54:19 -0000      1.52
@@ -944,6 +944,7 @@
 {
        snd_pcm_runtime_t *runtime;
        ssize_t result = 0;
+       long res;
        wait_queue_t wait;
 
        runtime = substream->runtime;
@@ -960,12 +961,23 @@
                        break;
                result = 0;
                set_current_state(TASK_INTERRUPTIBLE);
-               schedule();
+               snd_pcm_stream_lock_irq(substream);
+               res = runtime->status->state;
+               snd_pcm_stream_unlock_irq(substream);
+               if (res != SNDRV_PCM_STATE_RUNNING) {
+                       set_current_state(TASK_RUNNING);
+                       break;
+               }
+               res = schedule_timeout(10 * HZ);
                if (signal_pending(current)) {
                        result = -ERESTARTSYS;
                        break;
                }
-               set_current_state(TASK_RUNNING);
+               if (res == 0) {
+                       snd_printk(KERN_ERR "OSS sync error - DMA timeout\n");
+                       result = -EIO;
+                       break;
+               }
        }
        remove_wait_queue(&runtime->sleep, &wait);
        return result;
@@ -979,14 +991,14 @@
        snd_pcm_runtime_t *runtime;
        snd_pcm_format_t format;
        unsigned long width;
-       size_t size;
+       size_t size, size1;
 
        substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
        if (substream != NULL) {
                if ((err = snd_pcm_oss_make_ready(substream)) < 0)
                        return err;
                runtime = substream->runtime;
-               format = snd_pcm_oss_format_from(runtime->oss.format));
+               format = snd_pcm_oss_format_from(runtime->oss.format);
                width = snd_pcm_format_physical_width(format);
                if (runtime->oss.buffer_used > 0) {
                        size = (8 * (runtime->oss.period_bytes - 
runtime->oss.buffer_used) + 7) / width;
@@ -1010,7 +1022,7 @@
                while (size < size1) {
                        snd_pcm_format_set_silence(format,
                                                   runtime->oss.buffer,
-                                                  (8 * runtime->oss.period_size + 7) 
/ width);
+                                                  (8 * runtime->oss.period_bytes + 7) 
/ width);
                        err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes);
                        if (err < 0)
                                return err;



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to