Dshare Alsa Plugin Audio dropout
#1
Exclamation 
I'm using openelec.

I'm trying to use my 7.1 soundcard with ALC888 as a 5.1 soundcard + 1 channel device for infrared control of my Onkyo receiver via it`s "Remote Interactive" 3.5mm plug .

The solution seems to be to use the dshare alsa plugin.

I then created a new file at /storage/.config/asound.conf with the following content
Code:
pcm.!default = pcm.surround51Kodi

pcm.hdaIntel {
    type hw
    card 0
    device 0
}


pcm_slave.hdaAnalogIntel {
    pcm "hdaIntel"
    channels 8
    rate 48000 #instead of 48000 ?
    format S32_LE
    
    #period_size 0
    #buffer_size 0
    period_time 125000
    #periods 3
    
    #period_time 0
    #buffer_time 0
    #period_size 4096
    #buffer_size 8192
    
}

pcm.surround51Kodi {
    type dshare
    ipc_key 47110815
    ipc_perm 0660
    slave hdaAnalogIntel
    bindings.0 0
    bindings.1 1
    bindings.2 6
    bindings.3 7
    bindings.4 4
    bindings.5 5
    
    #slowptr true
}

pcm.surround51KodiPlug {
    type plug
    slave.pcm "surround51Kodi"
    hint {
        show on
        description "Multichannel 5.1 output analog"    
    }
}

pcm.onkyoRI {
    type dshare
    ipc_key 47110815
    ipc_perm 0660
    slave hdaAnalogIntel
    bindings.0 3
    #slowptr true
}

pcm.onkyoRIPlug {
    type plug
    slave.pcm "onkyoRI"
    hint {
        show on
        description "1 channel output for controlling onkyo via RI"
    }
}

The configuration of the sound channels works, but the sound is wrong. It seems audio packets are dropping randomly.
Here`s the output of the speaker-test program

Code:
# speaker-test -c6 -D plug:default

speaker-test 1.1.0

Playback device is plug:default
Stream parameters are 48000Hz, S16_LE, 6 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 2048 to 2048
Period size range from 1024 to 1024
Using max buffer size 2048
Periods = 4
was set period_size = 1024
was set buffer_size = 2048
0 - Front Left
4 - Front Center
1 - Front Right
7 - Side Right
3 - Rear Right
Write error: -32,Broken pipe
Write error: -32,Broken pipe
Write error: -32,Broken pipe
2 - Rear Left
Write error: -32,Broken pipe
Time per period = 17.816881
0 - Front Left
4 - Front Center
1 - Front Right
7 - Side Right
3 - Rear Right
2 - Rear Left
Time per period = 17.919984
0 - Front Left
4 - Front Center
1 - Front Right
7 - Side Right
3 - Rear Right
2 - Rear Left
Time per period = 17.919974
0 - Front Left
4 - Front Center
1 - Front Right
Write error: -32,Broken pipe
7 - Side Right
3 - Rear Right
2 - Rear Left

While playing with Kodi, the sound is even stranger than this output seems to indicate. with the plug type or copy type

It seems to me an error with the buffers, but I tried many combinations and it never worked. And at more than 375 ms, the buffer seems way too big now.

Can you help me?
Reply
#2
Quote:2 - Rear Left
Write error: -32,Broken pipe

Kodi won't work as long as this issue persists.

period_time 125000 <- is certainly wrong.

Kodi computes periodSize / buffer depending on sampleRate, we aim for arround 200 ms buffer and arround 50 ms periodSize - so 20 wakeups per second.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#3
(2016-02-02, 11:46)fritsch Wrote:
Quote:2 - Rear Left
Write error: -32,Broken pipe

Kodi won't work as long as this issue persists.

period_time 125000 <- is certainly wrong.

Kodi computes periodSize / buffer depending on sampleRate, we aim for arround 200 ms buffer and arround 50 ms periodSize - so 20 wakeups per second.

So with 8 channels at 48000 Hz and format S32_LE (4 Bytes). I should use settings of :

Period size = 8*48000/20*4 = 76800 bytes => 2^16 or 2^17 bytes to get a power of 2
Buffer size = 8*48000/5*4 = 307200 bytes => 2^18 or 2^19 bytes to get a power of 2

I'll try these 3 settings tonight and post the result
Reply
#4
Yeah - try that. Btw. kodi will enumerate by itself and will also try to open this new device that way.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#5
It still doesn't work. The sound is garbled. Are there additional log output that I should post here to get you a better overview of my system.
Thank you
Reply
#6
No - as said: fix your ALSA issue first. You might get better support on the ALSA-USER mailing list as your issue is in no way kodi related.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#7
I solved my problem. The alsa user list didn't help me, but knowing that the issue was the buffer size was not big enough, I found that it was the kernel module that was limiting it.

I recompiled the kernel with CONFIG_SND_HDA_PREALLOC_SIZE set to 2048 instead of 64.

Now the speaker test program can use bigger buffer without audio dropouts as well as kodi.

I don't know if I should push this change to openelec git somehow.

Thank you Fritsch
Reply
#8
You can post a PR and describe your issue there - then it's up to the devs :-)

Thanks for not giving up.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply

Logout Mark Read Team Forum Stats Members Help
Dshare Alsa Plugin Audio dropout0