summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-04-28 22:40:51 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-04-28 22:40:51 +0200
commit4130584c764aecb55ccb259ad8e9816a6fd423b9 (patch)
treef6c93debdbb7c8552da56fef67558598fddc436f
parentb44c763039a5ca01efd6d5ef19fb941e2996554e (diff)
downloadipecamera-4130584c764aecb55ccb259ad8e9816a6fd423b9.tar.gz
ipecamera-4130584c764aecb55ccb259ad8e9816a6fd423b9.tar.bz2
ipecamera-4130584c764aecb55ccb259ad8e9816a6fd423b9.tar.xz
ipecamera-4130584c764aecb55ccb259ad8e9816a6fd423b9.zip
Support CMOSIS bug resulting in missing payload
-rw-r--r--private.h6
-rw-r--r--reader.c5
2 files changed, 8 insertions, 3 deletions
diff --git a/private.h b/private.h
index a0611f3..ff36e92 100644
--- a/private.h
+++ b/private.h
@@ -5,9 +5,9 @@
#include <pcilib/model.h>
#include "ipecamera.h"
-//#define IPECAMERA_BUG_EXTRA_DATA
-#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_INCOMPLETE_PACKETS
+#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_INCOMPLETE_PACKETS //**< Support incomplete packets, i.e. check for frame magic even if full frame size is not reached yet (slow) */
#define IPECAMERA_BUG_POSTPONED_READ
#define IPECAMERA_DEBUG_BROKEN_FRAMES "/mnt/frames"
//#define IPECAMERA_DEBUG_RAW_PACKETS "/mnt/frames"
diff --git a/reader.c b/reader.c
index db700cd..63806f1 100644
--- a/reader.c
+++ b/reader.c
@@ -38,6 +38,11 @@ int ipecamera_compute_buffer_size(ipecamera_t *ctx, size_t lines) {
raw_size = lines * line_size;
raw_size *= 16 / ctx->cmosis_outputs;
raw_size += header_size + footer_size;
+
+#ifdef IPECAMERA_BUG_MISSING_PAYLOAD
+ // As I understand, the first 32-byte packet is missing, so we need to substract 32
+ raw_size -= 32;
+#endif /* IPECAMERA_BUG_MISSING_PAYLOAD */
}
padded_blocks = raw_size / IPECAMERA_DMA_PACKET_LENGTH + ((raw_size % IPECAMERA_DMA_PACKET_LENGTH)?1:0);