CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
This file contains the implementation of the receive payload delay buffer. More...
#include "receive_buffer.h"
#include "cdi_os_api.h"
#include "configuration.h"
#include "internal.h"
#include <stdint.h>
#include <stdlib.h>
Data Structures | |
struct | ReceiveBufferState |
Functions | |
static uint64_t | TaiNowMicroseconds () |
CDI_THREAD | ReceiveBufferThread (void *ptr) |
CdiReturnStatus | RxBufferInit (CdiLogHandle log_handle, CdiPoolHandle error_message_pool, int buffer_delay_ms, int max_rx_payloads, CdiQueueHandle output_queue_handle, ReceiveBufferHandle *receive_buffer_handle_ptr, CdiQueueHandle *input_queue_handle_ptr) |
void | RxBufferDestroy (ReceiveBufferHandle receive_buffer_handle) |
Variables | |
static const int | kMaxMissed = 100 |
The number of consecutive payloads with time stamps out of the buffering window before offset is reset. | |
This file contains the implementation of the receive payload delay buffer.
CDI_THREAD ReceiveBufferThread | ( | void * | ptr | ) |
The main function for the receive delay buffer thread. It takes application callback structures from its input queue and sends them to the configured queue after a configurable delay based on the timestamps associated with each payload.
ptr | Pointer to thread specific data. In this case, a pointer to ReceiveBufferState. |
void RxBufferDestroy | ( | ReceiveBufferHandle | receive_buffer_handle | ) |
Destroys the receive delay buffer specified by the handle. Payloads currently in the delay line are pushed to the output queue then the associate thread is shut down and joined and all resources allocated are freed.
receive_buffer_handle | Handle for the receive delay buffer to destroy. |
CdiReturnStatus RxBufferInit | ( | CdiLogHandle | log_handle, |
CdiPoolHandle | error_message_pool, | ||
int | buffer_delay_ms, | ||
int | max_rx_payloads, | ||
CdiQueueHandle | output_queue_handle, | ||
ReceiveBufferHandle * | receive_buffer_handle_ptr, | ||
CdiQueueHandle * | input_queue_handle_ptr ) |
Creates a receive delay buffer of the specified length, allocating all of the associated resources.
log_handle | Handle to the logger to be used for any messages from this module. |
error_message_pool | Handle to the pool to which error messages are to be freed in the event that an internal error prevents an input payload from being sent to the next stage. |
buffer_delay_ms | The number of milliseconds to delay each payload, more or less, depending on each payload's timestamp value. |
max_rx_payloads | The number of objects to allocate for holding payloads in the delay buffer. |
output_queue_handle | Handle to which the receive delay buffer is to send payloads after they've been delayed. |
receive_buffer_handle_ptr | Address of where to write the receive delay buffer's handle if successfully created. |
input_queue_handle_ptr | Address to write the handle for the receive delay buffer's input queue if creation was successful. |
|
inlinestatic |
Convenience function to get the TAI based PTP timestamp and convert it to a single integer value representing the number of microseconds from the epoch.