You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon PJSUA initialization and audio output selection, the channels of a stereo output can randomly be reversed.
Steps to reproduce
I am using a stereo output as two independent mono channels.
With the ALSA configuration:
pcm.chanA {
type plug
slave.pcm {
type dshare
ipc_key 123456
slave.pcm "hw:0,0"
slave.channels 2
bindings.0 0
}
}
pcm.chanB {
type plug
slave.pcm {
type dshare
ipc_key 123456
slave.pcm "hw:0,0"
slave.channels 2
bindings.0 1
}
... Run for instance speaker-test -D chanA -t sine -f 440 in the background then perform a default pjsua_create(), pjsua_init() (except for pjsua_media_config.channel_count=2, which is mandatory in this context), pjsua_start() sequence, followed by a pjsua_set_snd_dev() to direct the audio output to "chanB".
PJSIP version
2.15
Context
PJSUA lib used for VoIP only, on a custom board built around an ARM-based system-on-chip (Atmel/microchip SAMA5) and a Wolfson/Cirrus Logic WM8904 audio codec, which is supported by a platform-specific driver. Operating system is based on Linux 6.6 kernel and Debian 12
The test program (logs below) initialize pjsua as described above, invokes pjsua_set_snd_dev(), waits for 1 second, then performs pjsua_destroy(). Reversal chance is roughly 1 out of 5, and can happen when channels were already reversed (thus getting back to normal). If I remove pjsua_set_snd_dev() the problem doesn't happen.
The program which uses the second audio channel doesn't matter. It can be speaker-test or mpg123. Also AFAICT running speaker-test and mpg123 each on their channel doesn't cause a similar issue.
Quite frankly, I'm also not sure why this issue could happen. We only use standard ALSA API calls in alsa_dev, such as snd_pcm_open(), snd_pcm_writei(), etc. So perhaps you could take a look deeper at pjmedia-audiodev/alsa_dev.c to isolate what caused the issue.
Describe the bug
Upon PJSUA initialization and audio output selection, the channels of a stereo output can randomly be reversed.
Steps to reproduce
I am using a stereo output as two independent mono channels.
With the ALSA configuration:
... Run for instance
speaker-test -D chanA -t sine -f 440
in the background then perform a default pjsua_create(), pjsua_init() (except for pjsua_media_config.channel_count=2, which is mandatory in this context), pjsua_start() sequence, followed by a pjsua_set_snd_dev() to direct the audio output to "chanB".PJSIP version
2.15
Context
PJSUA lib used for VoIP only, on a custom board built around an ARM-based system-on-chip (Atmel/microchip SAMA5) and a Wolfson/Cirrus Logic WM8904 audio codec, which is supported by a platform-specific driver. Operating system is based on Linux 6.6 kernel and Debian 12
The test program (logs below) initialize pjsua as described above, invokes pjsua_set_snd_dev(), waits for 1 second, then performs pjsua_destroy(). Reversal chance is roughly 1 out of 5, and can happen when channels were already reversed (thus getting back to normal). If I remove pjsua_set_snd_dev() the problem doesn't happen.
The program which uses the second audio channel doesn't matter. It can be speaker-test or mpg123. Also AFAICT running speaker-test and mpg123 each on their channel doesn't cause a similar issue.
Log, call stack, etc
The text was updated successfully, but these errors were encountered: