nxlooper: nxlooper should wait call buffer returned before close
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
eef03ad0a1
commit
8081711e22
@ -330,7 +330,8 @@ static void *nxlooper_loopthread(pthread_addr_t pvarg)
|
|||||||
FAR struct ap_buffer_s **recordbufs = NULL;
|
FAR struct ap_buffer_s **recordbufs = NULL;
|
||||||
unsigned int prio;
|
unsigned int prio;
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
bool running = true;
|
int running = 2;
|
||||||
|
bool streaming = true;
|
||||||
int x;
|
int x;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -495,6 +496,11 @@ static void *nxlooper_loopthread(pthread_addr_t pvarg)
|
|||||||
/* An audio buffer is being dequeued by the driver */
|
/* An audio buffer is being dequeued by the driver */
|
||||||
|
|
||||||
case AUDIO_MSG_DEQUEUE:
|
case AUDIO_MSG_DEQUEUE:
|
||||||
|
if (!streaming)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
apb = msg.u.ptr;
|
apb = msg.u.ptr;
|
||||||
apb->curbyte = 0;
|
apb->curbyte = 0;
|
||||||
if (apb->flags & AUDIO_APB_PLAY)
|
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->playdev_fd, AUDIOIOC_STOP, 0);
|
||||||
ioctl(plooper->recorddev_fd, AUDIOIOC_STOP, 0);
|
ioctl(plooper->recorddev_fd, AUDIOIOC_STOP, 0);
|
||||||
#endif
|
#endif
|
||||||
|
streaming = false;
|
||||||
|
|
||||||
running = false;
|
break;
|
||||||
|
|
||||||
|
case AUDIO_MSG_COMPLETE:
|
||||||
|
running--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Unknown / unsupported message ID */
|
/* Unknown / unsupported message ID */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user