Release SDK 0.2.1 with unplug-safe zero-copy handling

Compared with SDK 0.2.0 (3cd7fbbb):

- Handle the zero-copy release race where the driver clears frame ownership before the SDK receives the unplug event. Wait up to 100 ms only after ERROR_BAD_COMMAND, accept the release as revoked only after a confirmed disconnect, and preserve all other release failures.

- Apply the same confirmed-unplug handling to normal frame release and pending-frame teardown without adding latency to successful per-frame releases.

- Add Debug-only audio event, frame, and byte counters across the Driver-to-SDK, SDK-to-APP, and APP-to-output boundaries, and show the concise totals in the internal diagnostic sample.

- Rename Release and Debug customer packages to the requested GVFG_Sample labels, use minute-resolution timestamps, and derive the package suffix from the root CMake project version.

- Bump the standalone SDK version to 0.2.1 and synchronize the public API examples and internal build guide.

Validation: git diff --check and focused source/diff inspection passed. No build, package generation, runtime capture, unplug stress test, or hardware validation was run.
This commit is contained in:
Mark.lin
2026-09-10 11:36:17 +08:00
parent 3cd7fbbb3f
commit cdd2f8a75b
14 changed files with 111 additions and 19 deletions
+28
View File
@@ -612,6 +612,7 @@ void MainWindow::startCapture(int channelIndex)
channel.audioMaxReadGapMs = 0;
}
#if GVFG_INTERNAL_DIAGNOSTICS
channel.audioReceivedFrames = 0;
channel.haveDebugBaseline = false;
channel.lastDebugDmaErrors = 0;
#endif
@@ -828,6 +829,30 @@ void MainWindow::updateSignalStatus(bool queryHardware)
.arg(channel.audioFormat.sample_rate)
.arg(channel.audioFormat.channels)
.arg(channel.audioFormat.bits_per_sample);
#if GVFG_INTERNAL_DIAGNOSTICS
uint64_t sdkFrames = 0;
uint64_t sdkBytes = 0;
uint64_t appOutputBytes = 0;
{
std::lock_guard<std::mutex> lock(channel.audioQueueMutex);
sdkFrames = channel.audioReceivedFrames;
sdkBytes = channel.audioReceivedBytes;
appOutputBytes = channel.audioAcceptedBytes;
}
gvfg_debug_backend_stats_t audioStats{};
if (gvfg_debug_get_channel_backend_stats(handle_, channelIndex, &audioStats) == GVFG_OK)
{
statusLines << QStringLiteral("CH%1 Audio Debug | Events DMA=%2 Extra=%3 | Driver->SDK %4 frames/%5 bytes | SDK->APP %6 frames/%7 bytes | APP->Output %8 bytes")
.arg(channelIndex)
.arg(static_cast<qulonglong>(audioStats.audio_dma_event_wakes))
.arg(static_cast<qulonglong>(audioStats.extra_audio_event_wakes))
.arg(static_cast<qulonglong>(audioStats.audio_frames_from_driver))
.arg(static_cast<qulonglong>(audioStats.audio_bytes_from_driver))
.arg(static_cast<qulonglong>(sdkFrames))
.arg(static_cast<qulonglong>(sdkBytes))
.arg(static_cast<qulonglong>(appOutputBytes));
}
#endif
}
statusLines << QStringLiteral("CH%1 Preview | %2 FPS | %3")
.arg(channelIndex)
@@ -1430,6 +1455,9 @@ void MainWindow::audioReadLoop(int channelIndex)
}
channel.audioLastId = audioId;
channel.audioReceivedBytes += frame.data_size;
#if GVFG_INTERNAL_DIAGNOSTICS
++channel.audioReceivedFrames;
#endif
}
lastArrival = arrival;
std::vector<uint8_t> pcm(frame.data_size);
+1
View File
@@ -99,6 +99,7 @@ private:
bool haveCachedSignalStatus = false;
QString lastLoggedInputStatus;
#if GVFG_INTERNAL_DIAGNOSTICS
uint64_t audioReceivedFrames = 0;
uint64_t lastDebugDmaErrors = 0;
bool haveDebugBaseline = false;
#endif