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

feat: Handles case where we overflow void elements. #4

Merged
merged 8 commits into from
Dec 18, 2024

Conversation

damencho
Copy link
Member

Handles more tags and tracks.

@damencho
Copy link
Member Author

We heavily depend on the RandomAccessFile from FileDataWriter.

So I suggest dropping DataWriter, always using FileDataWriter, and getting rid of isSeekable.

@bgrozev WDYT?

@damencho
Copy link
Member Author

Well there is some logic behind isSeekable() ... my current changes may break that ... but works for our case though and I have added some tests that cover this.

@damencho
Copy link
Member Author

Looking at the code that I removed:

long len = tagsElem.writeElement(ioDW);
    if (ioDW.isSeekable())
    {
      new VoidElement(BLOCK_SIZE - tagsElem.getTotalSize()).writeElement(ioDW);
      return BLOCK_SIZE;
    }

Seems that the logic of isSeekable is that if it is not seekable you do not add void element, as you will not be able to seek and come back and fill it.
And the MatroskaFileWriter.close is processing the file only when isSeekable is true, so no problem there.

@damencho damencho force-pushed the fix-void-overflow branch 2 times, most recently from 141170c to f9753ba Compare December 18, 2024 00:40
It was skipping the void data.
for (int i = 0; i < 40; i++)
{
final MatroskaFileTrack nextTrack = new MatroskaFileTrack();
nextTrack.setTrackNo(i + 2);
Copy link
Member

Choose a reason for hiding this comment

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

The +2 is only necessary to make line 135 work? Can we simplify?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually no idea why it is there. I dropped it.

@damencho damencho merged commit b310849 into jitsi Dec 18, 2024
3 checks passed
@damencho damencho deleted the fix-void-overflow branch December 18, 2024 19:03
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