Playing of MP3 file on freescale imx31-pdk board..
Hi all,
i m trying to play MP3 file on freescale im31-pdk board. If i use function call, Mp3 file is playing prorerly and if try to play by creating thread, i m getting the error like pool failed and write falied after the execution of snd_pcm_wait( ); and snd_pcm_writei() function.
please find sudo code below
This is for Thread...
main()
{
pthread_create(thread_ID , NULL, PlayMp3, 0 );
while(1);
}
This is for function call
main()
{
PlayMp3 (0);
while(1);
}
PlayMp3(int i);
{
alsainitlization();
while(1)
{
snd_pcm_wait (AMInst[InstID].playback_handle, -1)) < 0) {
fprintf (stderr, "poll failed (%s)\n", strerror (errno));
break;
}
MP3Decoder(OutBuf);
if ((err = snd_pcm_writei (handle,OutBuf, 4096)) < 0) {
fprintf (stderr, "write failed (%s)\n", snd_strerror (err));
}
}
}
What i m suspecting is that decoded data is not comming at right time for DMA while using thread. If use function call MP3 file is playing perfectly. Can anybody tel why this error is comming if i use thread and please give the solution for this.
Regards,
Ganesh
Last edited by ganeshpetkar; 06-08-2009 at 01:58 AM.
Reason: mailto removed
|