Skip to content
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

Various fixes #3

Merged
merged 7 commits into from
Oct 21, 2024
Merged

Various fixes #3

merged 7 commits into from
Oct 21, 2024

Conversation

damencho
Copy link
Member

This pull request includes several updates to the Matroska file format handling in the src/main/java/org/ebml/matroska directory. The changes primarily involve the addition and removal of elements in the MatroskaDocType enum and the corresponding MatroskaDocTypes class, as well as updates to methods for writing and updating Matroska file elements.

@damencho damencho force-pushed the fix-cues branch 5 times, most recently from 3de34a4 to edcc217 Compare October 21, 2024 13:26
We used to add only the track of the current frame when flushing, so it does not guarantee all tracks inclusion. With current approach we will have in a cluster all tracks on their first frame added.
}

boolean addCue = !cluster.getTracks().contains(frame.getTrackNo());
Copy link
Member

Choose a reason for hiding this comment

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

The isSeekable check was removed

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed it.

@@ -53,7 +53,7 @@ public class MatroskaFileTrack
private boolean flagEnabled = true;
private boolean flagDefault = true;
private boolean flagForced = false;
private boolean flagLacing = true;
private boolean flagLacing = false;
Copy link
Member

Choose a reason for hiding this comment

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

I think this defaults to true in the spec, and it seems like a safe default (the track MAY contain blocks using lacing, while false asserts that it doesn't). Why change it? If we want it false for our case we should probably set it in jmr

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 will drop the commit.

@@ -53,6 +54,8 @@ public class MatroskaFileWriter implements Closeable

private long clusterLen = 0;

private long lastDuration = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Suggest renaming to duration or segmentDuration

defaultDuration = tr.getDefaultDuration();
}

lastDuration = cluster.getLastTimecode() + TimeUnit.NANOSECONDS.toMillis(defaultDuration);;
Copy link
Member

Choose a reason for hiding this comment

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

This assumes that the first timecode is 0, and that frames from all tracks are always added in order (e.g. addFrame(track=1, timecode=1000); addFrame(track=2, timecode=900) is handled incorrectly and we may end up using something like that after buffering in jmr).

I suggest just saving the smallest and largest timecode of all frames added to the segment, then setting duration to the difference. cluster.getLastTimecode() is always just frame.getTimecode(), so no need to expose it

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed that, thanks.

@bgrozev bgrozev merged commit 09e9281 into jitsi Oct 21, 2024
3 checks passed
@bgrozev bgrozev deleted the fix-cues branch October 21, 2024 19:05
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.

2 participants