All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Gruber <christian.gruber@voiceinterconnect.de>
To: alsa-devel@alsa-project.org
Subject: Using plughw device and samplerate conversion with an ALSA driver not supporting memory mapped access
Date: Fri, 26 Jun 2015 15:19:15 +0200	[thread overview]
Message-ID: <558D5153.9060000@voiceinterconnect.de> (raw)

Hello,

I have problems using the plughw device with samplerate conversion on an embedded board 
having an ALSA driver, which does not support memory mapped access. The audio codec only 
supports 48 kHz sampling rate. The problem occurs, when I want to playback for instance a 
16 kHz file via plughw device, which is the default device. Interestingly the behaviour of 
the ALSA system is as follows:

    1. aplay -D default audio_16kHz.wav        does not work
    2. aplay -D default -M audio_16_kHz.wav    works correctly

This is quite strange, since although the ALSA driver does not support memory mapped 
access, using the option -M works, but the default read write access method without option 
-M does not, although the driver supports read write access. In this case the function 
snd_pcm_hw_params() returns with an error (EINVAL).

I started debugging this and could see, that in the second case, when using option -M, the 
plughw device establishes the following signal processing chain:

     plughw -> rate -> mmap_emul -> hw

This is what I expected from the plughw device. It first introduces a samplerate converter 
for conversion from 16 kHz to 48 kHz, since the codec only supports 48 kHz. And second it 
introduces a memory mapped access emulator to be able to use memory mapped access method 
on the application side and read write access method on the driver side (hw device).

In the first case without using option -M the plughw device establishes the following 
processing chain:

     plughw -> rate -> hw

This means, it does not introduce a memory mapped access emulator, which is comprehensible 
as well, since the application already uses read write access method, the same as the ALSA 
driver does. But nevertheless an error occurs.

Further debugging showed, that the error occurs in the function hw_refine_call() 
(pcm_hw.c) during the call to _snd_pcm_hw_params_internal() within the function 
snd_pcm_plug_hw_params() (pcm_plug.c). For some reason the rate plugin wants to use memory 
mapped access only on the hw device.

So I ask myself, if this is the expected behaviour of the rate plugin. Does the rate 
plugin only support memory mapped access? If yes, why is no mmap_emul plugin introduced 
into the signal processing chain in this case? If not, why does the rate plugin choose 
memory mapped access method? Is the ALSA driver maybe buggy giving wrong information about 
its hw capabilities?

Can anybody help me?

Regards,
Christian

                 reply	other threads:[~2015-06-26 12:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558D5153.9060000@voiceinterconnect.de \
    --to=christian.gruber@voiceinterconnect.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.