8000 IINA sometimes takes a few seconds to quit · Issue #4227 · iina/iina · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

IINA sometimes takes a few seconds to quit #4227

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

Closed
1 task done
low-batt opened this issue Feb 20, 2023 · 3 comments · Fixed by #4228
Closed
1 task done

IINA sometimes takes a few seconds to quit #4227

low-batt opened this issue Feb 20, 2023 · 3 comments · Fixed by #4228

Comments

@low-batt
Copy link
Contributor

System and IINA version:

  • macOS 13.2.1
  • IINA 1.3.1

Expected behavior:
After being asked to quit the IINA application shuts down fairly quickly.

Actual behavior:
Sometimes IINA takes a few seconds to shutdown.

IINA log:
15:50:55.434 [iina][d] App should terminate
15:50:55.434 [iina][d] Disabling all menus
15:50:55.436 [iina][d] Disabling remote commands
15:50:55.436 [iina][d] Closing all windows
15:50:55.438 [iina][d] Waiting for players to stop and shutdown
15:51:05.438 [iina][w] Timed out waiting for players to stop and shutdown
15:51:05.439 [iina][w] Player 0 failed to stop
15:51:05.439 [iina][w] Not waiting for players to shutdown; proceeding with application termination
15:51:05.444 [iina][d] App will terminate

Steps to reproduce:

  • Confirm the setting Keep window open after playback finishes in General/Behavior is disabled
  • Confirm the setting Play next item automatically in General/Playlist is enabled
  • Play a video to the end
  • The windows disappears, the IINA application continues to run
  • Right click the IINA icon in the dock and select quit
  • The IINA application continues to run for a while before terminating
  • MPV does not have this problem.

How often does this happen?
Everytime with the given steps.

@low-batt low-batt self-assigned this Feb 20, 2023
low-batt added a commit that referenced this issue Feb 20, 2023
This commit will change the PlayerCore methods closeMainWindow and
errorOpeningFileAndCloseMainWindow to set the isStopped property to
true. These methods are called by MPVController when the mpv property
idle-active changes to true. This marks idle payers as stopped so that
the applicationShouldTerminate method in AppDelegate will detect they
are stopped and can be shutdown.
@low-batt low-batt linked a pull request Feb 20, 2023 that will close this issue
2 tasks
@low-batt
Copy link
Contributor Author

Analysis

The problem is related to the non-standard behavior of the mpv stop command. That command is processed asynchronously even though IINA is submitting the command using the synchronous API. To know when the stop command has completed IINA is listening for a MPV_EVENT_END_FILE event with a MPV_END_FILE_REASON_STOP reason.

In the case at hand IINA is sending a stop command and then not receiving this event. This leaves the PlayerCore.isStopped property set to false. That means this code in AppDelegate.applicationShouldTerminate does not instruct idle players to shutdown:

    // Instruct any players that are already stopped to start shutting down.
    for player in PlayerCore.playerCores {
      if player.isStopped && !player.isShutdown {
        player.shutdown()
      }
    }

Playback stopped naturally at the end of the file. Likely mpv did not process the stop command. That seems like correct behavior.

Fixing

The commit in the pull request will change the PlayerCore methods closeMainWindow and errorOpeningFileAndCloseMainWindow to set the isStopped property to true. These methods are called by MPVController when the mpv property idle-active changes to true.

MikeWang000000 pushed a commit to MikeWang000000/iina that referenced this issue Mar 8, 2023
This commit will change the PlayerCore methods closeMainWindow and
errorOpeningFileAndCloseMainWindow to set the isStopped property to
true. These methods are called by MPVController when the mpv property
idle-active changes to true. This marks idle payers as stopped so that
the applicationShouldTerminate method in AppDelegate will detect they
are stopped and can be shutdown.
svobs pushed a commit to svobs/iina-advance that referenced this issue Mar 13, 2023
This commit will change the PlayerCore methods closeMainWindow and
errorOpeningFileAndCloseMainWindow to set the isStopped property to
true. These methods are called by MPVController when the mpv property
idle-active changes to true. This marks idle payers as stopped so that
the applicationShouldTerminate method in AppDelegate will detect they
are stopped and can be shutdown.
uiryuu pushed a commit that referenced this issue Mar 27, 2023
This commit will change the PlayerCore methods closeMainWindow and
errorOpeningFileAndCloseMainWindow to set the isStopped property to
true. These methods are called by MPVController when the mpv property
idle-active changes to true. This marks idle payers as stopped so that
the applicationShouldTerminate method in AppDelegate will detect they
are stopped and can be shutdown.
@low-batt
Copy link
Contributor Author

The fix for this issue has been merged into the IINA develop branch. GitHub automatically closed the linked issue in reaction to the merge. I am reopening this issue until the fix is available in an official release of IINA so that users intending to report this problem can easily locate this existing report. Once the fix for this issue has been included in an official release this issue will be closed.

Should you wish to confirm the fix is working and do not have the ability to build IINA from the sources in the develop branch, at some point a new unsigned nightly build will be available for download. If you encounter a defect in a nightly build that has not been reported please enter an issue for it and be sure to indicate the problem was found in a nightly build.

The ability to disable this GitHub automatic closing action has been requested by GitHub users (discussions #23476 and #17308 for example), but so far GitHub has not implemented a way to control this behavior.

@low-batt
Copy link
Contributor Author

IINA 1.3.2 contains the fix for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0