zf8848 / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

alsa_card_can_read will fail with EPIPE #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. if alsa_card_can_read fails it will fail for ever.
2.
3.

What is the expected output? What do you see instead?
The expected output is it alsa_card_can_read should recover from xrun
condition by calling snd_pcm_prepare.
below is the patch which i have used in my code. and it is the expected one.
 gboolean alsa_card_can_read(AlsaCard *obj)
 {
         int frames,err;
         g_return_val_if_fail(obj->read_handle!=NULL,0);
         if (obj->readpos!=0)
                 return TRUE;
         frames=snd_pcm_avail_update(obj->read_handle);
 //     printf("frames=%i\n",frames);
         if(frames==-EPIPE)
         {/* Overrun COndition*/
                 err=snd_pcm_prepare(obj->read_handle);
                 if(err<0)
                 {
                         printf("Cant recover form XRun\n");
                         return FALSE;
                 }
                 return TRUE;/* Only Next read attempt will trigger the
 driver to start capturing CAN BE DONE BETTER*/
         }else if(frames <=0)
         {/* Opps! something seriously worng, that cant be handled by
 the app*/
                 return FALSE;

         }else if(frames >= obj->frames)
         {
                 return TRUE;
         }
         return FALSE;
 }

What version of the product are you using? On what operating system?
0.4.0

Please provide any additional information below.
Conditions:
We are using alsa card.
Lets say we are reading from data from card ms_oss_read_process, this will
first call alsa_card_can_read. If say this fails because of xrun condition
then it will fail always and we need to recover out of it by calling 
snd_pcm_prepare function.

Original issue reported on code.google.com by srinivas...@gmail.com on 14 Mar 2007 at 5:02

GoogleCodeExporter commented 9 years ago
I don't really understand what's going on with this, but I converted these 
changes to
a patch file. You can apply the patch by cd'ing in to your libjingle-0.4.0 
directory,
and running:

patch -p1 < alsa.patch

Original comment by mattwinter on 14 Nov 2007 at 6:47

Attachments:

GoogleCodeExporter commented 9 years ago
No longer applicable since new code release.

Original comment by pthatc...@google.com on 3 Nov 2010 at 7:19