From b3b2ae267a2951399ed2edaeb68963b7ccab02e3 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 15 Feb 2020 07:39:01 -0800 Subject: [PATCH 1/8] Update WSRequestHandler_Streaming.cpp --- src/WSRequestHandler_Streaming.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index 4ee77d8b..67655021 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -212,7 +212,7 @@ RpcResponse WSRequestHandler::SetStreamSettings(const RpcRequest& request) { if (requestedType != nullptr && requestedType != serviceType) { OBSDataAutoRelease hotkeys = obs_hotkeys_save_service(service); service = obs_service_create( - requestedType.toUtf8(), STREAM_SERVICE_ID, requestSettings, hotkeys); + STREAM_SERVICE_ID, requestedType.toUtf8(), requestSettings, hotkeys); } else { // If type isn't changing, we should overlay the settings we got // to the existing settings. By doing so, you can send a request that From 30db1a8a63d5a166f1a405122dc58eaf5ccc1590 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 15 Feb 2020 08:50:09 -0800 Subject: [PATCH 2/8] Update WSRequestHandler_Streaming.cpp --- src/WSRequestHandler_Streaming.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index 67655021..7471bb1a 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -137,13 +137,13 @@ RpcResponse WSRequestHandler::StartStreaming(const RpcRequest& request) { obs_data_apply(updatedSettings, newSettings); //then apply the settings from the request should they exist newService = obs_service_create( - newType.toUtf8(), STREAM_SERVICE_ID, + STREAM_SERVICE_ID, newType.toUtf8(), updatedSettings, csHotkeys); } else { // Service type changed: override service settings newService = obs_service_create( - newType.toUtf8(), STREAM_SERVICE_ID, + STREAM_SERVICE_ID, newType.toUtf8(), newSettings, csHotkeys); } From 9c11bbc7a16f8f7e245135648c897692785cd55f Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 15 Feb 2020 10:58:10 -0800 Subject: [PATCH 3/8] Update WSRequestHandler_Streaming.cpp --- src/WSRequestHandler_Streaming.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index 7471bb1a..f1c631f7 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -213,6 +213,7 @@ RpcResponse WSRequestHandler::SetStreamSettings(const RpcRequest& request) { OBSDataAutoRelease hotkeys = obs_hotkeys_save_service(service); service = obs_service_create( STREAM_SERVICE_ID, requestedType.toUtf8(), requestSettings, hotkeys); + obs_frontend_set_streaming_service(service); } else { // If type isn't changing, we should overlay the settings we got // to the existing settings. By doing so, you can send a request that From 79a7b444a2029947e861c74d6a97cfb986c07a6d Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 15 Feb 2020 11:00:24 -0800 Subject: [PATCH 4/8] Update WSRequestHandler_Streaming.cpp --- src/WSRequestHandler_Streaming.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index f1c631f7..c6ac2952 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -212,7 +212,7 @@ RpcResponse WSRequestHandler::SetStreamSettings(const RpcRequest& request) { if (requestedType != nullptr && requestedType != serviceType) { OBSDataAutoRelease hotkeys = obs_hotkeys_save_service(service); service = obs_service_create( - STREAM_SERVICE_ID, requestedType.toUtf8(), requestSettings, hotkeys); + requestedType.toUtf8(), STREAM_SERVICE_ID, requestSettings, hotkeys); obs_frontend_set_streaming_service(service); } else { // If type isn't changing, we should overlay the settings we got From c02f40beb60e3be5134a4635c09d505aa0210471 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 15 Feb 2020 14:18:25 -0800 Subject: [PATCH 5/8] Update WSRequestHandler_Streaming.cpp --- src/WSRequestHandler_Streaming.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index c6ac2952..fc60a4d3 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -137,13 +137,13 @@ RpcResponse WSRequestHandler::StartStreaming(const RpcRequest& request) { obs_data_apply(updatedSettings, newSettings); //then apply the settings from the request should they exist newService = obs_service_create( - STREAM_SERVICE_ID, newType.toUtf8(), + newType.toUtf8(), STREAM_SERVICE_ID, updatedSettings, csHotkeys); } else { // Service type changed: override service settings newService = obs_service_create( - STREAM_SERVICE_ID, newType.toUtf8(), + newType.toUtf8(), STREAM_SERVICE_ID, newSettings, csHotkeys); } From 2845fd07a7f3aafbe703bfc6f1ddbc2891662aa2 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 15 Feb 2020 14:22:35 -0800 Subject: [PATCH 6/8] Final fixes before testing --- src/WSRequestHandler_Streaming.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index fc60a4d3..4746e4c2 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -236,7 +236,9 @@ RpcResponse WSRequestHandler::SetStreamSettings(const RpcRequest& request) { obs_frontend_save_streaming_service(); } - OBSDataAutoRelease serviceSettings = obs_service_get_settings(service); + OBSService responseService = obs_frontend_get_streaming_service(); + OBSDataAutoRelease serviceSettings = obs_service_get_settings(responseService); + const char* responseType = obs_service_get_type(responseService); OBSDataAutoRelease response = obs_data_create(); obs_data_set_string(response, "type", requestedType.toUtf8()); From 22fbb4262ccc41eda3eccbca95f5d9b27ca6ef1a Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 15 Feb 2020 14:47:46 -0800 Subject: [PATCH 7/8] Return check type instead of type provided in request --- src/WSRequestHandler_Streaming.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index 4746e4c2..99bd419c 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -241,7 +241,7 @@ RpcResponse WSRequestHandler::SetStreamSettings(const RpcRequest& request) { const char* responseType = obs_service_get_type(responseService); OBSDataAutoRelease response = obs_data_create(); - obs_data_set_string(response, "type", requestedType.toUtf8()); + obs_data_set_string(response, "type", responseType.toUtf8()); obs_data_set_obj(response, "settings", serviceSettings); return request.success(response); From ca938828704e639f759f2489ffcd6b88f2da913c Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 15 Feb 2020 14:51:59 -0800 Subject: [PATCH 8/8] Remove unnecessary utf8 string conversion --- src/WSRequestHandler_Streaming.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index 99bd419c..5c4bb227 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -241,7 +241,7 @@ RpcResponse WSRequestHandler::SetStreamSettings(const RpcRequest& request) { const char* responseType = obs_service_get_type(responseService); OBSDataAutoRelease response = obs_data_create(); - obs_data_set_string(response, "type", responseType.toUtf8()); + obs_data_set_string(response, "type", responseType); obs_data_set_obj(response, "settings", serviceSettings); return request.success(response);