[alsa-devel] Bad file descriptor : -EBADFD
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
Irfan Shaikh wrote:
-EBADFD
This is used by ALSA to tell you that the device is not in the correct state for the function. In this case, I'd guess that snd_pcm_hw_params was not called or did not succeed.
SASKEN BUSINESS DISCLAIMER: ...
*** DISCLAIMER *** This e-mail contains public information intended for any subscriber of this mailing list and for anybody else who bothers to read it; it will be copied, disclosed and distributed to the public. If you think you are not the intended recipient, please commit suicide immediately. These terms apply also to any e-mails quoted in, referenced from, or answering this e-mail, and supersede any disclaimers in those e-mails. Additionally, disclaimers in those e-mails will incur legal processing fees of $42 per line; you have agreed to this by reading this disclaimer.
Regards, Clemens
Thanks for your comment !
I have used following check and it is success. Even if the below API is succes still i get -EBADFD.....How can i resolve the issue ?
if (snd_pcm_hw_params(alsaParams->playback_handle, \ alsaParams->hwparams_playback) < 0) { snd_pcm_close(alsaParams->playback_handle); alsaParams->playback_handle = NULL; free(alsaParams); alsaParams = NULL; RSE_TRACE_ERROR (IPOD_AUDIO_THREAD_DEBUG,("Error setting HW params.")); return NULL; }
________________________________________ From: Clemens Ladisch [clemens@ladisch.de] Sent: Wednesday, March 23, 2011 5:00 PM To: Irfan Shaikh Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] Bad file descriptor : -EBADFD
Irfan Shaikh wrote:
-EBADFD
This is used by ALSA to tell you that the device is not in the correct state for the function. In this case, I'd guess that snd_pcm_hw_params was not called or did not succeed.
SASKEN BUSINESS DISCLAIMER: ...
*** DISCLAIMER *** This e-mail contains public information intended for any subscriber of this mailing list and for anybody else who bothers to read it; it will be copied, disclosed and distributed to the public. If you think you are not the intended recipient, please commit suicide immediately. These terms apply also to any e-mails quoted in, referenced from, or answering this e-mail, and supersede any disclaimers in those e-mails. Additionally, disclaimers in those e-mails will incur legal processing fees of $42 per line; you have agreed to this by reading this disclaimer.
Regards, Clemens
Hi Clemens,
Thanks for your reply
It is in PREPARED state at time of configuration. But later when i use snd_pcm_writei first returns -11, then -77 then continous -EBADFD infinitely
To fix this i close my playback device and reconfigure it when above happens, then plays fine...This is fix. but not the solution.
Is there any other way of comming out of EBADFD to normal PREPARE state.
Regards, Irfan
________________________________________ From: Clemens Ladisch [clemens@ladisch.de] Sent: Wednesday, March 23, 2011 9:24 PM To: Irfan Shaikh Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] Bad file descriptor : -EBADFD
Irfan Shaikh wrote:
I have used following check and it is success.
if (snd_pcm_hw_params(alsaParams->playback_handle, \ alsaParams->hwparams_playback) < 0)
Check the device's current state with snd_pcm_state(); it should be PREPARED.
Regards, Clemens
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
Irfan Shaikh wrote:
It is in PREPARED state at time of configuration.
And in what state is it when the error happens?
SASKEN BUSINESS DISCLAIMER: ...
*** DISCLAIMER *** This e-mail contains public information intended for any subscriber of this mailing list and for anybody else who bothers to read it; it will be copied, disclosed and distributed to the public. If you think you are not the intended recipient, please commit suicide immediately. These terms apply also to any e-mails quoted in, referenced from, or answering this e-mail, and supersede any disclaimers in those e-mails. Additionally, disclaimers in those e-mails will incur legal processing fees of $42 per line; you have agreed to this by reading this disclaimer.
Regards, Clemens
participants (2)
-
Clemens Ladisch
-
Irfan Shaikh