Update of /cvsroot/alsa/alsa-oss
In directory sc8-pr-cvs1:/tmp/cvs-serv4911

Modified Files:
        alsa-oss.c 
Log Message:
- avoid the assert in snd_pcm_drain().
- fixed the possible segfault at the wrong release of resources.
- more debug messages.



Index: alsa-oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-oss/alsa-oss.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- alsa-oss.c  5 Nov 2003 11:17:08 -0000       1.40
+++ alsa-oss.c  1 Dec 2003 14:06:23 -0000       1.41
@@ -219,7 +219,8 @@
                        return err;
                rate = dsp->rate;
                err = snd_pcm_hw_params_set_rate_near(pcm, hw, &rate, 0);
-               assert(err >= 0);
+               if (err < 0)
+                       return err;
 
                if (str->mmap_buffer) {
                        snd_pcm_access_mask_t *mask;
@@ -269,8 +270,6 @@
                }
 
                err = snd_pcm_hw_params(pcm, hw);
-               if (err < 0)
-                       return err;
 #if 0
                if (debug)
                        snd_pcm_dump_setup(pcm, stderr);
@@ -365,8 +364,10 @@
                oss_dsp_stream_t *str = &dsp->streams[k];
                if (!str->pcm)
                        continue;
-               if (k == SND_PCM_STREAM_PLAYBACK)
-                       snd_pcm_drain(str->pcm);
+               if (k == SND_PCM_STREAM_PLAYBACK) {
+                       if (snd_pcm_state(str->pcm) != SND_PCM_STATE_OPEN)
+                               snd_pcm_drain(str->pcm);
+               }
                err = snd_pcm_close(str->pcm);
                if (err < 0)
                        result = err;
@@ -435,7 +436,9 @@
        fds[fd]->class = FD_OSS_DSP;
        dsp = calloc(1, sizeof(oss_dsp_t));
        if (!dsp) {
-               errno = -ENOMEM;
+               free(fds[fd]);
+               fds[fd] = NULL;
+               errno = ENOMEM;
                return -1;
        }
        fds[fd]->private = dsp;
@@ -1266,6 +1269,7 @@
        }
        if (err >= 0)
                return 0;
+       DEBUG("dsp ioctl error = %d\n", err);
        errno = -err;
        return -1;
 }



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to