Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies with fullscreen state #3570

Closed
rr- opened this issue Sep 22, 2016 · 12 comments
Closed

Inconsistencies with fullscreen state #3570

rr- opened this issue Sep 22, 2016 · 12 comments

Comments

@rr-
Copy link
Member

rr- commented Sep 22, 2016

mpv version and platform

git master

Reproduction steps

  1. config:

    fullscreen=yes
    
  2. scripts/reset_view.lua:

    function file_changed()
        mp.set_property('video-unscaled', 'no')
        mp.set_property_number('video-pan-x', 0)
        mp.set_property_number('video-pan-y', 0)
        mp.set_property_number('video-zoom', 0)
        -- mp.set_property_number('video-rotate', 0)
    end
    
    mp.register_event('end-file', file_changed)
    
  3. Run mpv on *.jpg

  4. Exit fullscreen by hitting f

  5. Observe how it reenters fullscreen upon navigation to the next file

Expected behavior

It shouldn't touch fullscreen.

Actual behavior

It reenters fullscreen if I set any properties (except rotation) on either end-file or start-file.

@ghost
Copy link

ghost commented Sep 22, 2016

I can't seem to reproduce.

@ghost
Copy link

ghost commented Sep 22, 2016

What OS?

@rr-
Copy link
Member Author

rr- commented Sep 22, 2016

Linux aurora 4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 x86_64 GNU/Linux

mpv git-c296b62 (C) 2000-2016 mpv/MPlayer/mplayer2 projects
 built on Thu Sep 22 19:09:03 CEST 2016
ffmpeg library versions:
   libavutil       55.28.100
   libavcodec      57.48.101
   libavformat     57.41.100
   libswscale      4.1.100
   libavfilter     6.47.100
   libswresample   2.1.100
ffmpeg version: 3.1.3

@ghost
Copy link

ghost commented Sep 22, 2016

x11?

@rr-
Copy link
Member Author

rr- commented Sep 22, 2016

Yes.

Weird thing - I tried reproducing it now and:

  1. It worked correctly (kept fullscreen state).
  2. I thought I failed to identify the minimal configuration, so I started to compare this minimal example above with my full configuration. It kept working no matter what I copied, until I arrived at actual 1:1 copy of my regular config. It still worked.
  3. To be sure I removed ~/.config/mpv and symlinked it to my regular config. It still worked.
  4. It didn't make sense since I clearly have experienced the issue.
  5. So I removed ~/.config/mpv again and pasted the example posted above again to start over.
  6. It stopped working (and started opening fullscreen every playlist item)...

If this is of any help, I'm using bspwm, but I don't think it's WM issue.

@rr-
Copy link
Member Author

rr- commented Sep 22, 2016

Part of logs with --msg-level=all=trace that cover the moment of navigating between two PNG files (which reenters fullscreen), and exiting the player:

[lavf] 32768=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7241728, eof:0
[lavf] 32768=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7274496, eof:0
[lavf] 32768=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7307264, eof:0
[lavf] 32768=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7340032, eof:0
[lavf] 32768=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7372800, eof:0
[cache] EOF reached.
[lavf] 32768=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7405568, eof:0
[lavf] 6612=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:0
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[ffmpeg/demuxer] png_pipe: Probe buffer size limit of 5000000 bytes reached
[ffmpeg/demuxer] png_pipe: Stream #0: not enough frames to estimate rate; consider increasing probesize
[lavf] mp_seek(0x7fc2ac21a1e0, 0, size)
[lavf] mp_seek(0x7fc2ac21a1e0, 0, size)
[ffmpeg/demuxer] png_pipe: stream 0: start_time: -368934881474191040.000 duration: -368934881474191040.000
[ffmpeg/demuxer] png_pipe: format: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=0 kb/s
[ffmpeg/demuxer] png_pipe: After avformat_find_stream_info() pos: 7412180 bytes read:7412180 seeks:0 frames:1
[lavf] avformat_find_stream_info() finished after 7412180 bytes.
[demux] Detected file format: png_pipe (libavformat)
[cache] blocking for STREAM_CTRL 6
[lavf] packets=0, bytes=0, active=0, more=0
[lavf] packets=0, bytes=0, active=0, more=0
[find_files] Loading external files in tmp/img/
[global] config path: 'sub/' -/-> '/home/rr-/.config/mpv/sub/'
[global] config path: 'sub/' -/-> '/home/rr-/.mpv/sub/'
[global] config path: 'sub/' -/-> '/usr/local/etc/mpv/sub/'
[global] config path: 'audio/' -/-> '/home/rr-/.config/mpv/audio/'
[global] config path: 'audio/' -/-> '/home/rr-/.mpv/audio/'
[global] config path: 'audio/' -/-> '/usr/local/etc/mpv/audio/'
 (+) Video --vid=1 (png)
