Skip to contentSkip to conversation

Playback underrun

DISCUSSION mahendra sp 1 participant 1 message Jul 5, 2003

lore
Share & tools
lore
#0 lore raw

hi,
i am using alsa0.9.4

i have written an application which works fine .but there is
buffer underun problem .but it corrects itself after some time. i ant to overcome this problem.

please help.

i am here by attaching the program for verification.

i am setting :
#define PERIODSIZE 512
#define BUFSIZE 512 * 4
int format = SND_PCM_FORMAT_S16_LE
snd_pcm_uframes_t buffer_size = PERIODSIZE * 4
snd_pcm_uframes_t period_size = PERIODSIZE
/* user buffer*/
char buf[BUFSIZE * 10];

Can anybody please explain as i am setting period_size = 512 ,
bufsize = 512*4, am i reading(readi) 2048 bytes? or 2048 frames?
whts the diffrence between frames and bytes?
while writing (writei) do i need to convert betwenn bytes
and frames
please explain whats this period_size and buffer_size. And alsa
is it necessory to keep application buffer to collect the sound as buf[BUFSIZE *10]?
if i want to read only 256 bytes with out any underrun or
overrun to what values i must set buffer_size and period_size ? and also what should be the minimum size of application buf.?

And also if i am integrating this with RTP, i am getting
broken pipe error while reading . But with out RTp it works fine. Whats the reason?

thanks,
regards

___________________________________________________
Click below to experience Sooraj R Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik, Abhishek
& Kareena http://www.mpkdh.com

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01