/alps/ipecamera

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to events.c

  • Committer: Suren A. Chilingaryan
  • Date: 2015-08-13 23:29:11 UTC
  • Revision ID: csa@suren.me-20150813232911-d8sbr4fucnosdq88
More lost event debugging

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
#else /* IPECAMERA_ANNOUNCE_READY */
72
72
            while (ctx->reported_id != ctx->event_id) {
73
73
#endif /* IPECAMERA_ANNOUNCE_READY */
74
 
                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);
75
 
                else ++ctx->reported_id;
 
74
                if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) {
 
75
                    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",
 
76
                        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);
 
77
                    ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS);
 
78
                } else ++ctx->reported_id;
76
79
 
77
80
                memcpy(&info, ctx->frame + ((ctx->reported_id-1)%ctx->buffer_size), sizeof(ipecamera_event_info_t));
78
81
 
167
170
    }
168
171
 
169
172
retry:
170
 
    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);
171
 
    else ++ctx->reported_id;
 
173
    if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) {
 
174
        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",
 
175
            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);
 
176
        ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS);
 
177
    } else ++ctx->reported_id;
172
178
 
173
179
    if (evid) *evid = ctx->reported_id;
174
180