ALSA problems with simultaneous Capture and playback
I am facing a problem with simultaneous playback and Capture.
I am doing Mic Capture and Playing it back.
this is format i am using SND_PCM_FORMAT_S16_LE.
I am recording only one channel "Mono".
this is my driver pcm_hardware configuration
static struct snd_pcm_hardware pcm_hw_info = {
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_RESUME,
/*
* ALSA doesn't support 18-bit or 20-bit packed into 32-bit
* words. It also doesn't support 12-bit at all.
*/
.formats = SNDRV_PCM_FMTBIT_S16_LE,
/* should this be continuous or knot? */
.buffer_bytes_max = 64 * 1024,
.period_bytes_min = 1024,
.period_bytes_max = 1024,
.periods_min = 4,
.periods_max = 64,
};I am getting following errors when i do simultaneous capture and playback. Start the while looop
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsaTrying to free free IRQ27
512 256
ReadFromAlsa():State:4, iiLen=2048
ReadFromAlsa():State:2
Overflow state
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsaTrying to free free IRQ27
512 256
ReadFromAlsa():State:4, iiLen=1280
ReadFromAlsa():State:2
Overflow state
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsa 512 256
MY WriteToAlsa 512 256
MY ReadFromAlsaTrying to free free IRQ27
512 256
ReadFromAlsa():State:4, iiLen=1280
ReadFromAlsa():State:2
Overflow state
One read and write handle 256 frames.
Write seems to be OK, but read fails
State 4 is SND_PCM_STATE_XRUN
why this XRUN is happening?
any idea why this is coming?
where i am going wrong?
Thanks
Quoted 7 lines · Nobin Mathew
One read and write handle 256 frames.
Write seems to be OK, but read fails
State 4 is
SND_PCM_STATE_XRUNwhy this XRUN is happening?
If your hardware buffer is small you may need to run your application with realtime priority (SCHED_FIFO) to avoid xruns.
I guess this is a custom driver? Please post a link to the source code.
Lee
A message that is not in the archive (sent off-list or not yet received): [email protected]
---------- Forwarded message ----------
From: Nobin Mathew <[email protected]>
Date: May 9, 2007 11:57 PM
Subject: Re: [alsa-devel] ALSA problems with simultaneous Capture and playback
To: Lee Revell <[email protected]>
when I do capture and Playback independently for any channel configurations and any sampling rate configuration it works perfectly.
Following configuration of simutaneous playback and capture work. loop "line out" and "line in" externaly using stereo jack. start arecord and then start aplay.
Then it records properly.
The application which is giving erorr is custom application which sets params properly.
if i run "aplay" and "arecord" first (after boot) and then i run my application then it works properly.
reverse is not working (i.e. running my app first destroys whole ALSA, then even arecord and aplay is not working).
Quoted 16 lines · Lee Revell
Quoted 7 lines · Nobin Mathew
One read and write handle 256 frames.
Write seems to be OK, but read fails
State 4 is
SND_PCM_STATE_XRUNwhy this XRUN is happening?
If your hardware buffer is small you may need to run your application with realtime priority (
SCHED_FIFO) to avoid xruns.I guess this is a custom driver? Please post a link to the source code.
Lee