You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/07/29 16:18:40 UTC
[incubator-nuttx-apps] branch master updated: nxlooper: nxlooper should wait call buffer returned before close
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 8081711e2 nxlooper: nxlooper should wait call buffer returned before close
8081711e2 is described below
commit 8081711e221e4d65748c74ee9123cb672d41cbbf
Author: ligd <li...@xiaomi.com>
AuthorDate: Wed Apr 27 12:01:17 2022 +0800
nxlooper: nxlooper should wait call buffer returned before close
Signed-off-by: ligd <li...@xiaomi.com>
---
system/nxlooper/nxlooper.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/system/nxlooper/nxlooper.c b/system/nxlooper/nxlooper.c
index b71d75c23..8a6dd9b1d 100644
--- a/system/nxlooper/nxlooper.c
+++ b/system/nxlooper/nxlooper.c
@@ -330,7 +330,8 @@ static void *nxlooper_loopthread(pthread_addr_t pvarg)
FAR struct ap_buffer_s **recordbufs = NULL;
unsigned int prio;
ssize_t size;
- bool running = true;
+ int running = 2;
+ bool streaming = true;
int x;
int ret;
@@ -495,6 +496,11 @@ static void *nxlooper_loopthread(pthread_addr_t pvarg)
/* An audio buffer is being dequeued by the driver */
case AUDIO_MSG_DEQUEUE:
+ if (!streaming)
+ {
+ break;
+ }
+
apb = msg.u.ptr;
apb->curbyte = 0;
if (apb->flags & AUDIO_APB_PLAY)
@@ -576,8 +582,12 @@ static void *nxlooper_loopthread(pthread_addr_t pvarg)
ioctl(plooper->playdev_fd, AUDIOIOC_STOP, 0);
ioctl(plooper->recorddev_fd, AUDIOIOC_STOP, 0);
#endif
+ streaming = false;
+
+ break;
- running = false;
+ case AUDIO_MSG_COMPLETE:
+ running--;
break;
/* Unknown / unsupported message ID */