mpv-player / mpv

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

Crash in Common.getTargetScreen(forFullscreen:) #14810

Open forthrin opened 2 weeks ago

forthrin commented 2 weeks ago

mpv Information

/Applications/mpv.app/Contents/MacOS/mpv
mpv version: git-2024-07-31-0647089
FFmpeg version: git-2024-07-31-43f702a

Other Information

Process:               mpv
Path:                  /Applications/mpv.app/Contents/MacOS/mpv
Identifier:            io.mpv
Version:               0.38.0-UNKNOWN (???)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2024-09-07 08:13:00.4739 +0200
OS Version:            macOS 14.6.1 (23G93)
Report Version:        12
System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x00000001049ee090

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [58992]

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   mpv                                    0x1049ee090 Common.getTargetScreen(forFullscreen:) + 168
1   mpv                                    0x1049f2a98 Window.toggleFullScreen(_:) + 164
2   mpv                                    0x1049f2e84 @objc Window.toggleFullScreen(_:) + 88
3   mpv                                    0x1049ed0f0 thunk for @escaping @callee_guaranteed () -> () + 28
4   libdispatch.dylib                      0x18983b750 _dispatch_call_block_and_release + 32
5   libdispatch.dylib                      0x18983d3e8 _dispatch_client_callout + 20
6   libdispatch.dylib                      0x18984bbb8 _dispatch_main_queue_drain + 988
7   libdispatch.dylib                      0x18984b7cc _dispatch_main_queue_callback_4CF + 44
8   CoreFoundation                         0x189b0ead4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
9   CoreFoundation                         0x189acc258 __CFRunLoopRun + 1996
10  CoreFoundation                         0x189acb434 CFRunLoopRunSpecific + 608
11  HIToolbox                              0x19427519c RunCurrentEventLoopInMode + 292
12  HIToolbox                              0x194274fd8 ReceiveNextEventCommon + 648
13  HIToolbox                              0x194274d30 _BlockUntilNextEventMatchingListInModeWithFilter + 76
14  AppKit                                 0x18d32acc8 _DPSNextEvent + 660
15  AppKit                                 0x18db214d0 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700
16  AppKit                                 0x18d31dffc -[NSApplication run] + 476
17  mpv                                    0x1049e1eec Application.main(_:_:) + 440
18  mpv                                    0x1049e1fdc @objc Application.main(_:_:) + 48
19  mpv                                    0x104b01684 cocoa_main + 44
20  dyld                                   0x189663154 start + 2476

Reproduction Steps

Happened on casual exit. First time. No reproduction method atm.

Expected Behavior

No crash

Actual Behavior

Crash

Log File

mpv.log

Sample Files

No response

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

Akemi commented 2 weeks ago

were you in fullscreen or did you toggle fullscreen while exiting?

you are using libmpv/cocoa-cb and --native-fs=no, both things that are and won't get much/any attention from me anymore and will be deprecated/removed in the near future. the former i do not recommend on ARM macs and the latter is a feature that's only there because it worked and was easily to fix so far. if it's beyond saving, in a timely manner, i will remove it.

from a quick glance though, it might be easily fixable by using the animation lock mechanic that macvk also uses.

what's also kinda suspicious or weird are the rapidly settings of fullscreen. not sure if intentional?

...
[  52.821][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  52.821][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  52.845][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  52.845][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  52.867][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  52.867][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  52.891][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  52.891][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  52.922][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  52.922][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  52.965][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  52.965][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  52.965][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  52.965][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  52.996][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  52.996][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.019][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.019][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.042][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.042][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.065][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.065][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.112][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.112][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.119][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.119][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.158][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.158][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.181][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.181][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.203][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.204][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.228][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.228][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.245][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.245][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.274][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.274][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.297][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.297][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.323][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.323][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.355][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.355][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
[  53.379][d][cplayer] Run command: cycle, flags=73, args=[name="fullscreen", value="1.000000"]
[  53.379][v][cplayer] Dropping command 'cycle fullscreen' from auto-repeated key.
...
forthrin commented 2 weeks ago

It seems the crash can be easily reproduced with any video by pressing f and q fast at random a couple of times.

(But the number of actual key presses are much fewer than shown in the log.)

Commenting out native-fs=no, it doesn't seem to crash, at least not immediately.

However, with native FS, switching gets sluggish, which is a drag.

Is there any way to "instant" native FS switching?

Using macos-fs-animation-duration=1.