VideoPlayerAudio: limit max allowed Out-Of-Sync for "self-learning" to 80 ms #25233
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
VideoPlayerAudio: limit max allowed Out-Of-Sync for "self-learning" to 80 ms
Motivation and context
As commented in #25229 recently found that use high values for
maxpassthroughoffsyncduration
e.g. 96 ms breaks a/v sync corrections because AE cannot correct error bigger that 2 * frame time. And since current "self-learning" algo calculates this value based in first seconds of stream is very influenced by bad a/v sync at start (and not yet corrected) and noise in error calculations (system clock irregularities, etc.).With all this is possible too large values (even max. 100 ms) that cause error is accumulated and never corrected or too small values (25/30 ms) that may cause accidental corrections if error is bigger later (or noise in error only).
Then is better replace self-learning with a frame time based value, obtaining much more predictable operation.1.5 * frame_time
seems good value and has been well tested. Higher values could be used and up to 1.95 * frame_time has been tested to work well (a/v corrections occur when necessary) but not has much sense use high values now because the main use case is TrueHD (due error oscillation) but now this is mitigated in #25229 and no visible frame skips/repeats with 62 ms.In general high values produces worse a/v sync because allows bigger stationary error (never corrected).
Users still may use high values via advancedsettings
but a log warning is printed if value is > 1.95 * frame_time.If any cases are discovered where accidental corrections continue to occur, instead of raising the threshold, the root cause should be investigated and reduce the error or noise in error, etc.
How has this been tested?
Runtime Shield
What is the effect on users?
For users who did not use advancedsettings it's a significant improvement because it prevents random problems because the value used could be too large
or too lowin specific (random) cases.For users who use advancedsettings nothing changes
but it is encouraged to use "better" values.Screenshots (if appropriate):
Two very different cases in which the value of 1.5 * frame time works well:
Types of change
Checklist: