Skip to content

Commit 9cccd77

Browse files
committed
Add WebRTC Simulcast Support
1 parent a01e2e9 commit 9cccd77

File tree

4 files changed

+55
-28
lines changed

4 files changed

+55
-28
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
CEF_BUILD_VERSION_WIN: '5060'
2020
QT_VERSION_MAC: '6.4.3'
2121
QT_VERSION_WIN: '6.4.3'
22-
DEPS_VERSION_WIN: '2023-06-22'
22+
DEPS_VERSION_WIN: '2023-06-28'
2323
VLC_VERSION_WIN: '3.0.0-git'
2424
TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENT_ID }}
2525
TWITCH_HASH: ${{ secrets.TWITCH_HASH }}

UI/window-basic-main-outputs.cpp

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ struct AdvancedOutput : BasicOutputHandler {
14561456
OBSEncoder streamAudioEnc;
14571457
OBSEncoder streamArchiveEnc;
14581458
OBSEncoder recordTrack[MAX_AUDIO_MIXES];
1459-
OBSEncoder videoStreaming;
1459+
OBSEncoder videoStreaming[3];
14601460
OBSEncoder videoRecording;
14611461

14621462
bool ffmpegOutput;
@@ -1619,13 +1619,25 @@ AdvancedOutput::AdvancedOutput(OBSBasic *main_) : BasicOutputHandler(main_)
16191619
}
16201620
}
16211621

1622-
videoStreaming = obs_video_encoder_create(streamEncoder,
1623-
"advanced_video_stream",
1624-
streamEncSettings, nullptr);
1625-
if (!videoStreaming)
1622+
videoStreaming[0] = obs_video_encoder_create(streamEncoder,
1623+
"advanced_video_stream_1",
1624+
streamEncSettings,
1625+
nullptr);
1626+
1627+
videoStreaming[1] = obs_video_encoder_create(streamEncoder,
1628+
"advanced_video_stream_2",
1629+
streamEncSettings,
1630+
nullptr);
1631+
1632+
videoStreaming[2] = obs_video_encoder_create(streamEncoder,
1633+
"advanced_video_stream_3",
1634+
streamEncSettings,
1635+
nullptr);
1636+
1637+
if (!videoStreaming[0])
16261638
throw "Failed to create streaming video encoder "
16271639
"(advanced output)";
1628-
obs_encoder_release(videoStreaming);
1640+
obs_encoder_release(videoStreaming[0]);
16291641

16301642
const char *rate_control = obs_data_get_string(
16311643
useStreamEncoder ? streamEncSettings : recordEncSettings,
@@ -1697,7 +1709,7 @@ void AdvancedOutput::UpdateStreamSettings()
16971709
config_get_string(main->Config(), "AdvOut", "Encoder");
16981710

16991711
OBSData settings = GetDataFromJsonFile("streamEncoder.json");
1700-
ApplyEncoderDefaults(settings, videoStreaming);
1712+
ApplyEncoderDefaults(settings, videoStreaming[0]);
17011713

17021714
if (applyServiceSettings) {
17031715
int bitrate = (int)obs_data_get_int(settings, "bitrate");
@@ -1726,11 +1738,11 @@ void AdvancedOutput::UpdateStreamSettings()
17261738
case VIDEO_FORMAT_P010:
17271739
break;
17281740
default:
1729-
obs_encoder_set_preferred_video_format(videoStreaming,
1741+
obs_encoder_set_preferred_video_format(videoStreaming[0],
17301742
VIDEO_FORMAT_NV12);
17311743
}
17321744

1733-
obs_encoder_update(videoStreaming, settings);
1745+
obs_encoder_update(videoStreaming[0], settings);
17341746
}
17351747

17361748
inline void AdvancedOutput::UpdateRecordingSettings()
@@ -1775,14 +1787,14 @@ inline void AdvancedOutput::SetupStreaming()
17751787
}
17761788

17771789
obs_output_set_audio_encoder(streamOutput, streamAudioEnc, 0);
1778-
obs_encoder_set_scaled_size(videoStreaming, cx, cy);
1790+
obs_encoder_set_scaled_size(videoStreaming[0], cx, cy);
17791791

17801792
const char *id = obs_service_get_id(main->GetService());
17811793
if (strcmp(id, "rtmp_custom") == 0) {
17821794
OBSDataAutoRelease settings = obs_data_create();
17831795
obs_service_apply_encoder_settings(main->GetService(), settings,
17841796
nullptr);
1785-
obs_encoder_update(videoStreaming, settings);
1797+
obs_encoder_update(videoStreaming[0], settings);
17861798
}
17871799
}
17881800

@@ -1821,10 +1833,18 @@ inline void AdvancedOutput::SetupRecording()
18211833
tracks = config_get_int(main->Config(), "AdvOut", "TrackIndex");
18221834

18231835
if (useStreamEncoder) {
1824-
obs_output_set_video_encoder(fileOutput, videoStreaming);
1836+
// Sean-Der
1837+
obs_encoder_set_scaled_size(videoStreaming[0], 640, 480);
1838+
obs_encoder_set_scaled_size(videoStreaming[1], 800, 600);
1839+
obs_encoder_set_scaled_size(videoStreaming[2], 1024, 768);
1840+
1841+
obs_output_set_video_encoder2(fileOutput, videoStreaming[0], 0);
1842+
obs_output_set_video_encoder2(fileOutput, videoStreaming[1], 1);
1843+
obs_output_set_video_encoder2(fileOutput, videoStreaming[2], 2);
1844+
18251845
if (replayBuffer)
18261846
obs_output_set_video_encoder(replayBuffer,
1827-
videoStreaming);
1847+
videoStreaming[0]);
18281848
} else {
18291849
if (rescale && rescaleRes && *rescaleRes) {
18301850
if (sscanf(rescaleRes, "%ux%u", &cx, &cy) != 2) {
@@ -2013,7 +2033,10 @@ inline void AdvancedOutput::UpdateAudioSettings()
20132033

20142034
void AdvancedOutput::SetupOutputs()
20152035
{
2016-
obs_encoder_set_video(videoStreaming, obs_get_video());
2036+
obs_encoder_set_video(videoStreaming[0], obs_get_video());
2037+
obs_encoder_set_video(videoStreaming[1], obs_get_video());
2038+
obs_encoder_set_video(videoStreaming[2], obs_get_video());
2039+
20172040
if (videoRecording)
20182041
obs_encoder_set_video(videoRecording, obs_get_video());
20192042
for (size_t i = 0; i < MAX_AUDIO_MIXES; i++)
@@ -2123,7 +2146,10 @@ bool AdvancedOutput::SetupStreaming(obs_service_t *service)
21232146
outputType = type;
21242147
}
21252148

2126-
obs_output_set_video_encoder(streamOutput, videoStreaming);
2149+
obs_output_set_video_encoder2(streamOutput, videoStreaming[0], 0);
2150+
obs_output_set_video_encoder2(streamOutput, videoStreaming[1], 1);
2151+
obs_output_set_video_encoder2(streamOutput, videoStreaming[2], 2);
2152+
21272153
obs_output_set_audio_encoder(streamOutput, streamAudioEnc, 0);
21282154

21292155
return true;

buildspec.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
22
"dependencies": {
33
"prebuilt": {
4-
"version": "2023-06-22",
5-
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
4+
"version": "2023-06-28",
5+
"baseUrl": "https://github.com/Sean-Der/obs-deps/releases/download",
66
"label": "Pre-Built obs-deps",
77
"hashes": {
8-
"macos-universal": "a0d2e03f0ea79681634c31627430a220d9b62113d6ff58174d0bdab6fafdd32b",
9-
"windows-x64": "1b12e86e2d62a97a889866d66b95fe47ddc6f7fa9b13e88aedfab4ea9e298ea2",
10-
"windows-x86": "8c6bfda01ec7d38a50a61ac4954dc00d6fcb171830a7f32593c5bd20a44be3a9",
11-
"linux-x86_64": "1b82ab4247bc2730ae84caa5a009e76637eac77b05bfb4b4a2bae610e7a75262"
8+
"macos-universal": "3118c8f99cd6a862ed1316b0098f03c5293957c28b1137bf4260723d0eb7acc5",
9+
"windows-x64": "58d73e33da1eaf2bf9855f630ff123c595cd759dc815bc7b29c50500a0fa26b0",
10+
"windows-x86": "bf22ccd72a5d1537ab056d5a986daca0e4a6d4444a5e32a18314220bdfcdae65",
11+
"linux-x86_64": "a1a4a42ee35010e492cf4431bfeb9c1df7b12692456bf12516158efa59dbae73"
1212
}
1313
},
1414
"qt6": {
15-
"version": "2023-06-22",
16-
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
15+
"version": "2023-06-28",
16+
"baseUrl": "https://github.com/Sean-Der/obs-deps/releases/download",
1717
"label": "Pre-Built Qt6",
1818
"hashes": {
19-
"macos-universal": "f890d258a1afa7ba409b79c8ee55d53155e5c72105b8b18a3f52047ee70fc0aa",
20-
"windows-x64": "1907fbcbcef69527154b29316c425b0885afb77ad69a9a2af7a1471d79512195"
19+
"macos-universal": "11f4da10dc98effce8012be31dd790ef508ba2780906946ed52eb835ed5530dd",
20+
"windows-x64": "96e5c91c1febf092bbb938c825425c13b513da6e1f006eff7e278402e51254d8"
2121
},
2222
"debugSymbols": {
23-
"windows-x64": "b461a7ade0c099505baea857fa5b98c4f8e9b702681be019ea354735d062e065"
23+
"windows-x64": "af1b4958ad8e005f9ae507d35f61dd72fc7b2278fc6958afb4118fbd4769a9e4"
2424
}
2525
},
2626
"cef": {

plugins/obs-webrtc/whip-output.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,8 @@ void register_whip_output()
448448
struct obs_output_info info = {};
449449

450450
info.id = "whip_output";
451-
info.flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_SERVICE;
451+
info.flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_SERVICE |
452+
OBS_OUTPUT_MULTI_TRACK_AV;
452453
info.get_name = [](void *) -> const char * {
453454
return obs_module_text("Output.Name");
454455
};

0 commit comments

Comments
 (0)