DELTA_LiveStream
DELTA_LiveStream starts live data streaming after the camera connection has been completed through DELTA_Device and the required processing settings have been configured through DELTA_Processing. Configure the required settings before calling startStream() to get the expected behavior. For the recommended order, refer to the Typical flow in each module. If the required settings are not configured, data may not be received or the SDK may run with default settings.
Back to API overview.
Typical flow

Continuous raw access uses the native grouped-AER USB data supplied during startStream(). Register setRawStreamCallback() to receive chunks directly, or use startRawStream() with getRawStream() to retrieve buffered chunks by polling. The two methods can be used independently.
For polling, the typical order is:
applySensorSetting() -> startRawStream() -> startStream()
-> getRawStream() / getRawStreamDropCount()
-> stopStream() -> stopRawStream()
Functions
| Function | Purpose |
|---|---|
startStream() |
Start live streaming from an opened Delta series camera. |
stopStream() |
Stop live streaming for an opened camera. |
getRawPacket() |
Read one raw USB packet from the opened camera. |
setRawStreamCallback() |
Register a callback that receives continuous raw USB chunks. |
startRawStream() |
Enable buffering of raw chunks for polling. |
getRawStream() |
Read one buffered raw chunk for a camera stream. |
getRawStreamDropCount() |
Read the number of chunks discarded when the polling buffer was full. |
stopRawStream() |
Stop raw chunk buffering and release the polling buffers. |
setDataRateCallback() |
Register a callback that receives USB data rate updates in KB/s. |
setFrameRateCallback() |
Register a callback that receives generated frame rate updates in FPS. |
Function reference
Status startStream(DeviceHandle handle);
Starts live USB streaming for an opened Delta series camera.
Use when: After DELTA_Device has completed openDevice() and applySensorSetting(), and after DELTA_Processing has configured the frame generation option and required output settings.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
Returns
| Value | Meaning |
|---|---|
Status::Success |
Streaming started successfully. |
| Error status | Streaming could not be started. Pass the status to getStatusMessage() for details. |
Example
// DELTA_Device setup
std::int32_t deviceCount = 0; // Number of detected Delta series cameras.
delta::DeviceHandle device = nullptr; // Handle used to control the selected camera.
delta::scanDevices(&deviceCount); // Scan connected cameras.
delta::openDevice(0, &device); // Open the first camera from the scan result.
delta::applySensorSetting(device, "settings/Delta_10_2000FPS_Single.txt"); // Apply a camera setting file.
// DELTA_Processing setup
delta::setFrameGeneration(device, delta::frameEndBased(33)); // Configure how frames are generated.
std::uint32_t size = delta::getColorFrameBufferSize(device); // Get the required color frame buffer size.
std::vector<std::uint8_t> buffer(size); // Allocate caller-owned frame memory.
delta::ColorFrame frame{}; // Output structure filled by getColorFrame().
frame.startAddress = buffer.data(); // Point the output structure to the buffer.
frame.bufferSize = size; // Tell the SDK how many bytes are available.
delta::Status status = delta::startStream(device); // Start live streaming after setup is complete.
if (status != delta::Status::Success) {
std::cout << delta::getStatusMessage(status) << std::endl;
return;
}
delta::getColorFrame(device, &frame, 0); // Read one generated frame after streaming starts.
Status stopStream(DeviceHandle handle);
Stops the SDK from retrieving data over USB from an opened Delta series camera. This stops USB data acquisition in the SDK; it does not mean that the sensor itself stops generating data.
Use when: After live USB acquisition is finished, before closing the device.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
Returns
| Value | Meaning |
|---|---|
Status::Success |
Streaming stopped successfully. |
| Error status | Streaming could not be stopped. Pass the status to getStatusMessage() for details. |
Example
delta::Status status = delta::stopStream(device);
if (status != delta::Status::Success) {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Status getRawPacket(DeviceHandle handle,
std::uint8_t* buffer,
std::uint32_t bufferSize,
std::uint32_t* readSize);
Performs one self-contained raw USB read from an opened Delta series camera. The function starts the sensor, reads raw data, and then stops the sensor internally.
Apply the sensor settings before reading, but do not call startStream() for this operation. If live streaming is already active, call stopStream() and check that it succeeded before calling getRawPacket(). Calling this function while streaming is active returns Status::Error_SystemRunning.
openDevice() -> applySensorSetting() -> getRawPacket() -> closeDevice()
For continuous raw data during startStream(), use setRawStreamCallback() or startRawStream() with getRawStream(). Repeated getRawPacket() calls start and stop the sensor for each read and do not provide an uninterrupted stream.
Use when: To inspect raw data with a single read while live streaming is stopped.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
buffer |
std::uint8_t* |
Output | Buffer that receives raw USB packet data. |
bufferSize |
std::uint32_t |
Input | Size of buffer in bytes. |
readSize |
std::uint32_t* |
Output | Number of bytes read into buffer. |
Returns
| Value | Meaning |
|---|---|
Status::Success |
Raw packet data was read successfully. |
Status::Error_SystemRunning |
Live streaming is active. Stop it before requesting a single raw read. |
Status::Error_InvalidArgument |
The device handle, buffer pointer, or read-size pointer is invalid, or bufferSize is zero. |
| Error status | The raw packet could not be read. Pass the status to getStatusMessage() for details. |
Example
// The device is open and sensor settings have been applied.
// Live streaming is stopped; do not call startStream() for this read.
std::vector<std::uint8_t> buffer(4096);
std::uint32_t readSize = 0;
delta::Status status = delta::getRawPacket(
device,
buffer.data(),
static_cast<std::uint32_t>(buffer.size()),
&readSize
);
if (status == delta::Status::Success) {
// Only the first readSize bytes contain the returned raw data.
std::cout << "Raw bytes read: " << readSize << std::endl;
} else {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Status setRawStreamCallback(DeviceHandle handle,
RawStreamCallback callback,
void* userData);
Registers a callback that receives raw USB chunks while the device is streaming. The SDK invokes the callback from its read thread with the following signature:
void callback(void* userData, std::int32_t cameraIndex,
const std::uint8_t* data, std::uint32_t size);
cameraIndex identifies the camera stream, data points to the raw bytes, and size is the byte count. The data pointer is valid only during the callback. Copy any bytes that must be used later and return promptly; avoid blocking work or blocking SDK calls in this callback.
Register the callback before startStream(). Keep userData alive until streaming has stopped and the callback has been unregistered. Passing nullptr as callback unregisters it. Polling through getRawStream() is independent of this callback.
Use when: To receive raw chunks directly from the acquisition thread without polling.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
callback |
RawStreamCallback |
Input | Function receiving userData, cameraIndex, data, and size; pass nullptr to unregister. |
userData |
void* |
Input | User-defined pointer passed back to the callback. |
Returns
| Value | Meaning |
|---|---|
Status::Success |
The callback setting was updated successfully. |
Status::Error_InvalidArgument |
The device handle is invalid. |
| Error status | Callback registration failed. Pass the status to getStatusMessage() for details. |
Example
This example uses <atomic> to count received bytes safely across threads. Keep receivedBytes alive throughout streaming; after stopStream(), unregister with setRawStreamCallback(device, nullptr, nullptr) before releasing it.
void RawStream_Cb(void* userData, std::int32_t cameraIndex,
const std::uint8_t* data, std::uint32_t size) {
auto* totalBytes = static_cast<std::atomic<std::uint64_t>*>(userData);
totalBytes->fetch_add(size, std::memory_order_relaxed);
}
std::atomic<std::uint64_t> receivedBytes{0};
delta::Status status = delta::setRawStreamCallback(
device,
RawStream_Cb,
&receivedBytes
);
if (status != delta::Status::Success) {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Status startRawStream(DeviceHandle handle, std::uint32_t chunkCount);
Enables SDK buffering of raw USB chunks so they can be retrieved with getRawStream(). Each camera stream has a buffer with capacity for chunkCount chunks. Passing 0 selects the default capacity of 64 chunks. This is separate from the internal acquisition buffers configured by setRawBufferCount().
This function enables buffering; call startStream() to start acquisition. It may be called before or after startStream(). When a polling buffer is full, the oldest chunk is discarded to make room for new data and that camera stream's drop count increases. A successful start resets the buffers and drop counts.
Use when: To consume continuous raw data from an application polling loop.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
chunkCount |
std::uint32_t |
Input | Buffer capacity in chunks per camera stream. Use 0 for the default of 64. |
Returns
| Value | Meaning |
|---|---|
Status::Success |
Raw chunk buffering was enabled successfully. |
Status::Error_AlreadyDone |
Raw chunk buffering is already active. |
Status::Error_InvalidArgument |
The device handle is invalid. |
| Error status | Raw stream registration failed. Pass the status to getStatusMessage() for details. |
Example
// The device is open and sensor settings have been applied.
delta::Status status = delta::startRawStream(device, 0);
if (status == delta::Status::Success) {
status = delta::startStream(device);
if (status != delta::Status::Success) {
delta::stopRawStream(device);
}
}
if (status != delta::Status::Success) {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Status getRawStream(DeviceHandle handle,
std::uint8_t* buffer,
std::uint32_t bufferSize,
std::uint32_t* readSize,
std::int32_t cameraIndex);
Copies one buffered raw chunk into the caller's buffer and removes that chunk from the polling queue. Call startRawStream() to enable buffering and startStream() to supply data. The call does not wait for a new chunk: an empty queue returns Status::Error_NoData.
If the buffer is too small, the function returns Status::Error_BufferTooSmall and writes the required byte count to readSize. The chunk is not consumed by that call. Resize the buffer and retry; incoming data can still discard old chunks if the queue fills up.
Use when: To retrieve raw chunks during live streaming for application-side processing.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
buffer |
std::uint8_t* |
Output | Caller-owned buffer receiving the raw bytes. |
bufferSize |
std::uint32_t |
Input | Allocated buffer size in bytes; must be greater than zero. |
readSize |
std::uint32_t* |
Output | Bytes copied on success, or required bytes when the buffer is too small. |
cameraIndex |
std::int32_t |
Input | Camera stream index: 0 for single-camera devices; 0 or 1 for stereo streams. This is not a device scan index. |
Returns
| Value | Meaning |
|---|---|
Status::Success |
One raw chunk was copied successfully. |
Status::Error_NotStarted |
Raw chunk buffering has not been enabled with startRawStream(). |
Status::Error_NoData |
No chunk is currently queued for the selected camera stream. |
Status::Error_BufferTooSmall |
The next chunk does not fit; readSize contains the required byte count. |
Status::Error_InvalidArgument |
The handle, buffer pointer, read-size pointer, buffer size, or camera index is invalid. |
Example
// Raw buffering and live streaming are already active.
std::vector<std::uint8_t> buffer(64 * 1024);
std::uint32_t readSize = 0;
const std::int32_t cameraIndex = 0;
delta::Status status = delta::getRawStream(
device, buffer.data(), static_cast<std::uint32_t>(buffer.size()),
&readSize, cameraIndex
);
if (status == delta::Status::Error_BufferTooSmall) {
buffer.resize(readSize);
status = delta::getRawStream(
device, buffer.data(), static_cast<std::uint32_t>(buffer.size()),
&readSize, cameraIndex
);
}
if (status == delta::Status::Success) {
// Process only the first readSize bytes in buffer.
std::cout << "Raw chunk bytes: " << readSize << std::endl;
} else if (status != delta::Status::Error_NoData) {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Status getRawStreamDropCount(DeviceHandle handle,
std::uint64_t* dropCount,
std::int32_t cameraIndex);
Gets the number of raw chunks discarded from the selected camera stream's polling buffer because it was full. The counter is cumulative since the last successful startRawStream() call; reading it does not reset it. Query it while buffering is active, before stopRawStream().
This counts polling-buffer overflow, not all possible USB or sensor data loss. It does not count losses in application work performed by a raw callback.
Use when: To check whether the application drains the raw polling buffer quickly enough.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
dropCount |
std::uint64_t* |
Output | Cumulative number of discarded raw chunks for the selected camera stream. |
cameraIndex |
std::int32_t |
Input | Camera stream index: 0 for single-camera devices; 0 or 1 for stereo streams. |
Returns
| Value | Meaning |
|---|---|
Status::Success |
The drop count was read successfully. |
Status::Error_NotStarted |
Raw chunk buffering is not active. |
Status::Error_InvalidArgument |
The handle, output pointer, or camera index is invalid. |
Example
std::uint64_t dropCount = 0;
delta::Status status = delta::getRawStreamDropCount(device, &dropCount, 0);
if (status == delta::Status::Success) {
std::cout << "Discarded raw chunks: " << dropCount << std::endl;
} else {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Status stopRawStream(DeviceHandle handle);
Disables raw polling and releases its buffers, discarding any queued chunks. This does not stop device streaming or unregister a callback installed with setRawStreamCallback(). Use stopStream() to stop acquisition and setRawStreamCallback(device, nullptr, nullptr) to unregister that callback.
Use when: When the application has finished consuming buffered raw chunks.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
Returns
| Value | Meaning |
|---|---|
Status::Success |
Raw chunk buffering was stopped and its buffers were released. |
Status::Error_AlreadyDone |
Raw chunk buffering is not active. |
Status::Error_InvalidArgument |
The device handle is invalid. |
Example
// Finish acquisition before releasing the polling buffers.
delta::Status status = delta::stopStream(device);
if (status == delta::Status::Success) {
status = delta::stopRawStream(device);
}
if (status != delta::Status::Success) {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Status setDataRateCallback(DeviceHandle handle,
DataRateCallback callback,
void* userData);
Registers a user-defined callback that receives live USB data rate updates in KB/s. Define a function with the DataRateCallback signature, then pass that function pointer to setDataRateCallback(). The application does not call the callback directly; the SDK calls it automatically from an internal thread.
void callback(void* userData, double kilobytesPerSecond);
Use when: To monitor USB throughput while live streaming is running.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
callback |
DataRateCallback |
Input | User-defined callback function pointer called with userData and kilobytesPerSecond. |
userData |
void* |
Input | User-defined pointer passed back to the callback. |
Returns
| Value | Meaning |
|---|---|
Status::Success |
Callback was registered successfully. |
| Error status | The callback could not be registered. Pass the status to getStatusMessage() for details. |
Example
void DataRate_Cb(void* userData, double kilobytesPerSecond) {
std::cout << "USB data rate: " << kilobytesPerSecond << " KB/s" << std::endl;
}
delta::Status status = delta::setDataRateCallback(device, DataRate_Cb, nullptr);
if (status != delta::Status::Success) {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Status setFrameRateCallback(DeviceHandle handle,
FrameRateCallback callback,
void* userData);
Registers a user-defined callback that receives generated frame rate updates in FPS. Define a function with the FrameRateCallback signature, then pass that function pointer to setFrameRateCallback(). The application does not call the callback directly; the SDK calls it automatically from an internal thread.
void callback(void* userData, std::int32_t framesPerSecond);
Use when: To monitor generated frame throughput while processing live stream data.
Parameters
| Name | Type | Direction | Description |
|---|---|---|---|
handle |
DeviceHandle |
Input | Device handle returned by openDevice(). |
callback |
FrameRateCallback |
Input | User-defined callback function pointer called with userData and framesPerSecond. |
userData |
void* |
Input | User-defined pointer passed back to the callback. |
Returns
| Value | Meaning |
|---|---|
Status::Success |
Callback was registered successfully. |
| Error status | The callback could not be registered. Pass the status to getStatusMessage() for details. |
Example
void FrameRate_Cb(void* userData, std::int32_t framesPerSecond) {
std::cout << "Frame rate: " << framesPerSecond << " FPS" << std::endl;
}
delta::Status status = delta::setFrameRateCallback(device, FrameRate_Cb, nullptr);
if (status != delta::Status::Success) {
std::cout << delta::getStatusMessage(status) << std::endl;
}
Callbacks are invoked from an internal SDK thread. Keep callback implementations thread-safe and avoid blocking SDK calls inside callbacks.