0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
mpv/player
wm4 2c5cb2c53f client API: rewrite property observation (again)
I intend to rewrite this code approximately every 2 months.

Last time, I did this in commit d66eb93e5d (and 065c307e8e and
b2006eeb74). It was intended to remove the roundabout synchronous
thread "ping pong" when observing properties. At first, the original
async. code was replaced with some nice mostly synchronous code. But
then an async. code path had to be added for vo_libmpv, and finally the
sync. code was dropped because it broke in other obscure cases (like the
Objective-C Cocoa backend).

Try again. This time, update properties entirely on the main thread.
Updates get batched out on every playloop iteration. (At first I wanted
it to make it every time the player goes to sleep, but that might starve
API clients if the playloop get saturated.) One nice thing is that
clients only get woken up once all changed events have been sent, which
might reduce overhead.

While this sounds simple, it's not. The main problem is that reading
properties must not block the client API, i.e. no client API locks can
be held while reading the property. Maybe eventually we can avoid this
requirement, but currently it's just a fact. This means we have to
iterate over all clients and then over all properties (of each client),
all while releasing all locks when updating a property. Solve this by
rechecking on each iteration whether the list changed, and if so,
aborting the iteration and redo it "next time".

High risk change, expect bugs such as crashes and missing property
updates.
2019-12-19 11:11:51 +01:00
..
javascript js: mp.add_key_binding: allow false-y name (match 311cc5b) 2019-11-30 12:23:47 +02:00
lua console: adjust position to OSC 2019-12-18 09:04:15 +01:00
audio.c command: shuffle some crap around 2019-11-25 00:26:36 +01:00
client.c client API: rewrite property observation (again) 2019-12-19 11:11:51 +01:00
client.h client API: rewrite property observation (again) 2019-12-19 11:11:51 +01:00
command.c command, lua: add a way to share data between scripts 2019-12-18 08:58:49 +01:00
command.h player: change m_config to use new option handling mechanisms 2019-11-29 12:49:15 +01:00
configfiles.c player: Optionally validate st_mtime when restoring playback state 2019-11-20 15:11:33 +01:00
core.h player: avoid underrun wakeup loop 2019-12-16 01:15:43 +01:00
external_files.c external_files: add .lrc subtitle extension 2019-09-02 01:25:43 +03:00
external_files.h player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
javascript.c js: don't pre-filter log level argument in mp.enable_messages() 2019-11-19 18:13:39 +02:00
loadfile.c player: loadfile overrides previous stop command 2019-12-06 19:21:14 +01:00
lua.c console.lua: add this script 2019-12-08 02:46:44 +01:00
main.c player: add comment to clarify FFmpeg ABI handling 2019-12-13 13:22:46 +01:00
misc.c player: simplify --stream-dump code 2019-10-31 11:05:55 +01:00
osd.c player: format low cache duration with more decimals 2019-10-11 19:18:43 +02:00
playloop.c client API: rewrite property observation (again) 2019-12-19 11:11:51 +01:00
screenshot.c screenshot, vo_image: use global swscale/zimg parameters 2019-10-31 15:44:09 +01:00
screenshot.h screenshot, vo_image: use global swscale/zimg parameters 2019-10-31 15:44:09 +01:00
scripting.c console.lua: add this script 2019-12-08 02:46:44 +01:00
sub.c player: ensure backward playback state is propagated on track switching 2019-09-19 20:37:05 +02:00
video.c player: avoid underrun wakeup loop 2019-12-16 01:15:43 +01:00