-
Notifications
You must be signed in to change notification settings - Fork 373
Fix: Fix ignored test cases #530
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
base: main
Are you sure you want to change the base?
Conversation
|
On unrelated note, |
|
Thank you for the PR. We're you able to investigate the issue with the last ignored test? Anything you'd like to share? |
|
@DenizUgur
The issue can be solved by calling appendBuffer with dummy empty buffer with filePosition at expected box end during flush. flush() {
Log.info('ISOFile', 'Flushing possible remaining broken box data and remaining samples');
const dummyBuffer = MP4BoxBuffer.fromArrayBuffer(new ArrayBuffer(0), this.lastBoxStartPosition);
this.appendBuffer(dummyBuffer, true, true);
}
appendBuffer(ab: MP4BoxBuffer, last?: boolean, dummy?: boolean) {
let nextFileStart: number;
if (!this.checkBuffer(ab, dummy)) {
return;
}
/* Parse whatever is in the existing buffers */
this.parse();
....
}
checkBuffer(ab?: MP4BoxBuffer, dummy?: boolean) {
if (!ab && !dummy) throw new Error('Buffer must be defined and non empty');
if (ab.byteLength === 0 && !dummy) {
Log.warn('ISOFile', 'Ignoring empty buffer (fileStart: ' + ab.fileStart + ')');
this.stream.logBufferLevel();
return false;
}
Log.info('ISOFile', 'Processing buffer (fileStart: ' + ab.fileStart + ')');
....
}But I don't really like this approach. |
|
I haven't looked into the problem so I don't have any strong opinion but appending a dummy buffer feels wrong. |
|
There's also some additional issues present, that are not covered by conformance tests:
/** @bundle writing/sbgp.js */
write(stream: MultiBufferStream) {
// if (this.grouping_type_parameter) this.version = 1;
// else this.version = 0;
this.flags = 0;
....
}
|
|
@plantysnake These are really good observations. Thank you. Could you make a separate PR with your proposals? I'd like to keep this PR dedicated to fixing conformance files. Maybe the last commit you did can be moved there as well? |
|
Sure thing, will do |
Description
Fixed all ignored failing conformance tests, excluding video_2500000bps_0.mp4, as it seems to have broken second mdat (MPEGGroup/FileFormatConformance#131)
Mehd - ISO/IEC 14496-12 8.8.2.1
So, field should be optional/nullable. Found during testing segmented files with file-segmenter demo.
Stsz - ISO/IEC 14496-12 8.7.3.2.2
So, during write, we do not want to check
sample_sizesvalues themselves, but rather we want to check ifsample_sizeis 0.Parser's parseOneBox logic for size === 0 without parentSize and box 'mdat' didn't actually assign new value to size. This was fixed.