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

Inspector-js v2.0 #17

Open
wants to merge 199 commits into
base: master
Choose a base branch
from
Open

Inspector-js v2.0 #17

wants to merge 199 commits into from

Conversation

tchakabam
Copy link
Contributor

No description provided.

we are crashing the Chrome window on AAC mdats
meanwhile the worker thing should just be optional in the same index
worker can be shipped inline with webpack btw (see worker-loader)
…rames per PES, fix timing alignment on PUSI + code style fixes and naming precision
… timestamps (was causing garbage to get into payload buffers and skip frames / loose sync)

+ change appendData impl to read right after every append instead of only on next PUSI (would increase demux latency by one frame unnecessarily)
+ add getStreamTypeName to resolve ES type enum to string name
+ assert PES header start code (to verify TS packet completeness)
…press this function parses not only timestamps but handle whole ext header)
…rate lookup back in order instead of deferred
… class, add comments and docs and code style fixes (private method prefix)
…tainer impls etc). better for perf than doing string comparison also.

+ remove getter for types in track to make the class more lightweight
…ort CRC case + misc code quality improvements without functional changes

+ various comments for comprehension sharing
…+ add TS_STREAM_TYPE_PACKETIZED_DATA + correct value for METADATA entry

(value for metadata type was the one actually used for packetized-data)
…mes should be appended the right order ITFP, and re-order on every append seems very unlazy for such an edge-case.

rm update-tracks calls around all other demuxer impls, rename enum to MpegContainerType, fix method prefixes, rename to _parseTsPackets + disable RAW AAC support in container type detection (see comment, should be support by own demux, and as this is mostly an HLS corner case)
… by getter in either subclass, to be able to debug and plain serialize the generic object type. has us remove also remove getFrames overload in TSTrack
…ting _lastPusiFramesLen = 0 it was wrongly set to the remainder frame list len (which would make any sense but work by change in most cases,

where this was 0 then anyhow). the bug would cause the segmentation to come out of pace of the actual payload buffer.
…ith default to false, see commit description below ie comment in code.

// some popular encoders set this to MPEG2 still, even though sending AAC.
// performing the assertion (that expects MP4A compliant i.e unset),
// will then lead to an error and failure to parse every frame then.
// by default we skip this assertion to be more tolerant of either encoders,
// and assume payload advertisement is done in PMT either way and content
// validated/detected to be AAC downstream further anyhow.
// Therefore:
// Only enable this, if you know you need the parser to fail on input data where the bit is set wrongly.
…the constant range to comply easily with mp4 remux, as we use audio samplerate on the ADTS frame output side. see below for more details.

    MPTS has a larger bitfield for timestamps (33 bit) than what fMP4 allows to feed into MSE (32 bit). That wrapover happens by itself as we create mp4 with mpts 90khz timerange and use the exact same numbers
    however here we are using audio samplerate timescale, for the audio only for the video we still use the mpts clock.
    now, that would be causing the wrapover to play out differently since for audio and video
    => Solution now we compute the wrapover properly when reading the PES and so even if the audio time gets calculated to be sample-rate precise it stays in the same plane
TODO: make the default false (should generally not do such opinionated op on timestamps), and/or also propagate the option to Demuxer handle constructor.
…alue is passed into every PESReader (for each track created). Thus value changes only applies to tracks created after mutation.
…CTO we only need the diff that is performed in JS number land + add default const for initial prop setting on demuxer class
…void printing frame data buffers when serializing)
…ded anymore); replace with mpegClockTimeToSecs plain computation
…ror that eases any debugging in case needed showing DTS/PTS in seconds as well as in clock ticks (not recomputing for actual assignment of CTO)
…. 1) lastByte assignment has to be priorized properly within wrapping operation 2) byte 14 instead of 13 was read whilst not using lastByte reg.

Thus the wrong LSB was read for PTS = DTS, but also reading 1 byte more than we should, and finally causing the read offset for PTS != DTS to be 1 byte forward than expected. that extra offset was however not causing transport level packet skip issues as the remainder length was and is computed invariable to the number of read bytes (see end of func).
…getter that returns clone (via obj spread) to class users, rename TSTrack class to MpegTSTrack, add numberOfTracks, add MpegTSTracksHash type export
…t presence of NIT entry at first position in PAT (was mistaken for program-map PID). Centralize and breakout generic PSI syntax header parsing to static.

simplified overall parsing calculation via the prior addition + rename private member to _programMapPid + added documentation on various header/table specs (from Wikipedia) and other helpful comments to not get lost here anymore.
@tchakabam tchakabam changed the title version 2.0 Inspector-js v2.0 Oct 1, 2022
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