Commit Graph

24 Commits

Author SHA1 Message Date
Jacob Trimble fd0dc8a5cc Add utility for looping from 0 to n.
Closes #1518

Change-Id: I865f7a0311516d04ae84532dab873e1aaa31eb24
2019-07-10 21:23:22 +00:00
Jacob Trimble 5c35108cb8 Avoid integer for loops.
Issue #1518

Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7
2019-07-09 17:11:49 +00:00
Jacob Trimble 43e798870f Misc ES6 conversions.
Issue #1157

Change-Id: Ia25a6cae84575f003980e9694b2769f2976e1342
2019-06-03 15:31:57 +00:00
Michelle Zhuo ebdf9d7817 Update Util files to ES6
Issue #1157

Change-Id: Ib81d198e46bc57745f60af328d1160064e253ba3
2019-05-30 16:40:49 +00:00
Jacob Trimble d5780d401b Fix line length issues for indent fix.
Change-Id: I87d75fd88000f8f9bff7b9f1bf5667ba28f6dd60
2019-05-13 22:31:20 +00:00
Jacob Trimble f130dffcef Enable eslint indentation rule.
This is a fully automated change.  The linter will fail because the
extra indentation caused line-length errors.  These won't be fixed
automatically.  They are fixed in a follow-up to make this one fully
automated.

Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
2019-05-13 22:31:09 +00:00
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Theodore Abshire 038688ffa6 Don't error when skipping mp4 boxes with bad size
In some situations, the mp4 parser might be required to read a box
that has a "size" value that is longer than its actual size.
For example, if there was a partial range request that ends in the
middle of a box.
Obviously, trying to READ a box like that would be a bad idea, but
if the box is going to be skipped anyway, skipping it without an
error is probably not harmful.

Closes #1535

Change-Id: I31d4c00426e6127ef6e1492e9edc7e10ac50ec8b
2018-08-14 20:08:12 +00:00
Theodore Abshire 0726543a04 Made ParsedBox into an extern
The ParsedBox structure used by the Mp4Parser, previously, had
its property names changed in compiled mode.
This makes ParsedBox into an extern, so that it will be preserved
unchanged in compiled mode.

Closes #1522

Change-Id: I0964f8a4b9ccea57c61e2c587a776ed76cfbc8da
2018-08-06 22:10:40 +00:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44:56 +00:00
Michelle Zhuo 535de4db84 Refactor: Remove underscore from parameter names
Change-Id: Ie9e6fb59763f454f245175f23c6444f919ba8135
2018-05-08 19:21:51 +00:00
Joey Parrish 772dc231c9 Remove non-nullable on implicit non-nullable types
This is a style cleanup to pass stricter checks from future versions
of the Closure linter.

Change-Id: Icca8f974af7c9f4834acf6bba69e4cef1f89e502
2018-04-09 14:52:59 -07:00
Theodore Abshire 8ea237c214 Fixes how the MDAT is read for VTT in mp4 content.
Previously, we would read each individual VTTC and VTTE box in the
MDAT and associate them with durations in the TRUN. This worked for a
lot of content, but if sampleSize is defined in the TRUN, a duration
might refer to multiple VTTC boxes.

This changes the VTT in mp4 reader to parse the MDAT based on the TRUN,
to account for such situations.

For the moment, this only accounts for a single MDAT, and assumes that
the MDAT contains nothing but vttc or vtte boxes, listed in order.

Issue #1266

Change-Id: I56e310d085abdda16e968761ed3b4fd0cc5e24d0
2018-03-27 17:10:48 +00:00
Theodore Abshire 7c5186332b Typo fixes and rewording in comments, part 7
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.

This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.

Change-Id: I225f5c7e54adf4cca8512cddae082ba50ed82e4e
2018-03-21 19:45:15 +00:00
Jacob Trimble f70436540c Convert 'var' to 'let'/'const' (3 of 9).
This is part of a change to convert all usages of 'var' with either
'let' or 'const'.  This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.

