This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e1f82fcc1cf668046b66f4a93a80f70355aa57c2
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Aug 3 13:39:32 2026 +0200

    audio: Fix the build with CONFIG_AUDIO_MULTI_SESSION.
    
    Under CONFIG_AUDIO_MULTI_SESSION, audio_pause() and audio_resume() take a
    session argument, but two internal call sites still passed only the file
    pointer:
    
      audio.c:612  audio_start() forwarding a resume of a paused device
      audio.c:694  audio_stop()  forwarding a pause
    
    Neither compiles, so the option cannot be selected at all -- which is
    presumably why nobody has noticed.
    
    Guarded the way the rest of the file guards the same pair.
    
    Tested on sim:nsh with AUDIO, AUDIO_MULTI_SESSION and AUDIO_NULL.  Before
    the change, audio.c does not compile.  After the change, the build passes.
    A local test app on the null audio device runs both changed paths:
    AUDIOIOC_START on a paused device resumes it, and AUDIOIOC_STOP while
    another open is paused pauses the device.  Both return 0.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 audio/audio.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/audio/audio.c b/audio/audio.c
index 8016ef45ac3..7b83e59af8a 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -609,7 +609,11 @@ static int audio_start(FAR struct file *filep)
 #ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
   else if (upper->status->state == AUDIO_STATE_PAUSED)
     {
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+      return audio_resume(filep, session);
+#else
       return audio_resume(filep);
+#endif
     }
 #endif /* CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME */
 
@@ -691,7 +695,11 @@ static int audio_stop(FAR struct file *filep)
 #ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
   else if (nstate == AUDIO_STATE_PAUSED)
     {
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+      ret = audio_pause(filep, session);
+#else
       ret = audio_pause(filep);
+#endif
       if (ret != OK)
         {
           return ret;

Reply via email to