/alps/ipecamera

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to ipecamera/data.c

  • Committer: Suren A. Chilingaryan
  • Date: 2012-10-23 07:43:18 UTC
  • Revision ID: csa@dside.dyndns.org-20121023074318-byukzqt85slrre46
Handle broken frames in ipecamera

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    if (ctx->frame[buf_ptr].event.image_ready) return 0;
46
46
    
47
47
    if (ctx->frame[buf_ptr].event.info.flags&PCILIB_EVENT_INFO_FLAG_BROKEN) {
48
 
        ctx->frame[buf_ptr].event.image_broken = 1;
49
48
        err = PCILIB_ERROR_INVALID_DATA;
 
49
        ctx->frame[buf_ptr].event.image_broken = err;
50
50
        goto ready;
51
51
    }
52
52
        
55
55
    memset(ctx->cmask + ctx->buffer_pos * ctx->dim.height, 0, ctx->dim.height * sizeof(ipecamera_change_mask_t));
56
56
    res = ufo_decoder_decode_frame(ctx->ipedec, ctx->buffer + buf_ptr * ctx->padded_size, ctx->raw_size, pixels, &ctx->frame[buf_ptr].event.meta);
57
57
    if (!res) {
58
 
        ctx->frame[buf_ptr].event.image_broken = 1;
59
58
        err = PCILIB_ERROR_FAILED;
 
59
        ctx->frame[buf_ptr].event.image_broken = err;
60
60
        goto ready;
61
61
    }
62
62
            
131
131
    int err;
132
132
    int buf_ptr = (event_id - 1) % ctx->buffer_size;
133
133
    
134
 
    if (!ctx->preproc) {        
 
134
    if (ctx->preproc) { 
 
135
        if (ctx->frame[buf_ptr].event.image_broken)
 
136
                return ctx->frame[buf_ptr].event.image_broken;
 
137
    } else {
135
138
        pthread_rwlock_rdlock(&ctx->frame[buf_ptr].mutex);
136
139
 
137
140
        err = ipecamera_decode_frame(ctx, event_id);