media: Wait for receiving mq
while and sleep make timing issue
#define CONFIG_AUDIO_RESAMPLER_BUFSIZE 4096
#endif
+#ifndef CONFIG_PROCESS_MSG_TIMEOUT_MSEC
+#define CONFIG_PROCESS_MSG_TIMEOUT_MSEC 30
+#endif
+
#define INVALID_ID -1
/****************************************************************************
@@ -1730,6 +1734,12 @@ audio_manager_result_t get_device_process_handler_message(int card_id, int devic
return AUDIO_MANAGER_INVALID_DEVICE;
}
clock_gettime(CLOCK_REALTIME, &st_time);
+ st_time.tv_sec += (CONFIG_PROCESS_MSG_TIMEOUT_MSEC) / 1000;
+ st_time.tv_nsec += (CONFIG_PROCESS_MSG_TIMEOUT_MSEC % 1000) * 1000000;
+ if (st_time.tv_nsec >= 1000000000) {
+ st_time.tv_sec += (st_time.tv_nsec) / 1000000000;
+ st_time.tv_nsec %= 1000000000;
+ }
size = mq_timedreceive(card->config[device_id].process_handler, (FAR char *)&msg, sizeof(msg), &prio, &st_time);
if (size != sizeof(msg)) {
