[alsa-devel] Bad file descriptor : -EBADFD

Irfan Shaikh irfan.shaikh at sasken.com
Wed Mar 23 12:14:24 CET 2011


Hello

           In the below logic, snd_pcm_write always returns -EBADFD . snd_pcm_writei not at all recovers from this state infinitly.
How can i solve this problem.

while(1)
{
     /*Read from capture device*/
    snd_pcm_writei(()
   if(error)
       xrun_recovery(pAlsaConfigP->playback_handle, retVal);
}

**** ERROR values returned from snd_pcm_writei:
Only forst time : -11
Follwed by  -EBADFD always



static int xrun_recovery(snd_pcm_t *handle, int err)
{
    if (err == -EPIPE) {    /* under-run */
        err = snd_pcm_prepare(handle);
        if (err < 0)
            printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err));
        return 0;
     }
     else if (err == -ESTRPIPE) {
         while ((err = snd_pcm_resume(handle)) == -EAGAIN)
             sleep(1);       /* wait until the suspend flag is released */
             if (err < 0)
             {
                 err = snd_pcm_prepare(handle);
                 if (err < 0)
                     printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err));
             }
             return 0;
     }
     return err;
}


SASKEN BUSINESS DISCLAIMER: This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email.
Read Disclaimer at http://www.sasken.com/extras/mail_disclaimer.html


More information about the Alsa-devel mailing list