Skip to contentSkip to conversation

alsa-oss emulation bug?

DISCUSSION Roderick Colenbrander 2 participants 2 messages Nov 17, 2003 – Nov 18, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

At the moment I'm debugging an alsa-oss emulation related bug. I'm using alsa .9.8 on a i810 card. Using native alsa code I can query the capabilities of the card. Alsa tells that only some 16bit formats are supported which is is correct. When I'm in oss emulation mode, the driver also advertises various 8bit formats which is wrong. Because of this problem the app I'm debugging (Wine) is crashing as it tries to use 8bit while it isn't supported.

After some digging in the alsa oss source I found this in snd_pcm_oss_get_formats of pcm_oss.c:
if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream))
< 0)

                return err;
        if (atomic_read(&substream->runtime->mmap_count)) {
                direct = 1;
        } else {
                snd_pcm_oss_setup_t *setup = substream->oss.setup;
                direct = (setup != NULL && setup->direct);
        }
        if (!direct)
                return AFMT_MU_LAW | AFMT_U8 |
                       AFMT_S16_LE | AFMT_S16_BE |
                       AFMT_S8 | AFMT_U16_LE |
                       AFMT_U16_BE;

The supported formats alsa returns in my case is what you see behind the if(!direct) line, so for some reason direct = 0. As I barely know anything about alsa I hope you guys can help me out.

Thanks in advance,
Roderick Colenbrander

-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl

#1 lore raw

At Mon, 17 Nov 2003 23:02:04 +0100,

Quoted 28 lines · Roderick Colenbrander

Hi,

At the moment I'm debugging an alsa-oss emulation related bug. I'm using alsa .9.8 on a i810 card. Using native alsa code I can query the capabilities of the card. Alsa tells that only some 16bit formats are supported which is is correct. When I'm in oss emulation mode, the driver also advertises various 8bit formats which is wrong. Because of this problem the app I'm debugging (Wine) is crashing as it tries to use 8bit while it isn't supported.

After some digging in the alsa oss source I found this in snd_pcm_oss_get_formats of pcm_oss.c:
if ((err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream))
< 0)

                return err;
        if (atomic_read(&substream->runtime->mmap_count)) {
                direct = 1;
        } else {
                snd_pcm_oss_setup_t *setup = substream->oss.setup;
                direct = (setup != NULL && setup->direct);
        }
        if (!direct)
                return AFMT_MU_LAW | AFMT_U8 |
                       AFMT_S16_LE | AFMT_S16_BE |
                       AFMT_S8 | AFMT_U16_LE |
                       AFMT_U16_BE;
Quoted 3 lines

The supported formats alsa returns in my case is what you see behind the if(!direct) line, so for some reason direct = 0. As I barely know anything about alsa I hope you guys can help me out.

see alsa-kernel/Documentation/OSS-Emulation.txt, section "PCM mode". the default (plugin) mode is sometimes problematic when mmap is used.

Takashi

-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl