Skip to content

Commit 8f0dcbd

Browse files
committed
Add WebRTC Simulcast Support
1 parent 19d7a96 commit 8f0dcbd

4 files changed

Lines changed: 55 additions & 28 deletions

File tree

CI/windows/01_install_dependencies.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Function Install-obs-deps {
3131
if (!(Test-Path "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}")) {
3232

3333
Write-Step "Download..."
34-
curl.exe -Lf "https://github.com/obsproject/obs-deps/releases/download/${Version}/windows-deps-${Version}-${ArchSuffix}.zip" -o "windows-deps-${Version}-${ArchSuffix}.zip" $(if ($Quiet.isPresent) { "-s" })
34+
curl.exe -Lf "https://github.com/obsproject/sean-der/releases/download/${Version}/windows-deps-${Version}-${ArchSuffix}.zip" -o "windows-deps-${Version}-${ArchSuffix}.zip" $(if ($Quiet.isPresent) { "-s" })
3535

3636
Write-Step "Unpack..."
3737

@@ -55,7 +55,7 @@ function Install-qt-deps {
5555
if (!(Test-Path "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}/mkspecs")) {
5656

5757
Write-Step "Download..."
58-
curl.exe -Lf "https://github.com/obsproject/obs-deps/releases/download/${Version}/windows-deps-qt6-${Version}-${ArchSuffix}.zip" -o "windows-deps-qt6-${Version}-${ArchSuffix}.zip" $(if ($Quiet.isPresent) { "-s" })
58+
curl.exe -Lf "https://github.com/obsproject/sean-der/releases/download/${Version}/windows-deps-qt6-${Version}-${ArchSuffix}.zip" -o "windows-deps-qt6-${Version}-${ArchSuffix}.zip" $(if ($Quiet.isPresent) { "-s" })
5959

6060
Write-Step "Unpack..."
6161

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: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
22
"dependencies": {
33
"prebuilt": {
4-
"version": "2023-06-22",
5-
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
4+
"version": "2023-06-29",
5+
"baseUrl": "https://github.com/obsproject/sean-der/releases/download",
66
"label": "Pre-Built obs-deps",
77
"hashes": {
8-
"macos-universal": "a0d2e03f0ea79681634c31627430a220d9b62113d6ff58174d0bdab6fafdd32b",
9-
"windows-x64": "1b12e86e2d62a97a889866d66b95fe47ddc6f7fa9b13e88aedfab4ea9e298ea2",
10-
"linux-x86_64": "1b82ab4247bc2730ae84caa5a009e76637eac77b05bfb4b4a2bae610e7a75262"
8+
"macos-universal": "dec117242794192862ca7af1874ffefc38f1b8825bf3bfdf74a9270f96cf507e",
9+
"windows-x64": "91efb294b60ca878595425655ef1318c352194dac10b3bf02da7e9f7d77cd0c3",
10+
"linux-x86_64": "1562f7a1aa22a844cf1416584a0c8a95b812b3f8a1ccfd71584fedb96532c91a"
1111
}
1212
},
1313
"qt6": {
14-
"version": "2023-06-22",
15-
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
14+
"version": "2023-06-29",
15+
"baseUrl": "https://github.com/obsproject/sean-der/releases/download",
1616
"label": "Pre-Built Qt6",
1717
"hashes": {
18-
"macos-universal": "f890d258a1afa7ba409b79c8ee55d53155e5c72105b8b18a3f52047ee70fc0aa",
19-
"windows-x64": "1907fbcbcef69527154b29316c425b0885afb77ad69a9a2af7a1471d79512195"
18+
"macos-universal": "efeff7985622d200060d9d453f3438618d4bbb1ac65bbad4df171b758bcb4603",
19+
"windows-x64": "e7aa3ae65062b2c7e4d86c1c5865d40f723b115e1f44c816865059ac9bb3ae88"
2020
},
2121
"debugSymbols": {
22-
"windows-x64": "b461a7ade0c099505baea857fa5b98c4f8e9b702681be019ea354735d062e065"
22+
"windows-x64": "411ff9916ecea2d32c1e689bc8d8780caebba8db32cc2e5b50e75e515df0959d"
2323
}
2424
},
2525
"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)