Skip to content

Commit 9b7e04f

Browse files
committed
update getDevices() to return errorCode properly & keep CI setting
1 parent 8b48df9 commit 9b7e04f

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

obs-studio-server/source/nodeobs_settings.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "osn-error.hpp"
2121
#include "nodeobs_api.h"
2222
#include "shared.hpp"
23+
#include <sstream>
2324
#include "memory-manager.h"
2425
#include "osn-video.hpp"
2526
#include "osn-encoders.hpp"
@@ -3869,22 +3870,22 @@ void getDevices(const char *source_id, const char *property_name, std::vector<ip
38693870
{
38703871
auto props = obs_get_source_properties(source_id);
38713872
if (!props) {
3872-
blog(LOG_WARNING, "Could not get source properties for source id: %s", source_id);
3873-
return;
3873+
std::ostringstream ss;
3874+
ss << "Could not get source properties for source id: " << source_id;
3875+
PRETTY_ERROR_RETURN(ErrorCode::Error, ss.str());
38743876
}
38753877

38763878
auto prop = obs_properties_get(props, property_name);
38773879
if (!prop) {
3878-
blog(LOG_WARNING, "Could not get the property [%s] for source id: %s", property_name, source_id);
38793880
obs_properties_destroy(props);
3880-
return;
3881+
std::ostringstream ss;
3882+
ss << "Could not get source property " << property_name << " for source id: " << source_id;
3883+
PRETTY_ERROR_RETURN(ErrorCode::Error, ss.str());
38813884
}
38823885

3886+
rval.push_back(ipc::value((uint64_t)ErrorCode::Ok));
38833887
size_t items = obs_property_list_item_count(prop);
3884-
if (rval.size() > 1)
3885-
rval[1].value_union.ui64 += items;
3886-
else
3887-
rval.push_back(ipc::value((uint64_t)items));
3888+
rval.push_back(ipc::value((uint64_t)items));
38883889

38893890
for (size_t idx = 0; idx < items; idx++) {
38903891
const char *description = obs_property_list_item_name(prop, idx);
@@ -4036,9 +4037,8 @@ void enumAudioDevices(std::vector<ipc::value> &rval, EDataFlow dataFlow)
40364037

40374038
void OBS_settings::OBS_settings_getInputAudioDevices(void *data, const int64_t id, const std::vector<ipc::value> &args, std::vector<ipc::value> &rval)
40384039
{
4039-
rval.push_back(ipc::value((uint64_t)ErrorCode::Ok));
4040-
40414040
#ifdef WIN32
4041+
rval.push_back(ipc::value((uint64_t)ErrorCode::Ok));
40424042
rval.push_back(ipc::value((uint32_t)1));
40434043
rval.push_back(ipc::value("Default"));
40444044
rval.push_back(ipc::value("default"));
@@ -4053,9 +4053,8 @@ void OBS_settings::OBS_settings_getInputAudioDevices(void *data, const int64_t i
40534053

40544054
void OBS_settings::OBS_settings_getOutputAudioDevices(void *data, const int64_t id, const std::vector<ipc::value> &args, std::vector<ipc::value> &rval)
40554055
{
4056-
rval.push_back(ipc::value((uint64_t)ErrorCode::Ok));
4057-
40584056
#ifdef WIN32
4057+
rval.push_back(ipc::value((uint64_t)ErrorCode::Ok));
40594058
rval.push_back(ipc::value((uint32_t)1));
40604059
rval.push_back(ipc::value("Default"));
40614060
rval.push_back(ipc::value("default"));

tests/osn-tests/src/test_osn_audio.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ describe(testName, () => {
7070
foundDefaultDevice = true;
7171
}
7272
}
73-
if (!obs.isDarwin()) { // On virtual mac(s) the default output device is not included in the list of output devices
73+
// On the CI, mac-coreaudio will not return a default device unless there is another output audio device.
74+
if (devices.length > 1) {
7475
expect(foundDefaultDevice).to.equal(true, GetErrorMessage(ETestErrorMsg.DefaultDeviceNotFound));
7576
}
7677
});

tests/osn-tests/util/obs_handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ export class OBSHandler {
554554
isDarwin()
555555
{
556556
// Wrapped this in a function- just in case we want to add more conditions later or disable only within the build agent.
557-
return this.os === 'darwin' && this.ci;
557+
return this.os === 'darwin';
558558
}
559559

560560
// is the build server environment

0 commit comments

Comments
 (0)