summaryrefslogtreecommitdiffstats
path: root/ipecamera/data.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-10-23 09:43:18 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-10-23 09:43:18 +0200
commitd08aee7b4f62d5e4b3202fe6e4d724f84963618b (patch)
tree0110f805094805929b2377eac12862672885e8af /ipecamera/data.c
parent7b265f85942f0aaa9a48c5773dff6bd27a6970b3 (diff)
downloadipecamera-d08aee7b4f62d5e4b3202fe6e4d724f84963618b.tar.gz
ipecamera-d08aee7b4f62d5e4b3202fe6e4d724f84963618b.tar.bz2
ipecamera-d08aee7b4f62d5e4b3202fe6e4d724f84963618b.tar.xz
ipecamera-d08aee7b4f62d5e4b3202fe6e4d724f84963618b.zip
Handle broken frames in ipecamera
Diffstat (limited to 'ipecamera/data.c')
-rw-r--r--ipecamera/data.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ipecamera/data.c b/ipecamera/data.c
index 10a4954..115d12e 100644
--- a/ipecamera/data.c
+++ b/ipecamera/data.c
@@ -45,8 +45,8 @@ inline static int ipecamera_decode_frame(ipecamera_t *ctx, pcilib_event_id_t eve
if (ctx->frame[buf_ptr].event.image_ready) return 0;
if (ctx->frame[buf_ptr].event.info.flags&PCILIB_EVENT_INFO_FLAG_BROKEN) {
- ctx->frame[buf_ptr].event.image_broken = 1;
err = PCILIB_ERROR_INVALID_DATA;
+ ctx->frame[buf_ptr].event.image_broken = err;
goto ready;
}
@@ -55,8 +55,8 @@ inline static int ipecamera_decode_frame(ipecamera_t *ctx, pcilib_event_id_t eve
memset(ctx->cmask + ctx->buffer_pos * ctx->dim.height, 0, ctx->dim.height * sizeof(ipecamera_change_mask_t));
res = ufo_decoder_decode_frame(ctx->ipedec, ctx->buffer + buf_ptr * ctx->padded_size, ctx->raw_size, pixels, &ctx->frame[buf_ptr].event.meta);
if (!res) {
- ctx->frame[buf_ptr].event.image_broken = 1;
err = PCILIB_ERROR_FAILED;
+ ctx->frame[buf_ptr].event.image_broken = err;
goto ready;
}
@@ -131,7 +131,10 @@ static int ipecamera_get_frame(ipecamera_t *ctx, pcilib_event_id_t event_id) {
int err;
int buf_ptr = (event_id - 1) % ctx->buffer_size;
- if (!ctx->preproc) {
+ if (ctx->preproc) {
+ if (ctx->frame[buf_ptr].event.image_broken)
+ return ctx->frame[buf_ptr].event.image_broken;
+ } else {
pthread_rwlock_rdlock(&ctx->frame[buf_ptr].mutex);
err = ipecamera_decode_frame(ctx, event_id);