Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/generated/protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,11 @@
"valueType": "Number",
"valueDescription": "Total number of frames outputted by the output thread"
},
{
"valueName": "gpuAcceleration",
"valueType": "Object",
"valueDescription": "GPU acceleration status (`state` green/yellow/red, `adapter`, `detectedGpus`, `summary`, `causes`), or null when the frontend does not report it"
},
{
"valueName": "webSocketSessionIncomingMessages",
"valueType": "Number",
Expand Down
1 change: 1 addition & 0 deletions docs/generated/protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -2870,6 +2870,7 @@ Gets statistics about OBS, obs-websocket, and the current session.
| renderTotalFrames | Number | Total number of frames outputted by the render thread |
| outputSkippedFrames | Number | Number of frames skipped by OBS in the output thread |
| outputTotalFrames | Number | Total number of frames outputted by the output thread |
| gpuAcceleration | Object | GPU acceleration status (`state` green/yellow/red, `adapter`, `detectedGpus`, `summary`, `causes`), or null when the frontend does not report it |
| webSocketSessionIncomingMessages | Number | Total number of messages received by obs-websocket from the client |
| webSocketSessionOutgoingMessages | Number | Total number of messages sent by obs-websocket to the client |

Expand Down
1 change: 1 addition & 0 deletions src/requesthandler/RequestHandler_General.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ RequestResult RequestHandler::GetVersion(const Request &)
* @responseField renderTotalFrames | Number | Total number of frames outputted by the render thread
* @responseField outputSkippedFrames | Number | Number of frames skipped by OBS in the output thread
* @responseField outputTotalFrames | Number | Total number of frames outputted by the output thread
* @responseField gpuAcceleration | Object | GPU acceleration status (`state` green/yellow/red, `adapter`, `detectedGpus`, `summary`, `causes`), or null when the frontend does not report it
* @responseField webSocketSessionIncomingMessages | Number | Total number of messages received by obs-websocket from the client
* @responseField webSocketSessionOutgoingMessages | Number | Total number of messages sent by obs-websocket to the client
*
Expand Down
14 changes: 14 additions & 0 deletions src/utils/Obs_ObjectHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ json Utils::Obs::ObjectHelper::GetStats()
ret["outputSkippedFrames"] = outputSkippedFrames;
ret["outputTotalFrames"] = outputTotalFrames;

/* GPU acceleration status from the frontend (obs-rust/obs-studio#846):
* null when the frontend does not provide it. */
ret["gpuAcceleration"] = nullptr;
calldata_t cd = {0};
if (proc_handler_call(obs_get_proc_handler(), "get_gpu_status", &cd)) {
const char *status = calldata_string(&cd, "json");
if (status) {
json parsed = json::parse(status, nullptr, false);
if (!parsed.is_discarded())
ret["gpuAcceleration"] = parsed;
}
}
calldata_free(&cd);

return ret;
}

Expand Down
Loading