anand2532 commented on issue #19413:
URL: https://github.com/apache/nuttx/issues/19413#issuecomment-6766077273

   @acassis , @xiaoxiang781216 @PiyushPatle26 
   
   Reproduced on master 7e5a7708 (sim:alsa). This host has no sound card
   (/proc/asound/cards is missing). ~/.asoundrc points pcm.!default at the
   ALSA file plugin so playback can be recorded:
   
     pcm.!default {
         type file
         slave.pcm "null"
         file "/tmp/nuttx-alsa.raw"
         format raw
     }
   
   A 1-second 44.1 kHz stereo S16_LE WAV was the current directory, which
   sim:alsa mounts at /data.
   
     nsh> nxplayer
     NxPlayer version 1.05
     nxplayer> volume
     volume: 40
     nxplayer> volume 100
     nxplayer> play /data/center.wav
     nuttx: simple.c:269: snd_mixer_selem_has_playback_channel: Assertion 
`elem' failed.
   
   The process receives SIGABRT. /tmp/nuttx-alsa.raw stays 0 bytes.
   libasound2 1.2.11. gdb backtrace:
   
     #6  snd_mixer_selem_has_playback_channel () from libasound.so.2
     #7  snd_mixer_selem_set_playback_volume_all () from libasound.so.2
     #8  sim_audio_configure (dev=0xf3c37c18, caps=0xf3d1bb08) at 
sim/posix/sim_alsa.c:451
     #14 nxplayer_setvolume (pplayer=0xf3c4a298, volume=1000) at nxplayer.c:1327
     #15 nxplayer_playthread (pvarg=0xf3c4a298) at nxplayer.c:1025
   
   sim_mixer_open() looks up the "Master" element. This device has none, so
   priv->volume is NULL. The fail path still returns 0, and audio init
   continues. When the play thread applies the volume, sim_audio_configure()
   calls snd_mixer_selem_set_playback_volume_all(priv->volume, ...) and ALSA
   aborts on the NULL element.
   
   The `volume` command only stores the level. The ioctl happens after
   AUDIOIOC_START, inside the play thread, which is why the shell looks fine
   until `play`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to