diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-08-05 19:39:17 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-08-05 19:39:17 +0200 |
commit | ff82489cba07d124ca76ac9ce78e70c73cad9317 (patch) | |
tree | 5ffc336220e21ea034e158d5da068bd8aed8b705 | |
parent | 5edb8d14272ea2ecd9784a26e150a45954d67e2e (diff) | |
download | ipecamera-ff82489cba07d124ca76ac9ce78e70c73cad9317.tar.gz ipecamera-ff82489cba07d124ca76ac9ce78e70c73cad9317.tar.bz2 ipecamera-ff82489cba07d124ca76ac9ce78e70c73cad9317.tar.xz ipecamera-ff82489cba07d124ca76ac9ce78e70c73cad9317.zip |
Add handling of a bug when IPECamera producing a dublicate 16 bytes at 4096 offset
-rw-r--r-- | private.h | 1 | ||||
-rw-r--r-- | reader.c | 12 |
2 files changed, 12 insertions, 1 deletions
@@ -19,6 +19,7 @@ #define IPECAMERA_BUG_MISSING_PAYLOAD //**< CMOSIS fails to provide a first payload for each frame, therefore the frame is 32 bit shorter */ #define IPECAMERA_BUG_MULTIFRAME_PACKETS //**< This is by design, start of packet comes directly after the end of last one in streaming mode */ +#define IPECAMERA_BUG_REPEATING_DATA //**< 16 bytes repeated at frame offset 4096, the problem start/stop happenning on board restart */ //#define IPECAMERA_BUG_INCOMPLETE_PACKETS //**< Support incomplete packets, i.e. check for frame magic even if full frame size is not reached yet (slow) */ //#define IPECAMERA_ANNOUNCE_READY //**< Announce new event only after the reconstruction is done */ //#define IPECAMERA_CLEAN_ON_START //**< Read all the data from DMA before starting of recording */ @@ -234,8 +234,18 @@ static int ipecamera_data_callback(void *user, pcilib_dma_flags_t flags, size_t return -PCILIB_ERROR_TOOBIG; } - if (bufsize) + if (bufsize) { +#ifdef IPECAMERA_BUG_REPEATING_DATA + if ((bufsize > 16)&&(ctx->cur_size > 16)) { + if (!memcmp(ctx->buffer + ctx->buffer_pos * ctx->padded_size + ctx->cur_size - 16, buf, 16)) { + pcilib_warning("Skipping repeating bytes at offset %zu of frame %zu", ctx->cur_size, ctx->event_id); + buf += 16; + bufsize -=16; + } + } +#endif /* IPECAMERA_BUG_REPEATING_DATA */ memcpy(ctx->buffer + ctx->buffer_pos * ctx->padded_size + ctx->cur_size, buf, bufsize); + } } ctx->cur_size += bufsize; |