Re: [alsa-devel] Getting around initial sample loss with intel HDMI
At Sun, 26 Jul 2009 10:32:10 -0700, Shane W wrote:
On Sun, Jul 26, 2009 at 10:52:01AM +0200, Takashi Iwai wrote:
It's a known issue that Intel HDMI audio loses the first half second or so of audio when opening the device. Using the dmix interface, I've been able to get around that by writing a quick app to hold the device open so the HDMI stays live. However, with the recent asound.conf posted here which uses the route plugin to fix the multichannel order, I can't do that as dmix isn't in the picture. I'd rather not use dmix anyway since it can bugger with the sample rate so I am wondering if there's another way to get around this.
It's possible to combine with dmix. You set up dmix with 8 channels, put route plugin over it.
This has a few problems.
It doesn't seem to handle varying sample rates. IE if I play a 96khz stream at 6 channels, sound is terrible.
This is rather a problem of Nvidia HDMI codec driver...
Also, streaming DTS or AC3 no longer works since the streams are being upmixed to 6ch.
This has to be sent anyway exclusively without dmix, so you'll need another PCM definition.
I did some digging in the drivers to try and find the source of this problem. Note that I am really not familiar with this stuff. It appears to be here: hda_codec.c void snd_hda_codec_setup_stream(...) ... snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID,
Introducing a delay after this point fixes the issue but it's around a full second so that's obviously not a solution. Could we not cache the current format and only do this when the format changes rather than on every device open?
The format itself is kept. But the stream tag and channel assignment are assigned dynamically at each open. Thus, this call has to be reset at each open, at least.
For testing, I tried doing this though and disabling the set_streamid, 0 call in snd_codec_cleanup() but it still missed those first samples. Is there somewhere else I need to be looking?
Does it happen without dmix, too?
The reset part can be a bit more optimized. But, this is really a sensitive part, which can easily break the I/O status without knowing...
Takashi
participants (1)
-
Takashi Iwai