Skip to content

Commit 6ffa9fd

Browse files
committed
Revert "osn-replay-buffer: invoke output handler to save replays (#1689)"
This reverts commit e0d4c05. This implementation overwrites the file (release blocker)
1 parent 050bdde commit 6ffa9fd

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,23 +152,19 @@ 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-
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-
}
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);
159167

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-
bool hasInvoked = proc_handler_call(ph, "save", &cd);
168-
calldata_free(&cd);
169-
170-
if (!hasInvoked)
171-
PRETTY_ERROR_RETURN(ErrorCode::NotFound, "Could not find ReplayBuffer::Save");
172168
rval.push_back(ipc::value((uint64_t)ErrorCode::Ok));
173169
AUTO_DEBUG;
174-
}
170+
}

tests/osn-tests/src/test_osn_advanced_replayBuffer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ describe(testName, () => {
131131
});
132132

133133
it('Start advanced replay buffer - Use Recording', async function() {
134+
if (obs.isDarwin()) {
135+
this.skip();
136+
}
134137
replayBuffer = osn.AdvancedReplayBufferFactory.create();
135138
replayBuffer.path = path.join(path.normalize(__dirname), '..', 'osnData');
136139
replayBuffer.format = osn.ERecordingFormat.MP4;
@@ -258,6 +261,9 @@ describe(testName, () => {
258261
});
259262

260263
it('Start advanced replay buffer - Use Stream through Recording', async function() {
264+
if (obs.isDarwin()) {
265+
this.skip();
266+
}
261267
replayBuffer = osn.AdvancedReplayBufferFactory.create();
262268
replayBuffer.path = path.join(path.normalize(__dirname), '..', 'osnData');
263269
replayBuffer.format = osn.ERecordingFormat.MP4;

0 commit comments

Comments
 (0)