alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Bad file descriptor : -EBADFD
@ 2011-03-23 11:14 Irfan Shaikh
  2011-03-23 11:30 ` Clemens Ladisch
  0 siblings, 1 reply; 6+ messages in thread
From: Irfan Shaikh @ 2011-03-23 11:14 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-24  7:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23 11:14 Bad file descriptor : -EBADFD Irfan Shaikh
2011-03-23 11:30 ` Clemens Ladisch
2011-03-23 11:40   ` Irfan Shaikh
2011-03-23 15:54     ` Clemens Ladisch
2011-03-23 17:19       ` Irfan Shaikh
2011-03-24  7:14         ` Clemens Ladisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).