usleep(POLL_ERROR_TRY_SLEEP_US);
continue;
} else {
- LOGE("error count[%d] exceeded", POLL_ERROR_TRY_COUNT_MAX);
- break;
+ LOGE("error count[%d][max:%d] exceeded", error_count, POLL_ERROR_TRY_COUNT_MAX);
}
}
}
locker = g_mutex_locker_new(&buffer_control->lock);
while (g_queue_is_empty(buffer_control->buffers.idle_buffers)) {
- LOGD("type[%d] wait for idle buffer for %"G_GINT64_FORMAT" ms",
- buffer_control->type, timeout_ms);
+ if (timeout_ms > 0) {
+ LOGD("wait for idle buffer for %"G_GINT64_FORMAT" ms", timeout_ms);
- end_time = g_get_monotonic_time() + (G_TIME_SPAN_MILLISECOND * timeout_ms);
+ end_time = g_get_monotonic_time() + (G_TIME_SPAN_MILLISECOND * timeout_ms);
- if (!g_cond_wait_until(&buffer_control->cond, &buffer_control->lock, end_time)) {
- LOGE("type[%d] wait timed out for %"G_GINT64_FORMAT" ms", buffer_control->type, timeout_ms);
- return NULL;
+ if (!g_cond_wait_until(&buffer_control->cond, &buffer_control->lock, end_time)) {
+ LOGE("wait timed out for %"G_GINT64_FORMAT" ms", timeout_ms);
+ return NULL;
+ }
+ } else {
+ LOGD("wait for idle buffer");
+ g_cond_wait(&buffer_control->cond, &buffer_control->lock);
}
+
+ LOGD("signal received - check again[queue length:%u]",
+ g_queue_get_length(buffer_control->buffers.idle_buffers));
}
index = GPOINTER_TO_INT(g_queue_pop_head(buffer_control->buffers.idle_buffers));
return HAL_CODEC_ERROR_NONE;
}
- idle_buffer = __codec_v4l2_get_idle_buffer(buffer_control, IDLE_BUFFER_TIME_OUT_MS);
+ idle_buffer = __codec_v4l2_get_idle_buffer(buffer_control, 0);
if (!idle_buffer) {
LOGE("no idle buffer");
- return HAL_CODEC_ERROR_INTERNAL;
+ return HAL_CODEC_ERROR_DEVICE_BUSY;
}
memcpy(idle_buffer->planes.plane[0].data, buffer->planes.plane[0].data, buffer->planes.plane[0].bytesused);