-
Notifications
You must be signed in to change notification settings - Fork 15
Add lossless DTS timestamp repair and verify reclassification #833
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f30abf0
Add lossless DTS timestamp repair and verify reclassification
ptr727 a03859e
Log DTS repair decision at Warning and clarify verify docs
ptr727 f87b27c
Guard closed-caption JSON parse against malformed ffprobe output
ptr727 e6cd4d0
Make verify failures diagnosable
ptr727 7726c5a
Mark a failed lossless timestamp repair as RepairFailed
ptr727 88cc663
Document that setts timestamp repair is intentionally audio-only
ptr727 d2bf1c2
Do not require a video stream for the audio timestamp repair
ptr727 87a375d
Update stale lavfi comment to analyze_frames
ptr727 df335f1
Require a clean re-verify after re-encode repair
ptr727 a8d6648
Treat any non-zero ffmpeg verify exit as a failure
ptr727 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| namespace PlexCleaner; | ||
|
|
||
| public sealed class DtsInfo | ||
| { | ||
| // Last DTS seen per stream index | ||
| private readonly Dictionary<long, double> _lastDts = []; | ||
|
|
||
| // Count of non-monotonic packets per stream index | ||
| private readonly Dictionary<long, int> _nonMonotonicByStream = []; | ||
|
|
||
| // Stream indexes carrying a non-monotonic DTS, with the per-stream count | ||
| public IReadOnlyDictionary<long, int> NonMonotonicByStream => _nonMonotonicByStream; | ||
|
|
||
| // True if any stream carries a non-monotonic DTS | ||
| public bool HasNonMonotonicDts => _nonMonotonicByStream.Count > 0; | ||
|
|
||
| public void Add(FfMpegToolJsonSchema.Packet packet) | ||
| { | ||
| // Fall back to PTS when DTS is absent, matching how the muxer derives DTS | ||
| double dts = !double.IsNaN(packet.DtsTime) ? packet.DtsTime : packet.PtsTime; | ||
| if (double.IsNaN(dts)) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| // Flag a non-increasing DTS relative to the previous packet in the same stream | ||
| if (_lastDts.TryGetValue(packet.StreamIndex, out double previous) && dts <= previous) | ||
| { | ||
| _nonMonotonicByStream[packet.StreamIndex] = | ||
| _nonMonotonicByStream.GetValueOrDefault(packet.StreamIndex) + 1; | ||
| } | ||
| _lastDts[packet.StreamIndex] = dts; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.