[alsa-devel] 1ca3d59d5a3e762fb1c002bcd912914bc858b430 broke passthrough [Was: Re: ALSA 1.0.25 broke AC3 passthrough?]

Jean-Yves Avenard jyavenard at gmail.com
Mon Feb 13 07:32:03 CET 2012


Hi there

Okay, I had time today to test a bit more on what was going on

On 13 February 2012 00:17, Anssi Hannula <anssi.hannula at iki.fi> wrote:

> I'm not familiar enough with HDA to comment on the cause of the issue,
> but out of interest, does the hang really only happen with passthrough,
> i.e. (AES0 & 0x02) set, or does it happen with a PCM stream with the
> same parameters as well (and the application(s) just happen to set
> problematic ALSA parameters only in passthrough mode)?

Actually, went through over a lot of different type, only to find that
the problem isn't with passthrough as such, but a combination of the
prealloc value set and if 16 bits / 32 bits audio.

16 bits audio, as soon as the ALSA hardware buffer is set to something
different than the default 64 (like 4096, the default when using
Ubuntu)  snd_pcm_write will hang then error.

32 bits audio, plays under most combinations tried, except for 5.1 PCM
where I had to set the prealloc buffer to 1024 and above to get it
work

Here are the various mode I tried, the output of the log is for 4096
prealloc buffer

For a reminder:
format=2 -> SND_PCM_FORMAT_S16_LE
format=10 -> SND_PCM_FORMAT_S32_LE

AC3 Passthrough: working for 64kB, Not working for: 128, 256, 512,
1024, 2048 and 4096
2012-02-13 15:58:50.339376 I  ALSA: SetParameters(format=2,
channels=2, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 15:58:50.339437 I  ALSA: Buffer size range from 64 to 1048576
2012-02-13 15:58:50.339441 I  ALSA: Period size range from 32 to 524288
2012-02-13 15:58:50.339455 I  ALSA: Buffer time = 500000 us
2012-02-13 15:58:50.339465 I  ALSA: Period time = 4 periods
2012-02-13 15:58:50.458098 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 15:58:50.696838 I  AO: Audio fragment size: 12000

16 bits stereo: working for 64, Not working for: 128, 256, 512, 1024, 2048, 4096
2012-02-13 16:20:39.027793 I  ALSA: SetParameters(format=2,
channels=2, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 16:20:39.027855 I  ALSA: Buffer size range from 64 to 1048576
2012-02-13 16:20:39.027859 I  ALSA: Period size range from 32 to 524288
2012-02-13 16:20:39.027873 I  ALSA: Buffer time = 500000 us
2012-02-13 16:20:39.027883 I  ALSA: Period time = 4 periods
2012-02-13 16:20:39.267237 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 16:20:39.507467 I  AO: Audio fragment size: 12000

32 bits Stereo: working for: 64, 128,,256, 512, 1024, 2048 and 4096
2012-02-13 16:05:25.010312 I  ALSA: SetParameters(format=10,
channels=2, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 16:05:25.010372 I  ALSA: Buffer size range from 32 to 524288
2012-02-13 16:05:25.010376 I  ALSA: Period size range from 16 to 262144
2012-02-13 16:05:25.010389 I  ALSA: Buffer time = 500000 us
2012-02-13 16:05:25.010400 I  ALSA: Period time = 4 periods
2012-02-13 16:05:25.286857 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 16:05:25.526849 I  AO: Audio fragment size: 24000

5.1 16 bits PCM:
Using 64kB prealloc buffer, snd_pcm_hw_params_set_buffer_time_near
gives the error "Invalid Parameter" for 500000
Not working for 128, 256, 512, 1024, 2048 and 4096

2012-02-13 16:09:11.621562 I  ALSA: SetParameters(format=2,
channels=6, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 16:09:11.621628 I  ALSA: Buffer size range from 22 to 349525
2012-02-13 16:09:11.621632 I  ALSA: Period size range from 11 to 174762
2012-02-13 16:09:11.621645 I  ALSA: Buffer time = 500000 us
2012-02-13 16:09:11.621663 I  ALSA: Period time = 4 periods
2012-02-13 16:09:11.796861 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 16:09:12.036842 I  AO: Audio fragment size: 36000

5.1 32 bits PCM:
Not working for: 64, 256, 512. Working for 1024, 2048, 4096
128 gives Invalid argument for snd_pcm_hw_params_set_buffer_time_near

2012-02-13 16:25:12.890306 I  ALSA: SetParameters(format=10,
channels=6, rate=48000, buffer_time=500000, period_time=4)
2012-02-13 16:25:12.890366 I  ALSA: Buffer size range from 12 to 174762
2012-02-13 16:25:12.890370 I  ALSA: Period size range from 6 to 87381
2012-02-13 16:25:12.890383 I  ALSA: Buffer time = 500000 us
2012-02-13 16:25:12.890393 I  ALSA: Period time = 4 periods
2012-02-13 16:25:13.066855 I  ALSA: Buffer size = 24000 | Period size = 6000
2012-02-13 16:25:13.316823 I  AO: Audio fragment size: 72000



More information about the Alsa-devel mailing list