You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Tim Hardisty <ti...@hardisty.co.uk> on 2023/03/15 13:54:06 UTC
NXplayer, null audio
Hi all,
I am investigating but someone may have seen this already?
Developing a custom audio driver but getting started with the null audio device and NXplayer. I have saved a WAV file to the smartfs and it appears to be valid. In case relevant I did this by saving the wav file to a header file as an unsigned char array and writing this our programmatically to the file system to avoid messing around with memory sticks/usb/rndis/anything "clever" at this time!
When I try and play it with NXplayer, it fails while trying to enqueue the buffer and behaves as if the file is not open (EBADF) but - so far, as I step through - the file does seem to be opened OK:
audio_ioctl: AUDIOIOC_ENQUEUEBUFFER
pcm_enqueuebuffer: Received buffer 0x20098468, streaming=0
pcm_enqueuebuffer: curbyte=0 nbytes=8192 nmaxbytes=8192 bytesleft=8192
pcm_enqueuebuffer: Begin streaming: apb=0x20098468 curbyte=0 nbytes=8192
pcm_enqueuebuffer: Pass to lower enqueuebuffer: apb=0x20098468 curbyte=0 nbytes=8192
null_enqueuebuffer: apb=0x20098468 curbyte=0 nbytes=8192
null_enqueuebuffer: ERROR: file_mq_send failed: -9
null_enqueuebuffer: Return OK
audio_callback: Entry
audio_complete: Entry
nxplayer_enqueuebuffer: ERROR: AUDIOIOC_ENQUEUEBUFFER ioctl failed: 22
Full debug syslog output in case relevant:
NuttShell (NSH) NuttX-12.0.0
nsh> nxplayer
NxPlayer version 1.05
h for commands, q to exit
nxplayer> play drumroll.wav
nxplayer_playinternal: ==============================
nxplayer_playinternal: Playing file drumroll.wav
nxplayer_playinternal: ==============================
audio_open: crefs: 0
audio_ioctl: cmd: 4097 arg: 537490888
audio_ioctl: AUDIOIOC_GETCAPS: Device=0
null_getcaps: type=0
null_getcaps: Return 16
audio_ioctl: cmd: 4098 arg: 0
audio_ioctl: AUDIOIOC_RESERVE
pcm_reserve: Defer to lower reserve
null_reserve: Return OK
audio_ioctl: cmd: 4106 arg: 537491212
audio_ioctl: Forwarding unrecognized cmd: 4106 arg: 537491212
pcm_ioctl: Defer to lower ioctl, cmd=4106 arg=537491212
null_ioctl: cmd=4106 arg=537491212
null_ioctl: AUDIOIOC_GETBUFFERINFO:
null_ioctl: Return OK
audio_ioctl: cmd: 4110 arg: 4
audio_ioctl: AUDIOIOC_REGISTERMQ
nxplayer_playthread: Entrynxplayer>
audio_ioctl: cmd: 4106 arg: 537494496
audio_ioctl: Forwarding unrecognized cmd: 4106 arg: 537494496
pcm_ioctl: Defer to lower ioctl, cmd=4106 arg=537494496
null_ioctl: cmd=4106 arg=537494496
null_ioctl: AUDIOIOC_GETBUFFERINFO:
null_ioctl: Return OK
audio_ioctl: cmd: 4107 arg: 537494500
audio_ioctl: AUDIOIOC_ALLOCBUFFER
audio_ioctl: cmd: 4107 arg: 537494500
audio_ioctl: AUDIOIOC_ALLOCBUFFER
audio_ioctl: cmd: 4107 arg: 537494500
audio_ioctl: AUDIOIOC_ALLOCBUFFER
audio_ioctl: cmd: 4107 arg: 537494500
audio_ioctl: AUDIOIOC_ALLOCBUFFER
audio_ioctl: cmd: 4109 arg: 537494448
audio_ioctl: AUDIOIOC_ENQUEUEBUFFER
pcm_enqueuebuffer: Received buffer 0x20098468, streaming=0
pcm_enqueuebuffer: curbyte=0 nbytes=8192 nmaxbytes=8192 bytesleft=8192
pcm_enqueuebuffer: Begin streaming: apb=0x20098468 curbyte=0 nbytes=8192
pcm_enqueuebuffer: Pass to lower enqueuebuffer: apb=0x20098468 curbyte=0 nbytes=8192
null_enqueuebuffer: apb=0x20098468 curbyte=0 nbytes=8192
null_enqueuebuffer: ERROR: file_mq_send failed: -9
null_enqueuebuffer: Return OK
audio_callback: Entry
audio_complete: Entry
nxplayer_enqueuebuffer: ERROR: AUDIOIOC_ENQUEUEBUFFER ioctl failed: 22
nxplayer_playthread: 0 buffers queued, running=1 streaming=0
nxplayer_playthread: Playing...
nxplayer_playthread: Play complete. outstanding=0
nxplayer_playthread: Clean-up and exit
nxplayer_playthread: Freeing buffers
audio_ioctl: cmd: 4108 arg: 537494500
audio_ioctl: AUDIOIOC_FREEBUFFER
audio_ioctl: cmd: 4108 arg: 537494500
audio_ioctl: AUDIOIOC_FREEBUFFER
audio_ioctl: cmd: 4108 arg: 537494500
audio_ioctl: AUDIOIOC_FREEBUFFER
audio_ioctl: cmd: 4108 arg: 537494500
audio_ioctl: AUDIOIOC_FREEBUFFER
audio_ioctl: cmd: 4111 arg: 4
audio_ioctl: AUDIOIOC_UNREGISTERMQ
audio_ioctl: cmd: 4099 arg: 0
audio_ioctl: AUDIOIOC_RELEASE
pcm_release: Defer to lower release
audio_close: crefs: 1
audio_close: calling shutdown
pcm_shutdown: Defer to lower shutdown
null_shutdown: Return OK
nxplayer_playthread: Exit
RE: NXplayer, null audio
Posted by Tim Hardisty <ti...@hardisty.co.uk>.
>From: Tim Hardisty <ti...@hardisty.co.uk>
>
>Hi all,
>
>I am investigating but someone may have seen this already?
>
>
>When I try and play it with NXplayer, it fails while trying to enqueue
>the buffer and behaves as if the file is not open (EBADF)
After comparing audio_null.c to (for example) cs43l22.c I have made some changes to audio_null.c and it now seems to behave but I don't know if it will come back to bite me. There is now a check like this:
if (priv->mq.f_inode != NULL)
before attempting to file_mq_send()
This seems to be to avoid enqueuing data before play has actually started (according to the comment).
Does that make sense and/or ring any bells with anyone?