From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: Raymond Yau <superquad.vortex2@gmail.com>
Cc: sergemp@mail.ru, artur.stat@gmail.com,
ALSA Development Mailing List <alsa-devel@alsa-project.org>,
Clemens Ladisch <clemens@ladisch.de>,
David Henningsson <david.henningsson@canonical.com>
Subject: Re: On non-rewindability of resamplers
Date: Tue, 13 May 2014 23:21:03 +0600 [thread overview]
Message-ID: <5372547F.5000805@gmail.com> (raw)
In-Reply-To: <53705396.3070406@gmail.com>
12.05.2014 10:52, I wrote:
> 12.05.2014 09:11, Raymond Yau wrote:
>> D: [alsa-sink] alsa-util.c: PCM state is RUNNING
>> I: [alsa-sink] alsa-sink.c: Starting playback.
>> I: [alsa-sink] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed (-77)
>>
>> does SNDRV_PCM_IOCTL_START fail mean pcm state is no longer running ?
>
> Note that this comes from pcm_hw.c. As PulseAudio does not use the hw:
> device in this particular use case, I have to conclude that it comes
> through the a52 or ioplug code. I am not really familiar with this code.
This error code means -EBADFD. There is indeed some ifdefed-out code
that prints the state on -EBADFD, so probably you are right. OTOH there
is something strange in the code that may or may not be relevant. I have
not tested my findings.
The a52 plugin sets the start threshold of the "slave" to its own start
threshold. However, it doesn't write anything to the "slave" until it
has enough data for one A52 frame. So, if the start threshold is too
low, or if the pcm is started manually, it is quite possible that the
"slave" is started without anything written into it. Result: immediate
underrun. The dca plugin deals with this situation by inserting one DTS
frame of silence before everything else, and writing as many "samples"
to the slave as the application samples written into it.
Note that PulseAudio always starts the stream manually after writing the
first full buffer.
And the log that you quoted also says:
I: [alsa-sink] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed (-77)
D: [alsa-sink] alsa-util.c: Got POLLERR from ALSA
D: [alsa-sink] alsa-util.c: Got POLLOUT from ALSA
D: [alsa-sink] alsa-util.c: PCM state is RUNNING
The failure is for the hw plugin, however, the a52 plugin reports that
it is running. Quite obvious desynchronization of state between the a52
plugin and its "slave".
>> >
>> >> > hw_ptr granularity is defined only by period_bytes_min (and
>> >> additional constraints if any).
>> >
>> >
>> > Well, this disagrees with my experiments. For S16_LE stereo,
>> snd_pcm_hw_params_get_period_size_min() says 32 samples for both PCH and
>> HDMI, while the measured granularity is different (8 and 16 samples).
>>
>> should you use period_bytes_min instead of period_size_min ?
>>
>> 128 bytes / (8 x 2) = 8 samples for 8 channels
>>
>> for 6 channels playback , the period does not fit exactly the pcie
>> playload size 128 bytes
>
> Will retest later today.
Sorry, there is no userspace API for that. The only way to get the
minimum period size is via snd_pcm_hw_params_get_period_size_min, which
obtains the result in terms of frames.
>> does this mean the pulseaudio still keep the audio data until the
>> pulseaudio client close the stream ?
>
> Not ready to answer this yet.
Still don't know for sure.
--
Alexander E. Patrakov
next prev parent reply other threads:[~2014-05-13 17:24 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 17:41 Testing rewindability of a pcm Alexander E. Patrakov
2014-04-24 12:00 ` Clemens Ladisch
2014-04-24 21:01 ` On non-rewindability of resamplers (was: Testing rewindability of a pcm) Alexander E. Patrakov
2014-04-25 6:19 ` On non-rewindability of resamplers David Henningsson
2014-04-25 14:09 ` Alexander E. Patrakov
2014-04-26 1:32 ` Raymond Yau
2014-04-26 10:01 ` Alexander E. Patrakov
2014-04-28 6:57 ` Raymond Yau
2014-04-28 17:31 ` Alexander E. Patrakov
2014-04-29 16:01 ` Raymond Yau
2014-04-29 17:17 ` Alexander E. Patrakov
2014-04-29 17:33 ` Alexander E. Patrakov
2014-05-02 5:39 ` Raymond Yau
2014-05-03 11:09 ` Alexander E. Patrakov
2014-05-10 0:46 ` Raymond Yau
2014-05-10 13:16 ` Alexander E. Patrakov
2014-05-12 3:11 ` Raymond Yau
2014-05-12 4:52 ` Alexander E. Patrakov
2014-05-13 17:21 ` Alexander E. Patrakov [this message]
2014-05-23 2:03 ` Raymond Yau
2014-05-23 18:59 ` Alexander E. Patrakov
2014-05-24 5:10 ` Raymond Yau
2014-05-24 7:31 ` Alexander E. Patrakov
2014-05-30 0:59 ` Raymond Yau
2014-05-28 7:58 ` Raymond Yau
2014-05-28 15:38 ` Alexander E. Patrakov
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=5372547F.5000805@gmail.com \
--to=patrakov@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=artur.stat@gmail.com \
--cc=clemens@ladisch.de \
--cc=david.henningsson@canonical.com \
--cc=sergemp@mail.ru \
--cc=superquad.vortex2@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).