Skip to content

Commit 87d44e4

Browse files
committed
update Replaybuffer::Save to pass test on slower CI environments
* do not fail silently * use approach similar to IFileOutput::GetFileFormat to lookup ReplayBuffer * fix osn-simple-replay-buffer: [TEST CASE] Start simple replay buffer - Use Stream through Recording
1 parent 99c4d2a commit 87d44e4

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

obs-studio-server/source/osn-replay-buffer.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,20 @@ void osn::IReplayBuffer::Query(void *data, const int64_t id, const std::vector<i
152152

153153
void osn::IReplayBuffer::Save(void *data, const int64_t id, const std::vector<ipc::value> &args, std::vector<ipc::value> &rval)
154154
{
155-
obs_enum_hotkeys(
156-
[](void *data, obs_hotkey_id id, obs_hotkey_t *key) {
157-
if (obs_hotkey_get_registerer_type(key) == OBS_HOTKEY_REGISTERER_OUTPUT) {
158-
std::string key_name = obs_hotkey_get_name(key);
159-
if (key_name.compare("ReplayBuffer.Save") == 0) {
160-
obs_hotkey_enable_callback_rerouting(true);
161-
obs_hotkey_trigger_routed_callback(id, true);
162-
}
163-
}
164-
return true;
165-
},
166-
nullptr);
155+
ReplayBuffer *replayBuffer = static_cast<ReplayBuffer *>(osn::IFileOutput::Manager::GetInstance().find(args[0].value_union.ui64));
156+
if (!replayBuffer) {
157+
PRETTY_ERROR_RETURN(ErrorCode::InvalidReference, "ReplayBuffer reference is not valid.");
158+
}
159+
160+
obs_output_t *output = replayBuffer->GetOutput();
161+
if (!output) {
162+
PRETTY_ERROR_RETURN(ErrorCode::InvalidReference, "Invalid replay buffer output.");
163+
}
164+
165+
calldata_t cd = {0};
166+
proc_handler_t *ph = obs_output_get_proc_handler(output);
167+
proc_handler_call(ph, "save", &cd);
168+
calldata_free(&cd);
167169

168170
rval.push_back(ipc::value((uint64_t)ErrorCode::Ok));
169171
AUTO_DEBUG;

0 commit comments

Comments
 (0)