Refine backend status handling
Compared with 5ee2ee1:
- update the bundled GigabyteLib interface and binary, reset backend events across stream transitions, and wait for requested video format changes before reporting refreshed signal state
- translate private GigabyteLib results into stable public GVFG errors, including GVFG_EBUSY, while keeping vendor API names, enum values, and raw codes in internal diagnostics
- keep customer-facing error strings and detailed faults backend-neutral, and show the original library failure only in the Debug internal Sample
- update the public and internal error-handling documentation to match the new ownership boundary
Validation: git diff --check passed. The SDK MSVC Release build and Qt Sample MSVC Release and Debug builds completed successfully. Hardware behavior was not tested.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -75,7 +75,7 @@ namespace gvfg::internal
|
||||
gvfg_status_t wait_for_recovery(uint32_t timeoutMs);
|
||||
gvfg_status_t refresh_video_info();
|
||||
gvfg_status_t refresh_audio_info();
|
||||
static gvfg_status_t from_vendor(GVFG_HRESULT result);
|
||||
gvfg_status_t from_vendor(GVFG_HRESULT result, const char *apiName);
|
||||
gvfg_status_t reject(gvfg_status_t status, const char *message) const;
|
||||
void record_get_frame_timing(double elapsedUs);
|
||||
|
||||
@@ -89,6 +89,8 @@ namespace gvfg::internal
|
||||
bool events_created_ = false;
|
||||
bool channel_open_ = false;
|
||||
bool video_info_valid_ = false;
|
||||
bool format_change_pending_ = false;
|
||||
gvfg_pixel_format_t requested_video_format_ = GVFG_PIXFMT_UNKNOWN;
|
||||
bool audio_info_valid_ = false;
|
||||
gvfg_signal_status_t cached_signal_{};
|
||||
GVFG_VIDEO_INFO video_info_{};
|
||||
|
||||
@@ -1263,22 +1263,10 @@ extern "C"
|
||||
return "Not supported";
|
||||
case GVFG_ETIMEOUT:
|
||||
return "Timeout";
|
||||
case GVFG_HRESULT_ERROR:
|
||||
return "GVFG_HRESULT_ERROR";
|
||||
case GVFG_HRESULT_DEV_ERROR:
|
||||
return "GVFG_HRESULT_DEV_ERROR";
|
||||
case GVFG_HRESULT_DEV_BUSY:
|
||||
return "GVFG_HRESULT_DEV_BUSY";
|
||||
case GVFG_HRESULT_VIDEO_CHN_ERROR:
|
||||
return "GVFG_HRESULT_VIDEO_CHN_ERROR";
|
||||
case GVFG_HRESULT_CONTEXT_ERROR:
|
||||
return "GVFG_HRESULT_CONTEXT_ERROR";
|
||||
case GVFG_HRESULT_VIDEO_CHN_INVALID:
|
||||
return "GVFG_HRESULT_VIDEO_CHN_INVALID";
|
||||
case GVFG_HRESULT_API_ERROR:
|
||||
return "GVFG_HRESULT_API_ERROR";
|
||||
case GVFG_EBUSY:
|
||||
return "Device busy";
|
||||
default:
|
||||
return status > 0 ? "GVFG_HRESULT_UNKNOWN" : "Unknown";
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -9,16 +10,34 @@ namespace gvfg::internal
|
||||
class ChannelErrorState final
|
||||
{
|
||||
public:
|
||||
struct VendorDetail
|
||||
{
|
||||
int32_t code = 0;
|
||||
std::string api;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
void set(std::string message)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
message_ = std::move(message);
|
||||
vendor_detail_ = {};
|
||||
}
|
||||
|
||||
void set_vendor(std::string message, int32_t code, std::string api, std::string name)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
message_ = std::move(message);
|
||||
vendor_detail_.code = code;
|
||||
vendor_detail_.api = std::move(api);
|
||||
vendor_detail_.name = std::move(name);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
message_.clear();
|
||||
vendor_detail_ = {};
|
||||
}
|
||||
|
||||
std::string message() const
|
||||
@@ -27,8 +46,15 @@ namespace gvfg::internal
|
||||
return message_;
|
||||
}
|
||||
|
||||
VendorDetail vendor_detail() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
return vendor_detail_;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable std::mutex mutex_;
|
||||
std::string message_;
|
||||
VendorDetail vendor_detail_;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user