summaryrefslogtreecommitdiffstats
path: root/src/ufo-roof-build-task.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-11-17 16:58:02 +0100
committerSuren A. Chilingaryan <csa@suren.me>2019-11-17 16:58:02 +0100
commitea9626b60092f2d2c79431718c3ca8bc383429a6 (patch)
treef76a6dcf118fc3977eda1cbcf368018715ebe01c /src/ufo-roof-build-task.c
parent23f22348c5281fff685c1fa89255e7e1e76266a4 (diff)
downloadufo-roof-temp-ea9626b60092f2d2c79431718c3ca8bc383429a6.tar.gz
ufo-roof-temp-ea9626b60092f2d2c79431718c3ca8bc383429a6.tar.bz2
ufo-roof-temp-ea9626b60092f2d2c79431718c3ca8bc383429a6.tar.xz
ufo-roof-temp-ea9626b60092f2d2c79431718c3ca8bc383429a6.zip
Networking setup
Diffstat (limited to 'src/ufo-roof-build-task.c')
-rw-r--r--src/ufo-roof-build-task.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/ufo-roof-build-task.c b/src/ufo-roof-build-task.c
index fa2fdcd..821c761 100644
--- a/src/ufo-roof-build-task.c
+++ b/src/ufo-roof-build-task.c
@@ -37,6 +37,8 @@ struct _UfoRoofBuildTaskPrivate {
guint number; // Number of datasets to read
gboolean stop; // Stop flag
+
+ guint announced; // For debugging
};
static void ufo_task_interface_init (UfoTaskIface *iface);
@@ -162,31 +164,35 @@ ufo_roof_build_task_process (UfoTask *task,
// UfoRequisition in_req;
// ufo_buffer_get_requisition (inputs[0], &in_req);
- uint8_t *data = (uint8_t*)ufo_buffer_get_host_array(inputs[0], NULL);
+ const uint8_t *data = (uint8_t*)ufo_buffer_get_host_array(inputs[0], NULL);
UfoRoofPacketBlockHeader *header = UFO_ROOF_PACKET_BLOCK_HEADER(data, cfg);
if (priv->stop)
return FALSE;
-
+
+ const uint8_t *fragment = data;
for (guint i = 0; i < header->n_packets; i++) {
guint packet_id = 0;
// Otherwise considered consecutive and handled by the buffer
if (cfg->header_size >= sizeof(UfoRoofPacketHeader)) {
- UfoRoofPacketHeader *pheader = UFO_ROOF_PACKET_HEADER(data);
+ UfoRoofPacketHeader *pheader = UFO_ROOF_PACKET_HEADER(fragment);
packet_id = pheader->packet_id + 1;
}
- ready |= ufo_roof_buffer_set_fragment(buf, header->channel_id, packet_id, data, &gerr);
+ // FIXME: Can we kill here the dataset finished during the previous step of iteration
+ ready |= ufo_roof_buffer_set_fragment(buf, header->channel_id, packet_id, fragment + cfg->header_size, &gerr);
if (gerr) roof_print_error(gerr);
- data += cfg->max_packet_size;
+ fragment += cfg->max_packet_size;
}
// FIXME: if 2nd dataset is ready (2nd and 3rd?), skip the first one?
+/*
+ printf("proc (%s) - channel: %i, packets: %i, first dataset: %i\n", ready?"yes":" no", header->channel_id, header->n_packets,
+ (cfg->header_size >= sizeof(UfoRoofPacketHeader))?UFO_ROOF_PACKET_HEADER(data)->packet_id / (cfg->dataset_size / cfg->payload_size / cfg->n_streams):0);
+*/
-// printf("proc (%s) - channel: %i, packets: %i\n", ready?"yes":" no", header->channel_id, header->n_packets);
-
return !ready;
}
@@ -214,8 +220,12 @@ ufo_roof_build_task_generate (UfoTask *task,
priv->stop = TRUE;
g_object_notify_by_pspec (G_OBJECT(task), properties[PROP_STOP]);
}
-
-// printf("gen(%s) %i\n", ready?"yes":" no", buf->current_id);
+
+
+ if ((buf->current_id - priv->announced) > 1000) {
+ printf("Generating dataset %i (%s)\n", buf->current_id, ready?"yes":" no");
+ priv->announced = buf->current_id;
+ }
return ready;
}