Re: XRUN handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Another query, if setting runtime parameters like:
runtime->silence_threshold = runtime->boundary;
runtime->silence_size = runtime->boundary;
runtime->stop_threshold = runtime->boundary;

Also to avoid the bug in snd_pcm_playback_silence()  i.e.,
snd_BUG_ON(frames > runtime->buffer_size),
I have added a tweak in the driver IRQ handler:

              if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK
                                    &&
snd_pcm_playback_hw_avail(runtime) == 0) {

                        /* Hardware is continously running so it is
                         * playing silence so that should be OK.
                         * And we played all valid samples, so no data
                         * is lost. Not stopping intentionally
                         */

                          runtime->control->appl_ptr += runtime->period_size;
                        if(runtime->control->appl_ptr >= runtime->boundary)
                                runtime->control->appl_ptr -= runtime->boundary;

                        offset = runtime->control->appl_ptr -
runtime->silence_start;
                        if (offset < 0)
                                offset += runtime->boundary;
                        if ((snd_pcm_uframes_t)offset < runtime->silence_filled)
                                runtime->silence_filled -= offset;
                        else
                                runtime->silence_filled = 0;

                        runtime->silence_start = runtime->control->appl_ptr;

This avoids the bug above, but aplay does not stop after reading all
the samples from the file. It plays silence infinitely.
Should not this condition be detected by the aplay and stop the stream
when EOF on the file happens.

Regards,
M.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux