[pulseaudio-discuss] [PATCH] alsa-util: No logging when sound card only supports non-interleaved sample format
Raymond Yau
superquad.vortex2 at gmail.com
Tue Nov 25 06:37:11 PST 2014
>
>
> > > as suggested by
> > >https://bugs.freedesktop.org/show_bug.cgi?id=84804
> > >
> > > Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
> > > ---
> > > src/modules/alsa/alsa-util.c | 15 +++++++++++++++
> > > 1 file changed, 15 insertions(+)
> > >
> > > diff --git a/src/modules/alsa/alsa-util.c
b/src/modules/alsa/alsa-util.c
> > > index 4131cff..e382d4f 100644
> > > --- a/src/modules/alsa/alsa-util.c
> > > +++ b/src/modules/alsa/alsa-util.c
> > > @@ -183,6 +183,19 @@ static int set_buffer_size(snd_pcm_t *pcm_handle,
> > snd_pcm_hw_params_t *hwparams,
> > > return 0;
> > > }
> > >
> > > +static void check_access(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t
> > *hwparams, bool use_mmap) {
> > > + if ((use_mmap && !snd_pcm_hw_params_test_access(pcm_handle,
> > hwparams, SND_PCM_ACCESS_MMAP_INTERLEAVED)) ||
> > > + !snd_pcm_hw_params_test_access(pcm_handle, hwparams,
> > SND_PCM_ACCESS_RW_INTERLEAVED))
> > > + pa_log_error("Weird, PCM claims to support interleaved
access,
> > but snd_pcm_hw_params_set_access() failed.");
> >
> > HW Params of device "hw:0,0":
> > --------------------
> > ACCESS: MMAP_NONINTERLEAVED RW_NONINTERLEAVED
> > FORMAT: S32_LE
> > SUBFORMAT: STD
> > SAMPLE_BITS: 32
> > FRAME_BITS: [448 832]
> > CHANNELS: [14 26]
> > RATE: [32000 96000]
> > PERIOD_TIME: (666 256000]
> > PERIOD_SIZE: [64 8192]
> > PERIOD_BYTES: [3584 851968]
> > PERIODS: 2
> > BUFFER_TIME: (1333 512000]
> > BUFFER_SIZE: [128 16384]
> > BUFFER_BYTES: [7168 1703936]
> > TICK_TIME: ALL
> >
> > if use of test_access is to prevent set_access corrupt the configuration
> > space of hw_param when access is not supported,
>
> I am not sure if I understand your comment correctly
>
> the idea of the patch is to improve the logging in case _INTERLEAVED is
> not supported (but NONINTERLEAVED is)
>
> I don't want to change the current behaviour in the normal case, hence
> check_access() is called after trying to set the access method
Do pulseaudio assume all profiles of the sink use same access type ?
Do pulseaudio allow sink and source use different access type?
surround40, surround51 of those creative sound cards emu10k1, ca0106 use
multi plugin of front, rear and clfe devices
>http://pastebin.com/NnDvQ2kU>
:~$ aplay --dump-hw-params -D surround40:CARD=Live
/usr/share/sounds/alsa/Front_Left.wav
appropriate number of channels is not available WAVE
'/usr/share/sounds/alsa/Front_Left.wav' : Signed 16 bit Little Endian,
frequency 48000 Hz, Mono
HW Params of device "surround40:CARD=Live":
--------------------
ACCESS: MMAP_COMPLEX RW_INTERLEAVED RW_NONINTERLEAVED FORMAT: U8 S16_LE
SUBFORMAT: STD SAMPLE_BITS: [8 16] FRAME_BITS: [32 64] CHANNELS: 4 RATE:
[4000 96000] PERIOD_TIME: (166 8192000] PERIOD_SIZE: [16 32768]
PERIOD_BYTES: [64 262144] PERIODS: [1 1024] BUFFER_TIME: (666 8192000]
BUFFER_SIZE: [64 32768] BUFFER_BYTES: [256 262144] TICK_TIME: ALL
--------------------
This mean that front, rear, clfe (mono and stereo profile) support
MMAP_INTERLEAVED and RW_INTERLEAVED
But. surround40 and surround51 support MMAP_COMPLEX or RW_INTERLEAVED
Seem no way to force pulseaudio to try RW_INTERLEAVED first since
udev-detect only has tsched flag
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/module-udev-detect.c
What is the purpose of bool *use_mmap in pa_alsa_set_hw_params
int pa_alsa_set_hw_params( snd_pcm_t *pcm_handle, pa_sample_spec *ss,
snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t tsched_size, bool *use_mmap, bool *use_tsched, bool
require_exact_channel_number) {
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/module-alsa-card.c
"mmap=<enable memory mapping?> "
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/module-alsa-sink.c
"mmap=<enable memory mapping?> "
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/module-alsa-source.c
"mmap=<enable memory mapping?> "
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20141125/c5930fd4/attachment.html>
More information about the pulseaudio-discuss
mailing list