logo       


Re: Possible fix for ALSA asserts: msg#00084

Subject: Re: Possible fix for ALSA asserts
Chris Robinson wrote:
Since it seemed to be caused by setting contexts, I tracked it down to the setAttributes call. Setting the device attributes once on creation instead of every time the context changed cleared up problem.

While I can see what was attempted with resetting the attributes on context change, I don't believe it is correct. In certain (non-ideal) situations, the context can be changing several times a second, and apparently ALSA doesn't like that. But even if it did work, I can only imagine what it'll sound like if the two contexts have different playback rates..

I think the correct way to handle seperate attributes would be to have a per-context mixer, or perhaps opening a new device for each context. Though we could also just not worry about it and only allow rates the device was opened with, or attempt to set the attributes on first context creation (the Windows version only allows for one context per device, so I don't foresee enforcing one sample rate to be an immediate problem for code that's made to be portable).

Attached is a preliminary patch. This also fixes a problem with the (now removed) alcDeviceSet_ function generating an error, but not having alcMakeContextCurrent fail. The patch should work as-is, but it's missing frequency and refresh rate enforcement in alcCreateContext (which is supposed to fail if the given attributes can't be honored). I'm too tired right now, but I should be able to do that first thing later.

And speaking of context attributes, I think ALC_SYNC should be disallowed (and the relevant syncronous mixer code removed), until the mixer itself gets properly restructured and it can be properly handled. It'll be a lot easier to fix the mixer if it can be cut down in complexity. It can be re-added when the mixer is fixed up, but as it is, I can see many problems if someone tries to mix asyncronous and syncronous contexts. The Windows version does not allow syncronous mixing, so again, not a problem for portable code.

The only thing I would worry about with this suggestion is breaking any existing programs that are relying on it. That said, I just made the rather surprising realization that while the spec introduces the ALC_SYNC flag as a context attribute for "indicating a synchronous context", it makes absolutely no mention of what exactly a synchronous context is, or why you might want to create one (this is also true of the old 1.0 spec written by Loki). I vaguely remember tracing through a very early implementation to see what synchronous contexts did, but I don't remember how they worked.

I don't think I've ever heard of anybody posting to the list about it or needing to use it for whatever reason. My guess would be that nobody would notice if you removed it, but I'd at least wait for a couple of other opinions before starting with that.

--

--"J"

"I'm a castaway stranded in a desolate land,
I can see the footprints in the virtual sand."
        --Neil Peart


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe