Merge pull request #3206 from notr1ch/frame-fix-squashed
Fix preloaded video behavior
This commit is contained in:
commit
80bb9b4675
@ -2888,8 +2888,6 @@ obs_source_preload_video_internal(obs_source_t *source,
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
obs_enter_graphics();
|
||||
|
||||
if (preload_frame_changed(source, frame)) {
|
||||
obs_source_frame_destroy(source->async_preload_frame);
|
||||
source->async_preload_frame = obs_source_frame_create(
|
||||
@ -2897,13 +2895,8 @@ obs_source_preload_video_internal(obs_source_t *source,
|
||||
}
|
||||
|
||||
copy_frame_data(source->async_preload_frame, frame);
|
||||
set_async_texture_size(source, source->async_preload_frame);
|
||||
update_async_textures(source, source->async_preload_frame,
|
||||
source->async_textures, source->async_texrender);
|
||||
|
||||
source->last_frame_ts = frame->timestamp;
|
||||
|
||||
obs_leave_graphics();
|
||||
}
|
||||
|
||||
void obs_source_preload_video(obs_source_t *source,
|
||||
@ -2962,8 +2955,18 @@ void obs_source_show_preloaded_video(obs_source_t *source)
|
||||
if (!obs_source_valid(source, "obs_source_show_preloaded_video"))
|
||||
return;
|
||||
|
||||
if (!source->async_preload_frame)
|
||||
return;
|
||||
|
||||
obs_enter_graphics();
|
||||
|
||||
set_async_texture_size(source, source->async_preload_frame);
|
||||
update_async_textures(source, source->async_preload_frame,
|
||||
source->async_textures, source->async_texrender);
|
||||
source->async_active = true;
|
||||
|
||||
obs_leave_graphics();
|
||||
|
||||
pthread_mutex_lock(&source->audio_buf_mutex);
|
||||
sys_ts = (source->monitoring_type != OBS_MONITORING_TYPE_MONITOR_ONLY)
|
||||
? os_gettime_ns()
|
||||
|
@ -317,9 +317,10 @@ static void ffmpeg_source_start(struct ffmpeg_source *s)
|
||||
return;
|
||||
|
||||
mp_media_play(&s->media, s->is_looping, s->reconnecting);
|
||||
if (s->is_local_file)
|
||||
if (s->is_local_file && (s->is_clear_on_media_end || s->is_looping))
|
||||
obs_source_show_preloaded_video(s->source);
|
||||
|
||||
else
|
||||
obs_source_output_video(s->source, NULL);
|
||||
set_media_state(s, OBS_MEDIA_STATE_PLAYING);
|
||||
obs_source_media_started(s->source);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user