[lavf] packets=0, bytes=0, active=0, more=0
[vd] Container reported FPS: 1.000000
[vo/opengl/x11] XEvent: 28
[vo/opengl/x11] XEvent: 28
[vo/opengl/x11] XEvent: 28
[vo/opengl/x11] XEvent: 28
[vd] Codec list:
[vd]     lavc:png - PNG (Portable Network Graphics) image
[vd] Opening video decoder lavc:png
[vd] Not trying to use hardware decoding: codec png is not on whitelist, or does not support hardware acceleration.
[vd] Using software decoding.
[vd] Detected 4 logical cores.
[vd] Requesting 5 threads for decoding.
[vd] Selected video codec: PNG (Portable Network Graphics) image [lavc:png]
[cplayer] Starting playback...
[cplayer] video_output_image: 3
[lavf] packets=0, bytes=0, active=1, more=1
[lavf] append packet to video: size=7412180 pts=0.000000 dts=0.000000 pos=0 [num=1 size=7412180]
[lavf] packets=1, bytes=7412180, active=1, more=1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] EOF reached.
[cplayer] video_output_image: 1
[lavf] packets=0, bytes=0, active=1, more=1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] packets=0, bytes=0, active=1, more=1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[vd] Decoder format: 1950x2300 rgb24 auto/full CL=unknown
[vf] Video filter chain:
[vf]   [in] 1950x2300 rgb24 rgb/full CL=unknown
[vf]   [out] 1950x2300 rgb24 rgb/full CL=unknown
[cplayer] frametime=0.000
[cplayer] video_output_image: 2
VO: [opengl] 1950x2300 rgb24
[cplayer] VO: Description: Extended OpenGL Renderer
[vo/opengl] screen size: 1920x1080
[vo/opengl] Resize: 952x1053
[vo/opengl] Window size: 952x1053
[vo/opengl] Video source: 1950x2300 (3779:3779)
[vo/opengl] Video display: (0, 0) 1950x2300 -> (30, 0) 892x1053
[vo/opengl] Video scale: 0.457436/0.457826
[vo/opengl] OSD borders: l=30 t=0 r=30 b=0
[vo/opengl] Video borders: l=30 t=0 r=30 b=0
[vo/opengl] Testing FBO format 0x805b
[vo/opengl] Create FBO: 16x16 (16x16)
[vo/opengl] Using FBO format 0x805b.
[vo/opengl] No advanced processing required. Enabling dumb mode.
[vo/opengl] Texture for plane 0: 1950x2300
[vo/opengl/x11] XEvent: 28
[vo/opengl/x11] XEvent: 28
[vo/opengl/x11] XEvent: 28
[cplayer] set video colors output-levels=0 
[vo/opengl/x11] XEvent: 22
[vo/opengl/x11] XEvent: 12
[vo/opengl/x11] XEvent: 22
[vo/opengl/x11] XEvent: 12
[vo/opengl] Resize: 1920x1080
[vo/opengl] Window size: 1920x1080
[vo/opengl] Video source: 1950x2300 (3779:3779)
[vo/opengl] Video display: (0, 0) 1950x2300 -> (502, 0) 915x1080
[vo/opengl] Video scale: 0.469231/0.469565
[vo/opengl] OSD borders: l=502 t=0 r=503 b=0
[vo/opengl] Video borders: l=502 t=0 r=503 b=0
[vo/opengl] HDR src nom: 250.000000 sig: 250.000000, dst: 250.000000
[vo/opengl] upload time: last 0us avg 246us peak 5419us
[vo/opengl] present time: last 1887us avg 1728us peak 3192us
[cplayer] first video frame after restart shown
[cplayer] playback restart complete
[osc] rendering 
[lavf] packets=0, bytes=0, active=1, more=1
[osc] osc_init 
[cplayer] video_output_image: 0
[cplayer] assuming this is an image
[cplayer] video EOF (status=4)
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] packets=0, bytes=0, active=1, more=1
[cplayer] video_output_image: 0
[cplayer] video EOF (status=4)
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] packets=0, bytes=0, active=1, more=1
[cplayer] video_output_image: 0
[cplayer] video EOF (status=4)
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] packets=0, bytes=0, active=1, more=1
[cplayer] video_output_image: 0
[cplayer] video EOF (status=4)
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
[lavf] 0=mp_read(0x7fc2ac21a1e0, 0x7fc2acb465e0, 32768), pos: 7412180, eof:1
V: 00:00:00 (0%) Cache:  0s+0KB
[vo/opengl] HDR src nom: 250.000000 sig: 250.000000, dst: 250.000000
[vo/opengl] upload time: last 0us avg 235us peak 5419us
[vo/opengl] present time: last 1824us avg 1732us peak 3192us
[vo/opengl/x11] XEvent: 2
[input] key code=0x51 'Q' down
[input] key 'Q' -> 'quit-watch-later' in 'default'
[cplayer] Run command: quit-watch-later, flags=9, args=[0]
[global] config path: '/home/rr-/.config/mpv/watch_later' -> '/home/rr-/.config/mpv/watch_later'
Saving state.
[cplayer] EOF code: 6  
[vd] Uninit video.
[cache] Terminating cache...
[cache] Cache exiting...
[cplayer] finished playback, success (reason 3)


