mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-19 13:56:06 -04:00
libobs: Check if output active when setting encoders
This fixes an issue where someone might mistakenly try to change an audio/video encoder before the output is complete.
This commit is contained in:
@@ -807,6 +807,13 @@ void obs_output_set_video_encoder(obs_output_t *output, obs_encoder_t *encoder)
|
||||
"encoder passed is not a video encoder");
|
||||
return;
|
||||
}
|
||||
if (active(output)) {
|
||||
blog(LOG_WARNING,
|
||||
"%s: tried to set video encoder on output \"%s\" "
|
||||
"while the output is still active!",
|
||||
__FUNCTION__, output->context.name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (output->video_encoder == encoder)
|
||||
return;
|
||||
@@ -832,6 +839,13 @@ void obs_output_set_audio_encoder(obs_output_t *output, obs_encoder_t *encoder,
|
||||
"encoder passed is not an audio encoder");
|
||||
return;
|
||||
}
|
||||
if (active(output)) {
|
||||
blog(LOG_WARNING,
|
||||
"%s: tried to set audio encoder %d on output \"%s\" "
|
||||
"while the output is still active!",
|
||||
__FUNCTION__, (int)idx, output->context.name);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((output->info.flags & OBS_OUTPUT_MULTI_TRACK) != 0) {
|
||||
if (idx >= MAX_AUDIO_MIXES) {
|
||||
|
||||
Reference in New Issue
Block a user