1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 08:12:17 +00:00

vo_opengl: don't discard buffered video on redundant resize calls

If a VO-area option changes, gl_video_resize() is called
unconditionally. This function does something even if the size does not
change (at least it discards buffered frames for interpolation), which
can lead to stutter when you keep firing option change events during
playback.

Check for an actual resize, and if nothing changes, exit early.
This commit is contained in:
wm4 2017-08-29 15:15:34 +02:00
parent a46500a2c8
commit a9571fcc0f
3 changed files with 8 additions and 1 deletions

View File

@ -104,7 +104,7 @@ const struct m_sub_options sub_style_conf = {
.change_flags = UPDATE_OSD,
};
static bool osd_res_equals(struct mp_osd_res a, struct mp_osd_res b)
bool osd_res_equals(struct mp_osd_res a, struct mp_osd_res b)
{
return a.w == b.w && a.h == b.h && a.ml == b.ml && a.mt == b.mt
&& a.mr == b.mr && a.mb == b.mb

View File

@ -82,6 +82,8 @@ struct mp_osd_res {
double display_par;
};
bool osd_res_equals(struct mp_osd_res a, struct mp_osd_res b);
// 0 <= sub_bitmaps.render_index < MAX_OSD_PARTS
#define MAX_OSD_PARTS 5

View File

@ -3133,6 +3133,11 @@ void gl_video_resize(struct gl_video *p,
struct mp_rect *src, struct mp_rect *dst,
struct mp_osd_res *osd)
{
if (mp_rect_equals(&p->src_rect, src) &&
mp_rect_equals(&p->dst_rect, dst) &&
osd_res_equals(p->osd_rect, *osd))
return;
p->src_rect = *src;
p->dst_rect = *dst;
p->osd_rect = *osd;