mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.04k stars 2.88k forks source link

Updating the properties window-scale and geometry at the same time can cause the window to flicker #14217

Closed ahaoboy closed 4 months ago

ahaoboy commented 4 months ago

mpv Information

mpv v0.38.0-340-g7923a633 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on May 22 2024 21:09:02
libplacebo version: v7.349.0 (v6.338.0-132-g2052ae5-dirty)
FFmpeg version: N-115363-g3146b77a7
FFmpeg library versions:
   libavutil       59.19.100
   libavcodec      61.5.104
   libavformat     61.3.103
   libswscale      8.2.100
   libavfilter     10.2.102
   libswresample   5.2.100

Other Information

Reproduction Steps

Only add a js script

mpv-x86_64-v3-20240522-git-7923a63/portable_config/scripts/test.js

run command

 ./mpv.exe  'any.mp4' --gpu-debug --log-file=./output.txt
var size = 500
var x = 500
var y = 500

function update() {
  mp.set_property_native("window-scale", 1)
  var s = [size, "x", size, "+", x, "+", y].join("")
  mp.set_property_native("geometry", s)
}

update()

function getGeometry() {
  var s = mp.get_property_native("geometry")
  var w = +s.split('x')[0]
  var h = +s.split('x')[1].split('+')[0]
  var x = +s.split('x')[1].split('+')[1]
  var y = +s.split('x')[1].split('+')[2]
  return { w: w, h: h, x: x, y: y }
}

setInterval(function fn() {
  x += 10
  y += 10
  size += 10
  update()
}, 500);

Expected Behavior

The window can be moved and resized correctly without flickering

Actual Behavior

https://github.com/mpv-player/mpv/assets/19884146/1e6ecf4e-8dfb-4ecd-9255-5323be882ff1

The window flickers when moving

Log File

output.txt

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

na-na-hi commented 4 months ago

Working as expected. When you change the window-scale property the window is immediately resized. Then the geometry change also immediately resizes the window. If you don't see the flicker then it's because Windows is not updating the size fast enough.

ahaoboy commented 4 months ago

Thanks for your explanation, I seem to have misunderstood the meaning of window-scale