Skip to content

Commit dccd265

Browse files
committed
obs_video_info: add a parent_ovi pointer
Add a parent_ovi pointer to obs_video_info so that when a new video_mix is created within maybe_set_up_gpu_rescale() we can effectively reuse a canvas for sceneItems since they had no knowledge of the new ovi* created for the encoder. Resolves issue where we saw a black screen during Twitch enhanced streaming.
1 parent c8e9cc2 commit dccd265

5 files changed

Lines changed: 10 additions & 1 deletion

File tree

frontend/widgets/OBSBasic.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,7 @@ int OBSBasic::ResetVideo()
15051505
ovi.adapter = config_get_uint(App()->GetUserConfig(), "Video", "AdapterIdx");
15061506
ovi.gpu_conversion = true;
15071507
ovi.scale_type = GetScaleType(activeConfiguration);
1508+
ovi.parent_ovi = NULL;
15081509

15091510
if (ovi.base_width < 32 || ovi.base_height < 32) {
15101511
ovi.base_width = 1920;

libobs/obs-encoder.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ static void maybe_set_up_gpu_rescale(struct obs_encoder *encoder)
274274
ovi->scale_type = encoder->gpu_scale_type;
275275

276276
ovi->gpu_conversion = true;
277+
// Source items will be unaware of this new ovi* since it doesn't match their cached ptr. So we will set the parent ovi*
278+
ovi->parent_ovi = current_mix->ovi;
277279

278280
mix = obs_create_video_mix(ovi);
279281
if (!mix)

libobs/obs-scene.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,13 @@ static void scene_video_render(void *data, gs_effect_t *effect)
10861086
gs_blend_state_push();
10871087
gs_reset_blend_state();
10881088

1089+
// Determine if there is another obs_video_info this scene item can render into
1090+
struct obs_video_info *parent_ovi =
1091+
obs_get_video_rendering_canvas() != NULL ? obs_get_video_rendering_canvas()->parent_ovi : NULL;
1092+
10891093
item = scene->first_item;
10901094
while (item) {
1091-
if (obs_get_video_rendering_canvas() != item->canvas &&
1095+
if (parent_ovi != item->canvas && obs_get_video_rendering_canvas() != item->canvas &&
10921096
item->canvas != NULL) {
10931097
item = item->next;
10941098
continue;

libobs/obs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,7 @@ struct obs_video_info *obs_create_video_info()
19671967
ovi->scale_type = OBS_SCALE_BILINEAR;
19681968
ovi->adapter = 0;
19691969
ovi->gpu_conversion = true;
1970+
ovi->parent_ovi = NULL;
19701971

19711972
return ovi;
19721973
}

libobs/obs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ struct obs_video_info {
224224
enum video_range_type range; /**< YUV range (if YUV) */
225225

226226
enum obs_scale_type scale_type; /**< How to scale if scaling */
227+
void* parent_ovi; /**< Pointer to the source obs_video_info this was copied from */
227228
};
228229

229230
/**

0 commit comments

Comments
 (0)