From d2dc73cab5b1c08822ce0066251e362f01525f10 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 12 Dec 2011 15:27:13 +0100 Subject: Minor fixes and improvements --- ipecamera/events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ipecamera/events.c') diff --git a/ipecamera/events.c b/ipecamera/events.c index 173423b..a6cf57e 100644 --- a/ipecamera/events.c +++ b/ipecamera/events.c @@ -21,6 +21,7 @@ #include "events.h" int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, void *user) { + int run_flag = 1; int res, err = 0; int do_stop = 0; @@ -46,7 +47,7 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v } // This loop iterates while the generation - while ((ctx->run_streamer)||(ctx->reported_id != ctx->event_id)) { + while ((run_flag)&&((ctx->run_streamer)||(ctx->reported_id != ctx->event_id))) { while (ctx->reported_id != ctx->event_id) { 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; @@ -57,6 +58,7 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v res = callback(ctx->reported_id, (pcilib_event_info_t*)&info, user); if (res <= 0) { if (res < 0) err = -res; + run_flag = 0; break; } } -- cgit v1.2.3