mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-01 00:53:31 +00:00
Compare commits
9 commits
d145a4a424
...
2f51ef4243
Author | SHA1 | Date | |
---|---|---|---|
|
2f51ef4243 | ||
|
9d67bf2662 | ||
|
8892edde05 | ||
|
06291c7201 | ||
|
fb5bbc8575 | ||
|
7d19add10b | ||
|
4830d6903e | ||
|
47fb194223 | ||
|
039f54d759 |
|
@ -1566,10 +1566,10 @@ FailedToStartStream.MissingConfigURL="No config URL available for the current se
|
|||
FailedToStartStream.NoCustomRTMPURLInSettings="Custom RTMP URL not specified"
|
||||
FailedToStartStream.InvalidCustomConfig="Invalid custom config"
|
||||
FailedToStartStream.FailedToCreateMultitrackVideoService="Failed to create multitrack video service"
|
||||
FailedToStartStream.FailedToCreateMultitrackVideoOutput="Failed to create multitrack video rtmp output"
|
||||
FailedToStartStream.FailedToCreateMultitrackVideoOutput="Failed to create multitrack video RTMP output"
|
||||
FailedToStartStream.EncoderNotAvailable="NVENC not available.\n\nFailed to find encoder type '%1'"
|
||||
FailedToStartStream.FailedToCreateVideoEncoder="Failed to create video encoder '%1' (type: '%2')"
|
||||
FailedToStartStream.FailedToGetOBSVideoInfo="Failed to get obs video info while creating encoder '%1' (type: '%2')"
|
||||
FailedToStartStream.FailedToGetOBSVideoInfo="Failed to get OBS video info while creating encoder '%1' (type: '%2')"
|
||||
FailedToStartStream.FailedToCreateAudioEncoder="Failed to create audio encoder"
|
||||
FailedToStartStream.NoRTMPURLInConfig="Config does not contain stream target RTMP(S) URL"
|
||||
FailedToStartStream.FallbackToDefault="Starting the stream using %1 failed; do you want to retry using single encode settings?"
|
||||
|
@ -1585,3 +1585,6 @@ MultitrackVideo.IncompatibleSettings.Title="Incompatible Settings"
|
|||
MultitrackVideo.IncompatibleSettings.Text="%1 is not currently compatible with:\n\n%2\nTo continue streaming with %1, disable incompatible settings:\n\n%3\nand Start Streaming again."
|
||||
MultitrackVideo.IncompatibleSettings.DisableAndStartStreaming="Disable for this stream and Start Streaming"
|
||||
MultitrackVideo.IncompatibleSettings.UpdateAndStartStreaming="Update Settings and Start Streaming"
|
||||
MultitrackVideo.IncompatibleSettings.AudioChannels="%1 is not currently compatible with [Audio → General → Channels] set to '%2', %3"
|
||||
MultitrackVideo.IncompatibleSettings.AudioChannelsSingle="[Audio → General → Channels] needs to be set to '%1'"
|
||||
MultitrackVideo.IncompatibleSettings.AudioChannelsMultiple="%1 requires multiple different settings for [Audio → General → Channels]"
|
||||
|
|
|
@ -477,7 +477,7 @@ OBSDock > QWidget {
|
|||
}
|
||||
|
||||
#transitionsFrame {
|
||||
padding: 4px 8px;
|
||||
padding: var(--padding_large);
|
||||
}
|
||||
|
||||
OBSDock QLabel {
|
||||
|
@ -827,7 +827,7 @@ QComboBox::drop-down,
|
|||
QDateTimeEdit::drop-down {
|
||||
border:none;
|
||||
border-left: 1px solid var(--grey6);
|
||||
width: 32px;
|
||||
width: var(--input_height);
|
||||
}
|
||||
|
||||
QComboBox::down-arrow,
|
||||
|
@ -923,7 +923,7 @@ QDoubleSpinBox::up-button {
|
|||
subcontrol-origin: padding;
|
||||
subcontrol-position: top right; /* position at the top right corner */
|
||||
|
||||
width: 32px;
|
||||
width: var(--input_height);
|
||||
height: var(--spinbox_button_height);
|
||||
border-left: 1px solid var(--grey6);
|
||||
border-bottom: 1px solid transparent;
|
||||
|
@ -936,7 +936,7 @@ QDoubleSpinBox::down-button {
|
|||
subcontrol-origin: padding;
|
||||
subcontrol-position: bottom right; /* position at the top right corner */
|
||||
|
||||
width: 32px;
|
||||
width: var(--input_height);
|
||||
height: var(--spinbox_button_height);
|
||||
border-left: 1px solid var(--grey6);
|
||||
border-top: 1px solid var(--grey6);
|
||||
|
@ -1078,6 +1078,8 @@ QPushButton:hover {
|
|||
|
||||
QToolButton:hover,
|
||||
QToolButton:focus,
|
||||
QPushButton[toolButton="true"]:hover,
|
||||
QPushButton[toolButton="true"]:focus,
|
||||
MuteCheckBox::indicator:hover,
|
||||
MuteCheckBox::indicator:focus {
|
||||
border-color: var(--button_border);
|
||||
|
@ -1104,7 +1106,9 @@ QPushButton:pressed:hover {
|
|||
}
|
||||
|
||||
QToolButton:pressed,
|
||||
QToolButton:pressed:hover {
|
||||
QToolButton:pressed:hover,
|
||||
QPushButton[toolButton="true"]:pressed,
|
||||
QPushButton[toolButton="true"]:pressed:hover {
|
||||
background-color: var(--button_bg_down);
|
||||
border-color: var(--button_border);
|
||||
}
|
||||
|
@ -1275,7 +1279,6 @@ VolControl #volLabel {
|
|||
#vMixerScrollArea VolControl #volLabel {
|
||||
padding: var(--padding_base) 0px var(--padding_base);
|
||||
min-width: var(--volume_slider_label);
|
||||
max-width: var(--volume_slider_label);
|
||||
margin-left: var(--padding_xlarge);
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
--grey2: rgb(134,135,134);
|
||||
--grey3: rgb(122,121,122);
|
||||
--grey4: rgb(76,76,76);
|
||||
--grey5: rgb(88,87,88);
|
||||
--grey5: rgb(70,69,70);
|
||||
--grey6: rgb(31,30,31);
|
||||
--grey7: rgb(58,57,58);
|
||||
--grey8: rgb(46,45,46);
|
||||
|
@ -31,8 +31,12 @@
|
|||
/* OS Fixes */
|
||||
--os_mac_font_base_value: 11;
|
||||
|
||||
--font_small: calc(0.8pt * var(--font_base_value));
|
||||
|
||||
--icon_base: calc(6px + var(--font_base_value));
|
||||
|
||||
--padding_xlarge: calc(2px + calc(0.5px * var(--padding_base_value)));
|
||||
|
||||
--padding_wide: calc(18px + calc(0.25 * var(--padding_base_value)));
|
||||
--padding_menu: calc(8px + calc(1 * var(--padding_base_value)));
|
||||
|
||||
|
@ -45,14 +49,14 @@
|
|||
--border_radius_large: 2px;
|
||||
|
||||
--input_bg: var(--grey4);
|
||||
--input_bg_hover: var(--grey5);
|
||||
--input_bg_hover: var(--grey1);
|
||||
--input_bg_focus: var(--grey6);
|
||||
|
||||
--list_item_bg_selected: var(--primary);
|
||||
--list_item_bg_hover: var(--primary_light);
|
||||
|
||||
--input_border: var(--grey4);
|
||||
--input_border_hover: var(--grey5);
|
||||
--input_border_hover: var(--grey1);
|
||||
--input_border_focus: var(--grey6);
|
||||
|
||||
--spacing_input: var(--spacing_base);
|
||||
|
@ -91,11 +95,17 @@ QStatusBar {
|
|||
background-color: var(--bg_window);
|
||||
}
|
||||
|
||||
OBSDock > QWidget {
|
||||
border-top: 1px solid var(--border_color);
|
||||
padding-top: var(--spacing_large);
|
||||
}
|
||||
|
||||
QDockWidget {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
QDockWidget::title {
|
||||
background-color: var(--grey5);
|
||||
padding: var(--dock_title_padding);
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -104,6 +114,10 @@ QDockWidget > QWidget {
|
|||
background: var(--bg_window);
|
||||
}
|
||||
|
||||
#transitionsFrame {
|
||||
padding: var(--padding_xlarge);
|
||||
}
|
||||
|
||||
SceneTree::item,
|
||||
SourceTreeItem {
|
||||
border-width: 0px;
|
||||
|
@ -193,12 +207,20 @@ OBSBasicSettings QListWidget::item {
|
|||
padding: 4px;
|
||||
}
|
||||
|
||||
QPushButton:checked {
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
||||
QToolButton,
|
||||
QPushButton[toolButton="true"] {
|
||||
background-color: var(--bg_window);
|
||||
border-color: var(--bg_window);
|
||||
}
|
||||
|
||||
#stackedMixerArea QScrollArea {
|
||||
background: var(--bg_base);
|
||||
}
|
||||
|
||||
#stackedMixerArea QPushButton {
|
||||
min-width: var(--icon_base);
|
||||
padding: var(--padding_large) var(--padding_large);
|
||||
|
@ -215,6 +237,33 @@ QPushButton[toolButton="true"] {
|
|||
border: none;
|
||||
}
|
||||
|
||||
#hMixerScrollArea VolControl {
|
||||
padding: 0px 2px;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
#hMixerScrollArea QLabel {
|
||||
margin: var(--padding_xlarge) 0px;
|
||||
}
|
||||
|
||||
#hMixerScrollArea #volMeterFrame {
|
||||
margin-top: var(--spacing_large);
|
||||
}
|
||||
|
||||
#vMixerScrollArea VolControl {
|
||||
padding: 0px var(--padding_xlarge) var(--spacing_large);
|
||||
border-right: 1px solid var(--bg_window);
|
||||
}
|
||||
|
||||
#vMixerScrollArea QLabel {
|
||||
font-size: var(--font_small);
|
||||
margin: var(--padding_xlarge) 0px;
|
||||
}
|
||||
|
||||
#vMixerScrollArea #volLabel {
|
||||
font-size: var(--font_base);
|
||||
}
|
||||
|
||||
MuteCheckBox::indicator,
|
||||
MuteCheckBox::indicator:unchecked {
|
||||
background-color: var(--bg_base);
|
||||
|
@ -255,3 +304,7 @@ VolumeMeter {
|
|||
qproperty-minorTickColor: rgb(122,121,122); /* light */
|
||||
qproperty-meterThickness: 3;
|
||||
}
|
||||
|
||||
OBSBasicStats {
|
||||
background: var(--bg_window);
|
||||
}
|
||||
|
|
|
@ -128,6 +128,9 @@
|
|||
<property name="themeID" stdset="0">
|
||||
<string>addIconSmall</string>
|
||||
</property>
|
||||
<property name="toolButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -157,6 +160,9 @@
|
|||
<property name="themeID" stdset="0">
|
||||
<string>removeIconSmall</string>
|
||||
</property>
|
||||
<property name="toolButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -186,6 +192,9 @@
|
|||
<property name="themeID" stdset="0">
|
||||
<string>upArrowIconSmall</string>
|
||||
</property>
|
||||
<property name="toolButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -215,6 +224,9 @@
|
|||
<property name="themeID" stdset="0">
|
||||
<string>downArrowIconSmall</string>
|
||||
</property>
|
||||
<property name="toolButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -350,6 +362,9 @@
|
|||
<property name="themeID" stdset="0">
|
||||
<string>addIconSmall</string>
|
||||
</property>
|
||||
<property name="toolButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -379,6 +394,9 @@
|
|||
<property name="themeID" stdset="0">
|
||||
<string>removeIconSmall</string>
|
||||
</property>
|
||||
<property name="toolButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -408,6 +426,9 @@
|
|||
<property name="themeID" stdset="0">
|
||||
<string>upArrowIconSmall</string>
|
||||
</property>
|
||||
<property name="toolButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -437,6 +458,9 @@
|
|||
<property name="themeID" stdset="0">
|
||||
<string>downArrowIconSmall</string>
|
||||
</property>
|
||||
<property name="toolButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <obs-app.hpp>
|
||||
#include <obs.hpp>
|
||||
#include <remote-text.hpp>
|
||||
#include <window-basic-main.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
|
@ -331,7 +332,8 @@ struct OBSOutputs {
|
|||
};
|
||||
|
||||
static OBSOutputs
|
||||
SetupOBSOutput(obs_data_t *dump_stream_to_file_config,
|
||||
SetupOBSOutput(QWidget *parent, const QString &multitrack_video_name,
|
||||
obs_data_t *dump_stream_to_file_config,
|
||||
const GoLiveApi::Config &go_live_config,
|
||||
std::vector<OBSEncoderAutoRelease> &audio_encoders,
|
||||
std::shared_ptr<obs_encoder_group_t> &video_encoder_group,
|
||||
|
@ -465,7 +467,8 @@ void MultitrackVideoOutput::PrepareStreaming(
|
|||
|
||||
std::vector<OBSEncoderAutoRelease> audio_encoders;
|
||||
std::shared_ptr<obs_encoder_group_t> video_encoder_group;
|
||||
auto outputs = SetupOBSOutput(dump_stream_to_file_config, output_config,
|
||||
auto outputs = SetupOBSOutput(parent, multitrack_video_name,
|
||||
dump_stream_to_file_config, output_config,
|
||||
audio_encoders, video_encoder_group,
|
||||
audio_encoder_id, main_audio_mixer,
|
||||
vod_track_mixer);
|
||||
|
@ -730,8 +733,46 @@ create_audio_encoders(const GoLiveApi::Config &go_live_config,
|
|||
std::vector<OBSEncoderAutoRelease> &audio_encoders,
|
||||
obs_output_t *output, obs_output_t *recording_output,
|
||||
const char *audio_encoder_id, size_t main_audio_mixer,
|
||||
std::optional<size_t> vod_track_mixer)
|
||||
std::optional<size_t> vod_track_mixer,
|
||||
std::vector<speaker_layout> &speaker_layouts,
|
||||
speaker_layout ¤t_layout)
|
||||
{
|
||||
speaker_layout speakers = SPEAKERS_UNKNOWN;
|
||||
obs_audio_info oai = {};
|
||||
if (obs_get_audio_info(&oai))
|
||||
speakers = oai.speakers;
|
||||
|
||||
current_layout = speakers;
|
||||
|
||||
auto sanitize_audio_channels = [&](obs_encoder_t *encoder,
|
||||
uint32_t channels) {
|
||||
speaker_layout target_speakers = SPEAKERS_UNKNOWN;
|
||||
for (size_t i = 0; i <= (size_t)SPEAKERS_7POINT1; i++) {
|
||||
if (get_audio_channels((speaker_layout)i) != channels)
|
||||
continue;
|
||||
|
||||
target_speakers = (speaker_layout)i;
|
||||
break;
|
||||
}
|
||||
if (target_speakers == SPEAKERS_UNKNOWN) {
|
||||
blog(LOG_WARNING,
|
||||
"MultitrackVideoOutput: Could not find "
|
||||
"speaker layout for %" PRIu32 "channels "
|
||||
"while configuring encoder '%s'",
|
||||
channels, obs_encoder_get_name(encoder));
|
||||
return;
|
||||
}
|
||||
if (speakers != SPEAKERS_UNKNOWN &&
|
||||
(channels > get_audio_channels(speakers) ||
|
||||
speakers == target_speakers))
|
||||
return;
|
||||
|
||||
auto it = std::find(std::begin(speaker_layouts),
|
||||
std::end(speaker_layouts), target_speakers);
|
||||
if (it == std::end(speaker_layouts))
|
||||
speaker_layouts.push_back(target_speakers);
|
||||
};
|
||||
|
||||
using encoder_configs_type =
|
||||
decltype(go_live_config.audio_configurations.live);
|
||||
DStr encoder_name_buffer;
|
||||
|
@ -757,6 +798,10 @@ create_audio_encoders(const GoLiveApi::Config &go_live_config,
|
|||
create_audio_encoder(encoder_name_buffer->array,
|
||||
audio_encoder_id, settings,
|
||||
mixer_idx);
|
||||
|
||||
sanitize_audio_channels(audio_encoder,
|
||||
configs[i].channels);
|
||||
|
||||
obs_output_set_audio_encoder(output, audio_encoder,
|
||||
output_encoder_index);
|
||||
if (recording_output)
|
||||
|
@ -784,8 +829,80 @@ create_audio_encoders(const GoLiveApi::Config &go_live_config,
|
|||
return;
|
||||
}
|
||||
|
||||
static const char *speaker_layout_to_string(speaker_layout layout)
|
||||
{
|
||||
switch (layout) {
|
||||
case SPEAKERS_MONO:
|
||||
return "Mono";
|
||||
case SPEAKERS_2POINT1:
|
||||
return "2.1";
|
||||
case SPEAKERS_4POINT0:
|
||||
return "4.0";
|
||||
case SPEAKERS_4POINT1:
|
||||
return "4.1";
|
||||
case SPEAKERS_5POINT1:
|
||||
return "5.1";
|
||||
case SPEAKERS_7POINT1:
|
||||
return "7.1";
|
||||
case SPEAKERS_UNKNOWN:
|
||||
case SPEAKERS_STEREO:
|
||||
return "Stereo";
|
||||
}
|
||||
|
||||
return "Stereo";
|
||||
}
|
||||
|
||||
static void handle_speaker_layout_issues(
|
||||
QWidget *parent, const QString &multitrack_video_name,
|
||||
const std::vector<speaker_layout> &requested_layouts,
|
||||
speaker_layout layout)
|
||||
{
|
||||
if (requested_layouts.empty())
|
||||
return;
|
||||
|
||||
QString message;
|
||||
if (requested_layouts.size() == 1) {
|
||||
message =
|
||||
QTStr("MultitrackVideo.IncompatibleSettings.AudioChannelsSingle")
|
||||
.arg(QTStr(speaker_layout_to_string(
|
||||
requested_layouts.front())));
|
||||
} else {
|
||||
message =
|
||||
QTStr("MultitrackVideo.IncompatibleSettings.AudioChannelsMultiple")
|
||||
.arg(multitrack_video_name);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
parent,
|
||||
[&] {
|
||||
QMessageBox mb(parent);
|
||||
mb.setIcon(QMessageBox::Critical);
|
||||
mb.setWindowTitle(QTStr(
|
||||
"MultitrackVideo.IncompatibleSettings.Title"));
|
||||
mb.setText(
|
||||
QTStr("MultitrackVideo.IncompatibleSettings.AudioChannels")
|
||||
.arg(multitrack_video_name)
|
||||
.arg(QTStr(speaker_layout_to_string(
|
||||
layout)))
|
||||
.arg(message));
|
||||
|
||||
mb.setStandardButtons(
|
||||
QMessageBox::StandardButton::Cancel);
|
||||
|
||||
mb.exec();
|
||||
},
|
||||
BlockingConnectionTypeFor(parent));
|
||||
|
||||
blog(LOG_INFO,
|
||||
"MultitrackVideoOutput: Attempted to start stream with incompatible "
|
||||
"audio channel setting. Action taken: cancel");
|
||||
|
||||
throw MultitrackVideoError::cancel();
|
||||
}
|
||||
|
||||
static OBSOutputs
|
||||
SetupOBSOutput(obs_data_t *dump_stream_to_file_config,
|
||||
SetupOBSOutput(QWidget *parent, const QString &multitrack_video_name,
|
||||
obs_data_t *dump_stream_to_file_config,
|
||||
const GoLiveApi::Config &go_live_config,
|
||||
std::vector<OBSEncoderAutoRelease> &audio_encoders,
|
||||
std::shared_ptr<obs_encoder_group_t> &video_encoder_group,
|
||||
|
@ -803,9 +920,15 @@ SetupOBSOutput(obs_data_t *dump_stream_to_file_config,
|
|||
recording_output))
|
||||
return {nullptr, nullptr};
|
||||
|
||||
std::vector<speaker_layout> requested_speaker_layouts;
|
||||
speaker_layout current_layout = SPEAKERS_UNKNOWN;
|
||||
create_audio_encoders(go_live_config, audio_encoders, output,
|
||||
recording_output, audio_encoder_id,
|
||||
main_audio_mixer, vod_track_mixer);
|
||||
main_audio_mixer, vod_track_mixer,
|
||||
requested_speaker_layouts, current_layout);
|
||||
|
||||
handle_speaker_layout_issues(parent, multitrack_video_name,
|
||||
requested_speaker_layouts, current_layout);
|
||||
|
||||
return {std::move(output), std::move(recording_output)};
|
||||
}
|
||||
|
|
|
@ -850,7 +850,19 @@ void SimpleOutput::Update()
|
|||
audioSettings);
|
||||
|
||||
if (!enforceBitrate) {
|
||||
blog(LOG_INFO, "User is ignoring service bitrate limits.");
|
||||
int MaxVBitrate, MaxABitrate;
|
||||
obs_service_get_max_bitrate(main->GetService(), &MaxVBitrate,
|
||||
&MaxABitrate);
|
||||
|
||||
std::string videoBitrateStr =
|
||||
MaxVBitrate > 0 ? std::to_string(MaxVBitrate) : "None";
|
||||
std::string audioBitrateStr =
|
||||
MaxABitrate > 0 ? std::to_string(MaxABitrate) : "None";
|
||||
|
||||
blog(LOG_INFO,
|
||||
"User is ignoring service bitrate limits.\nService Recommendations:\n\tvideo bitrate: %s\n\taudio bitrate: %s",
|
||||
videoBitrateStr.c_str(), audioBitrateStr.c_str());
|
||||
|
||||
obs_data_set_int(videoSettings, "bitrate", videoBitrate);
|
||||
obs_data_set_int(audioSettings, "bitrate", audioBitrate);
|
||||
}
|
||||
|
@ -1818,8 +1830,20 @@ void AdvancedOutput::UpdateStreamSettings()
|
|||
obs_service_apply_encoder_settings(main->GetService(), settings,
|
||||
nullptr);
|
||||
if (!enforceBitrate) {
|
||||
int MaxVBitrate, MaxABitrate;
|
||||
obs_service_get_max_bitrate(main->GetService(),
|
||||
&MaxVBitrate, &MaxABitrate);
|
||||
|
||||
std::string videoBitrateStr =
|
||||
MaxVBitrate > 0 ? std::to_string(MaxVBitrate)
|
||||
: "None";
|
||||
std::string audioBitrateStr =
|
||||
MaxABitrate > 0 ? std::to_string(MaxABitrate)
|
||||
: "None";
|
||||
|
||||
blog(LOG_INFO,
|
||||
"User is ignoring service bitrate limits.");
|
||||
"User is ignoring service bitrate limits.\nService Recommendations:\n\tvideo bitrate: %s\n\taudio bitrate: %s",
|
||||
videoBitrateStr.c_str(), audioBitrateStr.c_str());
|
||||
obs_data_set_int(settings, "bitrate", bitrate);
|
||||
}
|
||||
|
||||
|
|
|
@ -353,15 +353,9 @@ static void remove_connection(struct obs_encoder *encoder, bool shutdown)
|
|||
|
||||
if (encoder->encoder_group) {
|
||||
pthread_mutex_lock(&encoder->encoder_group->mutex);
|
||||
if (--encoder->encoder_group->num_encoders_started == 0) {
|
||||
if (--encoder->encoder_group->num_encoders_started == 0)
|
||||
encoder->encoder_group->start_timestamp = 0;
|
||||
if (encoder->encoder_group->destroy_on_stop)
|
||||
obs_encoder_group_actually_destroy(
|
||||
encoder->encoder_group);
|
||||
}
|
||||
|
||||
if (encoder->encoder_group)
|
||||
pthread_mutex_unlock(&encoder->encoder_group->mutex);
|
||||
pthread_mutex_unlock(&encoder->encoder_group->mutex);
|
||||
}
|
||||
|
||||
/* obs_encoder_shutdown locks init_mutex, so don't call it on encode
|
||||
|
@ -371,6 +365,8 @@ static void remove_connection(struct obs_encoder *encoder, bool shutdown)
|
|||
* up again */
|
||||
if (shutdown)
|
||||
obs_encoder_shutdown(encoder);
|
||||
encoder->initialized = false;
|
||||
|
||||
set_encoder_active(encoder, false);
|
||||
}
|
||||
|
||||
|
@ -790,14 +786,20 @@ void obs_encoder_start(obs_encoder_t *encoder,
|
|||
pthread_mutex_unlock(&encoder->init_mutex);
|
||||
}
|
||||
|
||||
static inline bool obs_encoder_stop_internal(
|
||||
obs_encoder_t *encoder,
|
||||
void (*new_packet)(void *param, struct encoder_packet *packet),
|
||||
void *param)
|
||||
void obs_encoder_stop(obs_encoder_t *encoder,
|
||||
void (*new_packet)(void *param,
|
||||
struct encoder_packet *packet),
|
||||
void *param)
|
||||
{
|
||||
bool last = false;
|
||||
size_t idx;
|
||||
|
||||
if (!obs_encoder_valid(encoder, "obs_encoder_stop"))
|
||||
return;
|
||||
if (!obs_ptr_valid(new_packet, "obs_encoder_stop"))
|
||||
return;
|
||||
|
||||
pthread_mutex_lock(&encoder->init_mutex);
|
||||
pthread_mutex_lock(&encoder->callbacks_mutex);
|
||||
|
||||
idx = get_callback_idx(encoder, new_packet, param);
|
||||
|
@ -810,34 +812,32 @@ static inline bool obs_encoder_stop_internal(
|
|||
|
||||
if (last) {
|
||||
remove_connection(encoder, true);
|
||||
encoder->initialized = false;
|
||||
pthread_mutex_unlock(&encoder->init_mutex);
|
||||
|
||||
if (encoder->destroy_on_stop) {
|
||||
pthread_mutex_unlock(&encoder->init_mutex);
|
||||
struct obs_encoder_group *group = encoder->encoder_group;
|
||||
|
||||
if (encoder->destroy_on_stop)
|
||||
obs_encoder_actually_destroy(encoder);
|
||||
return true;
|
||||
|
||||
/* Destroying the group all the way back here prevents a race
|
||||
* where destruction of the group can prematurely destroy the
|
||||
* encoder within internal functions. This is the point where it
|
||||
* is safe to destroy the group, even if the encoder is then
|
||||
* also destroyed. */
|
||||
if (group) {
|
||||
pthread_mutex_lock(&group->mutex);
|
||||
if (group->destroy_on_stop &&
|
||||
group->num_encoders_started == 0)
|
||||
obs_encoder_group_actually_destroy(group);
|
||||
else
|
||||
pthread_mutex_unlock(&group->mutex);
|
||||
}
|
||||
|
||||
/* init_mutex already unlocked */
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void obs_encoder_stop(obs_encoder_t *encoder,
|
||||
void (*new_packet)(void *param,
|
||||
struct encoder_packet *packet),
|
||||
void *param)
|
||||
{
|
||||
bool destroyed;
|
||||
|
||||
if (!obs_encoder_valid(encoder, "obs_encoder_stop"))
|
||||
return;
|
||||
if (!obs_ptr_valid(new_packet, "obs_encoder_stop"))
|
||||
return;
|
||||
|
||||
pthread_mutex_lock(&encoder->init_mutex);
|
||||
destroyed = obs_encoder_stop_internal(encoder, new_packet, param);
|
||||
if (!destroyed)
|
||||
pthread_mutex_unlock(&encoder->init_mutex);
|
||||
pthread_mutex_unlock(&encoder->init_mutex);
|
||||
}
|
||||
|
||||
const char *obs_encoder_get_codec(const obs_encoder_t *encoder)
|
||||
|
@ -1334,7 +1334,6 @@ void full_stop(struct obs_encoder *encoder)
|
|||
pthread_mutex_unlock(&encoder->callbacks_mutex);
|
||||
|
||||
remove_connection(encoder, false);
|
||||
encoder->initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
#endif
|
||||
|
||||
enum AVHWDeviceType hw_priority[] = {
|
||||
AV_HWDEVICE_TYPE_CUDA, AV_HWDEVICE_TYPE_D3D11VA, AV_HWDEVICE_TYPE_DXVA2,
|
||||
AV_HWDEVICE_TYPE_QSV, AV_HWDEVICE_TYPE_NONE,
|
||||
AV_HWDEVICE_TYPE_D3D11VA,
|
||||
AV_HWDEVICE_TYPE_DXVA2,
|
||||
AV_HWDEVICE_TYPE_QSV,
|
||||
AV_HWDEVICE_TYPE_NONE,
|
||||
};
|
||||
|
||||
static bool has_hw_type(const AVCodec *c, enum AVHWDeviceType type)
|
||||
|
|
Loading…
Reference in a new issue