diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-08-14 01:29:11 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-08-14 01:29:11 +0200 |
commit | 90d5d3239426fa7490973aa6c8f13493f5735aa3 (patch) | |
tree | c6f7853053a41006401f7a0161e4966f6af8bbed | |
parent | c43543ef5b90ad6619edb336c2feef8238121592 (diff) | |
download | ipecamera-90d5d3239426fa7490973aa6c8f13493f5735aa3.tar.gz ipecamera-90d5d3239426fa7490973aa6c8f13493f5735aa3.tar.bz2 ipecamera-90d5d3239426fa7490973aa6c8f13493f5735aa3.tar.xz ipecamera-90d5d3239426fa7490973aa6c8f13493f5735aa3.zip |
More lost event debugging
-rw-r--r-- | data.c | 2 | ||||
-rw-r--r-- | events.c | 14 |
2 files changed, 11 insertions, 5 deletions
@@ -95,7 +95,7 @@ static int ipecamera_get_next_buffer_to_process(ipecamera_t *ctx, pcilib_event_i if ((ctx->event_id - ctx->preproc_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) { size_t preproc_id = ctx->preproc_id; ctx->preproc_id = ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS - 1); - ipecamera_debug(HARDWARE, "Skipping events %zu to %zu as decoding is not fast enough. We are currently %zu buffers beyond, but only %zu buffers are available and safety limit is %zu", + ipecamera_debug(HARDWARE, "Skipping preprocessing of events %zu to %zu as decoding is not fast enough. We are currently %zu buffers beyond, but only %zu buffers are available and safety limit is %zu", preproc_id, ctx->preproc_id - 1, ctx->event_id - ctx->preproc_id, ctx->buffer_size, IPECAMERA_RESERVE_BUFFERS); } @@ -71,8 +71,11 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v #else /* IPECAMERA_ANNOUNCE_READY */ while (ctx->reported_id != ctx->event_id) { #endif /* IPECAMERA_ANNOUNCE_READY */ - if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS); - else ++ctx->reported_id; + if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) { + ipecamera_debug(HARDWARE, "Skipping events %zu to %zu as preprocessing is too slow. We are currently %zu buffers beyond, but only %zu buffers are available and safety limit is %zu", + ctx->reported_id, ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS), ctx->event_id - ctx->reported_id, ctx->buffer_size, IPECAMERA_RESERVE_BUFFERS); + ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS); + } else ++ctx->reported_id; memcpy(&info, ctx->frame + ((ctx->reported_id-1)%ctx->buffer_size), sizeof(ipecamera_event_info_t)); @@ -167,8 +170,11 @@ int ipecamera_next_event(pcilib_context_t *vctx, pcilib_timeout_t timeout, pcili } retry: - if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS); - else ++ctx->reported_id; + if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) { + ipecamera_debug(HARDWARE, "Skipping events %zu to %zu as preprocessing is too slow. We are currently %zu buffers beyond, but only %zu buffers are available and safety limit is %zu", + ctx->reported_id, ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS), ctx->event_id - ctx->reported_id, ctx->buffer_size, IPECAMERA_RESERVE_BUFFERS); + ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS); + } else ++ctx->reported_id; if (evid) *evid = ctx->reported_id; |