From: Takashi Iwai Subject: Re: Getting around initial sample loss with intel HDMI Date: Mon, 27 Jul 2009 08:07:40 +0200 Message-ID: References: <20090725203518.GA22885@csy.ca> <20090726173210.GA10897@csy.ca> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BDA14244D8 for ; Mon, 27 Jul 2009 08:07:40 +0200 (CEST) In-Reply-To: <20090726173210.GA10897@csy.ca> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Shane W Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org 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