Hi, I'm trying to play a simple PCM buffer single threaded without buffer underrun. Program source:https://gist.github.com/takaswie/d8a9553c230971d974a3dfc759b2ff67 (struct snd_pcm_sw_params).start_thresholdis altered so as to allow specifying the start of audio frame transmission and prevent underrun issues. In my application, onioctl(fd, SNDRV_PCM_IOCTL_STATUS, &status), I receive:File descriptor in bad state Output of$(dmesg)is:[ 69.013084] snd_hda_intel 0000:00:1f.3: Too big adjustment 128
From a previous response on thealsa-develmailing list:
The driver has some small number of periods to be put at the beginning of the buffer for correcting the reported position. Judging from the message, you seem to have set a quite high rate and a very shot number, and that's possibly too tight to operate properly.
However, I'm not sure what to change in this code to address this issue and get it to work. I tried alteringMY_PLAYBACK_DURATIONandparams.start_thresholdbut get the same error.
The program dumps the current hardware parameters:
Current hardware parameters: Changed parameters: access format subformat sample-bits frame-bits channels rate period-time period-size period-bytes periods buffer-time buffer-size buffer-bytes tick-time Runtime parameters: access: readwrite-interleaved format: s16-le subformat: std sample-bits: [16, 16], integer, frame-bits: [32, 32], integer, channels: [2, 2], integer, rate: [48000, 48000], integer, period-time: (666, 667), period-size: [32, 32], integer, periods: [32, 32], integer, buffer-time: (21333, 21334), buffer-size: [1024, 1024], integer, buffer-bytes: [4096, 4096], integer, tick-time: [0, 0], integer, info: mmap mmap-valid interleaved block-transfer pause sync-start no-period-wakeup has-wall-clock has-link-atime has-link-synchronized-atime most-significant-bits: 16 rate_num: 48000 rate_den: 1
Thanks