Tinyalsa pcm_stop fix
pcm_stop shall not wait until all msgs are received, instead if any
msg currently available or not.
@@ -1119,8 +1119,10 @@ int pcm_stop(struct pcm *pcm)
struct audio_msg_s msg;
unsigned int size;
int prio;
- while (pcm->buf_ptr > 0) {
- size = mq_receive(pcm->mq, (FAR char *)&msg, sizeof(msg), &prio);
+ struct timespec st_time;
+ while (1) {
+ clock_gettime(CLOCK_REALTIME, &st_time);
+ size = mq_timedreceive(pcm->mq, (FAR char *)&msg, sizeof(msg), &prio, &st_time);
if (size != sizeof(msg)) {
break;
}