Change-Id: I10f5c38a8b06b5797c6eec7492829084114514c9
2018-02-14 00:47:03 +00:00
Niklas Korz 284f19fe75 Fix documentation typos (#1272)
* Add a missing word in ManifestParser comments
* Fix a typo in a comment in mp4_parser.js
2018-02-03 14:11:49 -08:00
Joey Parrish 88857c59aa Fix HLS playback where moof box is larger than 1k
When we started fetching partial HLS segments to find the start time,
we were no longer able to start playback for content with a moof box
larger than the partial segment.  This is because we parsed the boxes
hierarchically, which required the entire payload.

Now, we can selectively instruct the parser to tolerate a partial box
if the part we have includes the child box we are looking for.

This fixes playback of several pieces of HLS content in our demo app.

Change-Id: I956c8b8905dc9f1707f2b24b8248b984b1c036c6
2017-11-13 10:48:27 -08:00
Joey Parrish a93455a917 Make partial segment requests in HLS parser
This speeds up HLS stream startup significantly for servers that
permit this kind of request, and falls back to full segments for
servers that do not.

Closes #1106

Change-Id: I96bc7f0df0fb84b75f3a3fe43476ba0ba5fc2264
2017-11-07 19:44:35 +00:00
Jacob Trimble d125a54656 Use Uint8Arrays in text parsers.
This converts from using ArrayBuffer in the text parsers to using
Uint8Array.  This avoids doing extra buffer copies when using
ArrayBuffer.slice().

Closes #1022

Change-Id: I34a789ec4eb76c95169ba81f27a8433ef25f27f0
2017-10-03 10:36:48 -07:00
Aaron Vaage ca87772a60 Define Mp4Box Using Strings
When defining a box, the box would be defined as a four
byte integer. Now there is a "fromString" function that
can be used to convert a four character assci string to
a four byte integer.

Change-Id: I78c704e012620c94ae681efb450977305bdb84aa
2017-03-22 23:13:24 +00:00
Aaron Vaage e50d01e03c Correcting Times for MP4 VTT Subtitles
Before the segment start time and end time were used to determine
the start and end time for all subtitles that appeared in the MDAT
box. The time values for each subtitle is specified in the TRUN box.

Now the time values are extracted from the TRUN box and mapped to
the correct subtitle in the MDAT box.

Closes: #699

Change-Id: I7179874aee7b617e994b136d17a082060ab1a0d2
2017-03-21 17:54:22 +00:00
Aaron Vaage 175870fb4d MP4 Parser Refactoring
Before parsing Mp4Boxes was done using the "findBox" method. This
was limted to only looking at one level of the structure and
required a large amount of code to dig deeper into the structure.

This change creates a generalized Mp4 Box parser that should
simplify parsing Mp4Boxes. This will help work on #699.

Change-Id: Ie67ff30a6db890cae16fe02ae9c92bca711815a9
2017-03-16 22:46:19 +00:00
Jacob Trimble fc46b29ed8 Move 'emsg' handling to StreamingEngine.
Rather than having it in the DashParser as a network response filter,
we should have it in StreamingEngine.  This will give it access to the
segment times so we can calculate the presentation times for the event.
Otherwise, there is no way to know when the event should actually occur
since the app can't know which segment is being downloaded or which it
came from.

This also adds startTime and endTime fields to the event so the app
doesn't have to calculate them.  For reverse compatibility, the old
fields will still exist.

Closes #698

Change-Id: Icbaf3619aedfca7ea06bc8b1fe49e9cce65b0cc2
2017-02-23 19:36:06 +00:00
Sandra Lokshina 8b767df6a1 Implement parsing for WebVTT subtitles embedded in mp4.
Closes #277

Change-Id: If74bb81b66a78939b4f87e4f9f793328d50ed069
2016-07-18 23:52:56 +00:00