Skip to content

Fix fatal error, video info not available, #3013 #3434

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

Merged
merged 2 commits into from
Apr 23, 2022

Conversation

low-batt
Copy link
Contributor

Change PlayerWindowController.updatePlayTime to not report a fatal error
if the position or duration is not known as can occur when the function
is called while mpv is still loading the file.


Description:

Change PlayerWindowController.updatePlayTime to not report a fatal error
if the position or duration is not known as can occur when the function
is called while mpv is still loading the file.
low-batt added a commit to low-batt/iina that referenced this pull request Jan 3, 2022
The fix in PR iina#3434 MUST be merged before merging this commit..

This commit will:
- Change MainWindowController.hideUI to stop the timer that updates
  the OSC
- Change MainWindowController.showUI to sync the UI and start the timer
- Change PlaybackInfo.constrainVideoPosition to check that`videoPosition
  is not nil
Logger.fatal("video info not available")
}
// IINA listens for changes to mpv properties such as chapter that can occur during file loading
// resulting in this function being called before mpv has set its poistion and duration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// resulting in this function being called before mpv has set its poistion and duration
// resulting in this function being called before mpv has set its position and duration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

// IINA listens for changes to mpv properties such as chapter that can occur during file loading
// resulting in this function being called before mpv has set its poistion and duration
// properties. If position or duration are unknown assume the file is still being loaded.
guard loaded, let duration = player.info.videoDuration, let pos = player.info.videoPosition else { return }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could just downgrade the logging to debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. See what you think of the new commit I just pushed.

Copy link
Member

@saagarjha saagarjha Jan 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't actually mind just having one log statement–my understanding is that both of these should be available simultaneously. Am I missing something, or perhaps you feel that they should be separate?

Copy link
Contributor Author

@low-batt low-batt Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the mpv manual, mpv does not guarantee that it is able to determine the duration. This is mentioned in several places in the manual. This is from the property definition:

Duration of the current file in seconds. If the duration is unknown, the property is unavailable. Note that the file duration is not always exactly known, so this is an estimate.

I have not encountered a case where mpv did not provide a value for duration, but I don't do that much streaming. Probably happens with live streams? I figured it was best to adhere to the documented behavior and not assume the duration is known.

For that reason I thought it was important in the log to distinguish between which piece of video information is missing. Of course there is more than one way to do that.

The commit addresses a review comment that logging should be preserved.
The commit also fixes a typo in a comment.
@lhc70000 lhc70000 merged commit 200fc4f into iina:develop Apr 23, 2022
lhc70000 pushed a commit that referenced this pull request Apr 24, 2022
* Fix fatal error, video info not available, #3013

Change PlayerWindowController.updatePlayTime to not report a fatal error
if the position or duration is not known as can occur when the function
is called while mpv is still loading the file.

* Fix fatal error, video info not available, #3013

The commit addresses a review comment that logging should be preserved.
The commit also fixes a typo in a comment.
@low-batt low-batt deleted the fix-3013 branch October 12, 2022 21:27
uiryuu pushed a commit that referenced this pull request Oct 13, 2022
The fix in PR #3434 MUST be merged before merging this commit..

This commit will:
- Change MainWindowController.hideUI to stop the timer that updates
  the OSC
- Change MainWindowController.showUI to sync the UI and start the timer
- Change PlaybackInfo.constrainVideoPosition to check that`videoPosition
  is not nil
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

Successfully merging this pull request may close these issues.

3 participants