vlc | branch: master | Steve Lhomme <[email protected]> | Thu Nov 19 08:43:54 2020 +0100| [580b14dbbf193af9c6a7db6795af615e4a9c9535] | committer: Steve Lhomme
video_output: update displayed.current directly in ThreadDisplayPreparePicture() Now that there is no mix up possible with displayed.next we can centralize the setting of this value. Rename ThreadDisplayPreparePicture() to ThreadDisplayPrerenderNext(). > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=580b14dbbf193af9c6a7db6795af615e4a9c9535 --- src/video_output/video_output.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 276ceb4f41..6d6e4af71d 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -1052,8 +1052,7 @@ static void ThreadChangeFilters(vout_thread_sys_t *vout) /* */ -VLC_USED -static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reuse_decoded, +static bool ThreadDisplayPrerenderNext(vout_thread_sys_t *vout, bool reuse_decoded, bool frame_by_frame, bool *paused) { vout_thread_sys_t *sys = vout; @@ -1141,7 +1140,13 @@ static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reus vlc_mutex_unlock(&sys->filter.lock); - return picture; + if (picture == NULL) + return false; + + if (sys->displayed.current != NULL) + picture_Release(sys->displayed.current); + sys->displayed.current = picture; + return true; } static vlc_decoder_device * VoutHoldDecoderDevice(vlc_object_t *o, void *opaque) @@ -1474,24 +1479,16 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline) bool render_now; if (frame_by_frame) { - picture_t *next; - next = ThreadDisplayPreparePicture(vout, first, true, &paused); - if (next == NULL) + if (!ThreadDisplayPrerenderNext(vout, first, true, &paused)) return VLC_EGENERIC; - if (likely(sys->displayed.current != NULL)) - picture_Release(sys->displayed.current); - sys->displayed.current = next; - render_now = true; } else { if (first) { - sys->displayed.current = - ThreadDisplayPreparePicture(vout, first, false, &paused); - if (!sys->displayed.current) + if (!ThreadDisplayPrerenderNext(vout, first, false, &paused)) return VLC_EGENERIC; // wait with no known deadline } @@ -1528,9 +1525,7 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline) while (pic_render_deadline <= system_now) { // not enough (predicted) time to render current, get non-late pic - picture_t *next; - next = ThreadDisplayPreparePicture(vout, false, false, &paused); - if (unlikely(next == NULL)) + if (!ThreadDisplayPrerenderNext(vout, false, false, &paused)) break; else { @@ -1538,10 +1533,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline) dropped_current_frame = true; render_now = false; - if (likely(sys->displayed.current != NULL)) - picture_Release(sys->displayed.current); - sys->displayed.current = next; - pic_system_pts = vlc_clock_ConvertToSystem(sys->clock, vlc_tick_now(), sys->displayed.current->date, sys->rate); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
