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 <marco.casaroli@gmail.com>
This commit is contained in:
Marco Casaroli 2026-08-03 13:39:32 +02:00 • committed by Alan C. Assis
parent 5b69199093
commit e1f82fcc1c

View file

@ -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;