summaryrefslogtreecommitdiffstats
path: root/src/ufo-roof-buffer.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2020-03-08 16:23:41 +0100
committerSuren A. Chilingaryan <csa@suren.me>2020-03-08 16:23:41 +0100
commit7b2e6168b049be9e7852b2d364d897592eff69fc (patch)
tree65b043a0d0583d03a55db697e228fa30ffb3061c /src/ufo-roof-buffer.h
parent0fa60586c49c2ba10f1e24c6533ebf4980372f2f (diff)
downloadufo-roof-temp-7b2e6168b049be9e7852b2d364d897592eff69fc.tar.gz
ufo-roof-temp-7b2e6168b049be9e7852b2d364d897592eff69fc.tar.bz2
ufo-roof-temp-7b2e6168b049be9e7852b2d364d897592eff69fc.tar.xz
ufo-roof-temp-7b2e6168b049be9e7852b2d364d897592eff69fc.zip
Fix 64-bit ids, ROOF ids are big-endian, skip incomplete datasets at the end and if with specified latency, try to reconstruct from desynchronized streams (harmful, debugging only)
Diffstat (limited to 'src/ufo-roof-buffer.h')
-rw-r--r--src/ufo-roof-buffer.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/ufo-roof-buffer.h b/src/ufo-roof-buffer.h
index 3d7ad2d..8e9c00b 100644
--- a/src/ufo-roof-buffer.h
+++ b/src/ufo-roof-buffer.h
@@ -1,20 +1,30 @@
#ifndef __UFO_ROOF_BUFFER_H
#define __UFO_ROOF_BUUFER_H
+ // This IS harmful! Just for testing
+//#define UFO_ROOF_INDEPENDENT_STREAMS
+
#include <stdatomic.h>
+
struct _UfoRoofBuffer {
- guint current_id; // The ID of the first (active) dataset in the buffer
+ guint64 current_id; // The ID of the first (active) dataset in the buffer
+#ifdef UFO_ROOF_INDEPENDENT_STREAMS
+ guint64 *first_id; // The ID of the first received dataset (used for numbering), -1 means not yet known
+#else
+ guint64 first_id; // The ID of the first received dataset (used for numbering), -1 means not yet known
+#endif
guint ring_size; // Number of datasets to buffer
guint drop_buffers; // If we need to catch up
+ guint latency_buffers; // we skip incomplete buffers if current_id + latency_buffers is ready
uint8_t *ring_buffer; // The ring buffer
_Atomic guint *n_fragments; // Number of completed fragments in each buffer
guint *stream_fragment; // Currently processed fragment in the stream (for ordered streams)
// int *fragments; // Mark individual completed fragments (if we care for partial data)
- guint max_datasets; // Only the specified number of datasets will be buffered, the rest will be silently dropped
+ guint64 max_datasets; // Only the specified number of datasets will be buffered, the rest will be silently dropped
guint n_dims; // Indicates if we just assemble one fragment after another or there is 2D/3D data structure (ROOF)
guint dataset_size; // Size (in bytes) of a full dataset
guint dataset_dims[2]; // x (in bytes), y (in rows)
@@ -30,7 +40,8 @@ typedef struct _UfoRoofBuffer UfoRoofBuffer;
UfoRoofBuffer *ufo_roof_buffer_new(UfoRoofConfig *cfg, guint n_dims, guint max_datasets, GError **error);
void ufo_roof_buffer_free(UfoRoofBuffer *buf);
-gboolean ufo_roof_buffer_set_fragment(UfoRoofBuffer *buffer, guint stream_id, guint fragment_id, gconstpointer fragment, GError **error);
+gboolean ufo_roof_buffer_set_fragment(UfoRoofBuffer *buffer, guint stream_id, guint64 fragment_id, gconstpointer fragment, GError **error);
+gboolean ufo_roof_buffer_skip_to_ready(UfoRoofBuffer *buffer);
gboolean ufo_roof_buffer_get_dataset(UfoRoofBuffer *buffer, gpointer output_buffer, gulong *seqid, GError **error);
#endif