mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-26 18:32:07 -04:00
libobs: Restore original video_t for encoders when GPU scaling is used
This commit is contained in:
committed by
Ryan Foster
parent
ee1539614a
commit
4d7776fc3b
@@ -262,6 +262,10 @@ static void maybe_set_up_gpu_rescale(struct obs_encoder *encoder)
|
||||
if (!current_mix)
|
||||
return;
|
||||
|
||||
/* Store original video_t so it can be restored if scaling is disabled. */
|
||||
if (!current_mix->encoder_only_mix)
|
||||
encoder->original_video = encoder->media;
|
||||
|
||||
pthread_mutex_lock(&obs->video.mixes_mutex);
|
||||
for (size_t i = 0; i < obs->video.mixes.num; i++) {
|
||||
struct obs_core_video_mix *current = obs->video.mixes.array[i];
|
||||
@@ -687,7 +691,7 @@ static void maybe_clear_encoder_core_video_mix(obs_encoder_t *encoder)
|
||||
if (!mix->encoder_only_mix)
|
||||
break;
|
||||
|
||||
encoder_set_video(encoder, obs_get_video());
|
||||
encoder_set_video(encoder, encoder->original_video);
|
||||
mix->encoder_refs -= 1;
|
||||
if (mix->encoder_refs == 0) {
|
||||
da_erase(obs->video.mixes, i);
|
||||
|
||||
@@ -1427,6 +1427,8 @@ struct obs_encoder {
|
||||
|
||||
/* stores the video/audio media output pointer. video_t *or audio_t **/
|
||||
void *media;
|
||||
/* Stores the original video if GPU scaling is enabled and `media` can be overwritten. */
|
||||
video_t *original_video;
|
||||
|
||||
pthread_mutex_t callbacks_mutex;
|
||||
DARRAY(struct encoder_callback) callbacks;
|
||||
|
||||
Reference in New Issue
Block a user