This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

alsa underrun problem on dm365

I am streaming video and audio from one dm365 to another dm365.  I am receiving alsa underruns on the playback side.  It seems that the audio is getting decoded correctly becuase I can write the decoded audio to a file and the file plays back fine.  But when playing it when decoding, the underruns occur and the audio becomes all static.  Can I configure alsa to have a little bit of buffering like two frames worth to maybe get rid of this underrun condition?

 

  • Hi,

    For aplay utility there are options like '--buffer-size' and ' --buffer-time'  that can be used to configure the buffer size for playback.

    '--buffer-size' is to specify the number of frames to be buffered and '--buffer-time' option is to specify the buffer duration.

    Regards, Chaithrika

  • I found where I could mess with these options, under dmai/linux, the file Sound_alsa.c  I  set the buffer-time option to half a second and couldn't figure out how to set the buffer_size, but could read it, it is set to 4000.  Messing with the buffer_time option didn't seem to help any.  I did discover another setting that helped, start_threshold was set to xFerAlign which was 80 (buffer_period is set to 80 as well)  So I set the start_threshold to 4000, which added a good bit of delay to my audio, but it is much more stable at this point. 

     

        startThreashold = 4000;
        status = snd_pcm_sw_params_set_start_threshold(rc, swParams,
                                                       startThreashold);
        if (status < 0) {
            Dmai_err3 ("Failed to set start threashold to %d on %s (%s)\n",
                       startThreashold, AUDIO_DEVICE, snd_strerror(status));
            return Dmai_EFAIL;
        }