-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
mp4-remuxer / remuxAudio() : recompute mdatSize / dont rely on audioTrack.len #2096
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job. LGTM 👍
I'm not able to reproduce the issue with the problem stream with these changes. I also tested out these changes against the demo page assets and some other assets I have access to.
I have one comment/suggestion while reviewing the specifics in the diff, but I'm good with these changes as-is.
Worth noting I tested in Chrome 71 on macOS
src/remux/mp4-remuxer.js
Outdated
if (rawMPEG) { | ||
offset = 0; | ||
} else { | ||
offset = 8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering the value of rawMPEG
isn't changing in this function,
const rawMPEG = !track.isAAC && this.typeSupported.mpeg;
We could initialize the offset
value at the time of declaration:
let offset = ( rawMPEG ? 0 : 8 );
This would shorten up the handling here to be something like:
if (mdatSize > 0 && !rawMPEG) {
mdatSize += 8;
}
Thoughts/concerns?
src/remux/mp4-remuxer.js
Outdated
try { | ||
mdat = new Uint8Array(mdatSize); | ||
mdat = new Uint8Array(rawMPEG ? mdatSize : mdatSize + 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can reuse offset
here, allocated on L440
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
Just merged the Chai PR - you need to use |
recompute it by looping through all samples and summing their individual size get rid of track.len as it should now be useless related to #2063
just rebased / squashed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍
Going to test it out with some streams which threw this error |
* origin/master: (59 commits) Change networkDetails type to "unknown". mp4-remuxer / remuxAudio() : recompute mdatSize / dont rely on audioTrack.len (video-dev#2096) Typo fix for destory -> destroy. Change responseType to string Callbacks are defined, removing TODO. video-devGH-2082: Replacing usage of Array.prototype.find/findIndex (video-dev#2117) Reduce GC pressure from ID3._utf8ArrayToStr (video-dev#2035) (misc): converting binary search to typescript (video-dev#2129) (misc) Removing IE8-specific (dead) vtt/cue code Fixed case of 'They use hls.js in production!' header and updated Viacom image link to new domain and using https (video-dev#2127) remove events/EventEmitter && move Observer to ts (video-dev#2097) Basic typescript of event handler. Update webpack to use babel loader with support for TS. (video-dev#2119) Allow console statement in test bench and saucelabs code. Lint fixes Playlist Loader conversion to TypeScript. Playlist-loader rename. Change IV handling for initSegments to just log a warning. Add handling for AES-128 encrypted initialization segments needing IV. (misc) Adding ace editor to demo to enable advanced customization (video-dev#2077) ...
This PR will ...
Why is this Pull Request needed?
Are there any points in the code the reviewer needs to double check?
we might want to clone the problematic stream and add it to the test suite. if fine with the owner. thought ?
Resolves issues:
#2063
Checklist