Exiting... (Quit)
[vo/opengl] Resize: 1920x1080
[vo/opengl] Window size: 1920x1080
[vo/opengl] Video source: 1950x2300 (3779:3779)
[vo/opengl] Video display: (0, 0) 1950x2300 -> (502, 0) 915x1080
[vo/opengl] Video scale: 0.469231/0.469565
[vo/opengl] OSD borders: l=502 t=0 r=503 b=0
[vo/opengl] Video borders: l=502 t=0 r=503 b=0
[ytdl_hook] Exiting...
[cplayer] Set property: video-unscaled="no" -> 1
[vo/opengl] Resize: 1920x1080
[vo/opengl] Window size: 1920x1080
[vo/opengl] Video source: 1950x2300 (3779:3779)
[vo/opengl] Video display: (0, 0) 1950x2300 -> (502, 0) 915x1080
[vo/opengl] Video scale: 0.469231/0.469565
[vo/opengl] OSD borders: l=502 t=0 r=503 b=0
[vo/opengl] Video borders: l=502 t=0 r=503 b=0
[cplayer] Set property: video-pan-x=0 -> 1
[vo/opengl] Resize: 1920x1080
[vo/opengl] Window size: 1920x1080
[vo/opengl] Video source: 1950x2300 (3779:3779)
[vo/opengl] Video display: (0, 0) 1950x2300 -> (502, 0) 915x1080
[vo/opengl] Video scale: 0.469231/0.469565
[vo/opengl] OSD borders: l=502 t=0 r=503 b=0
[vo/opengl] Video borders: l=502 t=0 r=503 b=0
[osc] Exiting...
[cplayer] Set property: video-pan-y=0 -> 1
[vo/opengl] Resize: 1920x1080
[vo/opengl] Window size: 1920x1080
[vo/opengl] Video source: 1950x2300 (3779:3779)
[vo/opengl] Video display: (0, 0) 1950x2300 -> (502, 0) 915x1080
[vo/opengl] Video scale: 0.469231/0.469565
[vo/opengl] OSD borders: l=502 t=0 r=503 b=0
[vo/opengl] Video borders: l=502 t=0 r=503 b=0
[cplayer] Set property: video-zoom=0 -> 1
[reset_zoom] Exiting...
[vo/opengl] flushing shader cache
[input] release all
[input] input: switch section showhide -> default
[input] No key binding found for key 'MOUSE_LEAVE'.
[vo/opengl/x11] Enabling screensaver.
[vo/opengl/x11] uninit ...

This is interesting:

[vo/opengl/x11] XEvent: 22
[vo/opengl/x11] XEvent: 12
[vo/opengl/x11] XEvent: 22
[vo/opengl/x11] XEvent: 12
[vo/opengl] Resize: 1920x1080
[vo/opengl] Window size: 1920x1080

which looks as if WM decided to resize mpv on its own... but I fail to see why it would do so, and in such an unreliable fashion.

@rr-
Copy link
Member Author

rr- commented Sep 22, 2016

OK. There's a conflict between WM's fullscreen state and mpv's fullscreen state.

Basically WM is too persistent and when it detects window size change it remembers that it was supposed to be fullscreen and immediately resizes it back. But it also might be an issue with the way mpv reports X11 fullscreen flags (if there's such a thing).

I believe this behavior was introduced in 4d75514.

@rr- rr- changed the title Setting video properties on end-file resets fullscreen state Inconsistencies with fullscreen state Sep 22, 2016
@ghost
Copy link

ghost commented Sep 22, 2016

I believe this behavior was introduced in 4d75514.

Can you definitely confirm?

@rr-
Copy link
Member Author

rr- commented Sep 22, 2016

OK on it

@rr-
Copy link
Member Author

rr- commented Sep 22, 2016

I was wrong :( Bisecting revealed 2c91721 to be the culprit. I checked the commit before and 2c91721 to make sure (since the issue seemed a little undeterministic at first) and got consistent results so I'm pretty sure that's it.

@ghost
Copy link

ghost commented Sep 22, 2016

Certainly interesting. Possibly a race condition, now that I think about it.

@ghost
Copy link

ghost commented Sep 22, 2016

I can reproduce the following way:

  • mpv *.jpg --script=yourscript.lua
  • change window to fullscreen, but don't use mpv for it (for example, use your WM's shortcuts for fullscreening)
  • when mpv changes to the next file, it'll change back to windowed

Unsurprisingly, this hack, which I declared as "awful", is biting back: https://github.com/mpv-player/mpv/blob/master/video/out/x11_common.c#L980

The problem is that it doesn't really change the VO flag as it is copied to the VO (because the option hasn't been set "properly" and the shadow copy of the flag has not been updated), which makes it see fullscreen=0, and switch back.

I have a solution for this in mind by somehow properly reporting the new fullscreen state back to the playback core, where it'll update the flag correctly. I'll get to it tomorrow.

@ghost ghost closed this as completed in caa14e3 Sep 23, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant