Improve capture startup, frame loss reporting, and preview diagnostics
- defer DMA capture until the first frame reader is waiting - deliver FIFO frames in sequence order and overwrite the oldest unread frame when the three-slot FIFO is full - report known frame loss through GVFG_EVENT_FRAME_LOSS and runtime statistics - replace the enum-only event API with the extensible gvfg_event_t structure - expose per-handle public error details - add preview GPU resource preparation before capture starts - move GPU preview timing from periodic logs to the status display - remove the redundant stream descriptor channel field - reorganize customer and internal documentation - add a complete customer API reference
This commit is contained in:
@@ -93,6 +93,13 @@ GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_attach_window(
|
||||
gvfg_preview_handle handle,
|
||||
void *native_window_handle);
|
||||
|
||||
/* Pre-create GPU resources before the first captured frame is held. */
|
||||
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_prepare(
|
||||
gvfg_preview_handle handle,
|
||||
int width,
|
||||
int height,
|
||||
int bit_depth);
|
||||
|
||||
/*
|
||||
* Synchronously render one frame.
|
||||
*
|
||||
|
||||
@@ -27,13 +27,26 @@ public:
|
||||
resetPresentStats();
|
||||
hwnd_ = hwnd;
|
||||
configured_ = hwnd_ != nullptr;
|
||||
if (pipeline_)
|
||||
if (configured_ && ensureDevice())
|
||||
{
|
||||
if (!pipeline_)
|
||||
pipeline_ = std::make_unique<gvfg::internal::D3DPreviewPipeline>();
|
||||
pipeline_->initialize(d3d_->device.Get(), d3d_->context.Get());
|
||||
gvfg::internal::gvfg_render_preview_desc_t desc{};
|
||||
desc.hwnd = hwnd_;
|
||||
desc.enable_preview = configured_ ? 1 : 0;
|
||||
desc.swapchain_10bit = gvfg::internal::GVFG_RENDER_PREVIEW_BITDEPTH_AUTO;
|
||||
pipeline_->configurePreview(desc);
|
||||
if (!pipeline_->create_shaders_and_states())
|
||||
return false;
|
||||
}
|
||||
else if (pipeline_)
|
||||
{
|
||||
gvfg::internal::gvfg_render_preview_desc_t desc{};
|
||||
desc.hwnd = hwnd_;
|
||||
desc.enable_preview = 0;
|
||||
desc.swapchain_10bit = gvfg::internal::GVFG_RENDER_PREVIEW_BITDEPTH_AUTO;
|
||||
pipeline_->configurePreview(desc);
|
||||
}
|
||||
return configured_;
|
||||
}
|
||||
@@ -124,6 +137,15 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool prepare(int width, int height, int sourceBitDepth)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if (!configured_ || !hwnd_ || width <= 0 || height <= 0)
|
||||
return false;
|
||||
return ensureDevice() &&
|
||||
ensurePipeline(width, height, sourceBitDepth > 0 ? sourceBitDepth : 8);
|
||||
}
|
||||
|
||||
void shutdown()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
@@ -424,6 +446,18 @@ extern "C"
|
||||
return handle->renderer.configure(native_window_handle) ? GVFG_PREVIEW_OK : GVFG_PREVIEW_ESTATE;
|
||||
}
|
||||
|
||||
gvfg_preview_status_t gvfg_preview_prepare(gvfg_preview_handle handle,
|
||||
int width,
|
||||
int height,
|
||||
int bit_depth)
|
||||
{
|
||||
if (!handle || width <= 0 || height <= 0)
|
||||
return GVFG_PREVIEW_EINVAL;
|
||||
return handle->renderer.prepare(width, height, bit_depth)
|
||||
? GVFG_PREVIEW_OK
|
||||
: GVFG_PREVIEW_ERENDER;
|
||||
}
|
||||
|
||||
gvfg_preview_status_t gvfg_preview_render_frame(gvfg_preview_handle handle,
|
||||
const gvfg_preview_frame_t *frame)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user