Now the EbmlParser and DataViewReader types can accept BufferSource
objects to avoid the caller having to convert it at each callsite.
Change-Id: I527fbc638485214bfe976d7da89b79b6098033a8
This changes the network API to use BufferSource instead of ArrayBuffer,
which allows plugins to return a "view" on a buffer instead of the
whole buffer. This also adds some utilities for changing between
views and buffers.
Lastly this forbids the use of the "buffer" property of TypedArrays
since it doesn't work with partial "views". This audits and fixes the
usages of the "buffer" property to ensure correct usage.
It should be noted that both MSE and EME accept a BufferSource as input,
so we don't need to convert a "view" into an ArrayBuffer before passing
to it.
Change-Id: Iaa417773f8ce5304424e43c7372ce10ebf540d2a
Chrome has fixed their behavior involving endOfStream(), but both Tizen
and IE11 have the same broken behavior. Unfortunately these platforms
will likely never be fixed, so we need to keep this forever.
Fixes#1357
Change-Id: Id540170f8c8cb6e0ddf3a30bde5035016fa61df1
During startup, there was a race between the video element's ready
state and seeking to the requested start position. If the video
became ready before the seek to the start position, there could
briefly be 0 tracks. Reproducing this required a first period start
> 0 and a start position > 0, such that a lookup of the "current"
period during this brief window would return null.
The problem was more likely to be seen on Chromecast, where the time
between load() and the completion of a seek was much larger than on
desktops.
The bug was caused by Playhead, which both seeks to the start position
and manages the concept of "current time", returning the start
position during startup and the video element's position thereafter.
This fixes the race, making sure that startup is not considered
complete by Playhead until the initial seek is over. This adds an
appropriate regression test and simulated content that can reproduce
the conditions in the original bug report.
Fixes b/138941217
Fixes#2045
Change-Id: Ie8a57283468d88697619349a29e37a804586e5ef
According to the style guide, protected members should not end with
an underscore. This renames them to fix it. This also marks some
members as private that aren't used outside the class. Lastly, this
fixes a possible bug with the use of "this".
Issue #1553
Change-Id: I6c7ecdcd228ec4e4aded4af52e2262d0bf5beaf4
This adds a separate configuration value for this because (a) the HLS
parser can't access the streaming configuration and (b) this behavior
is different in that the streams are removed instead of just not playing
them.
Closes#2065
Change-Id: Ic9b1e0d40b161cd4ba0eb6d7c922882112034626
- Use <code> blocks.
- Use <p> to separate blocks (since newlines in comments are ignored).
- Use <ul> for lists.
- Give messages for deprecated tags.
Change-Id: I06d5e0e75eb3e498063cf0c291e6031af5d93b2d
Our previous approach:
For every variant tag, find the associated media tags(with the same
group id), create stream info for each media tag, and then create stream
info for variant tag based on that, and create variants.
This approach has duplicate calls for the media tags with the same group
id to create stream infos.
New approach:
1. Get codecs from variant tags
2. Create stream info from each media tag (with the codecs from variant
tags)
3. Create stream info for each variant tag, and then create variants.
This creates stream info for each media tag once, and avoids duplicate
calls to guess the codecs.
Issue #1558Closes#2066
Change-Id: Icdf3133b1b15d1baf60624ff449e0a61fdb78d8a
Now there is a generic callback to transform the init data before
passing it to the browser. This can be used by apps to use a custom
content ID in FairPlay content. This also adds some utilities to help
in writing these functions and moves the default behavior to DrmEngine.
Closes#1951
Change-Id: I78ce660c126b53a69d5f55b16775ffcdbbe4d748
This allows a request/response filter to determine which EME session
made the request. This also changes the session ID of FairPlay sessions
so they are available too.
Issue #1951
Change-Id: I1a07abae6faf4a87fad7b5d4290a00b25e83da8e
This reverts commit 6e5a0797de, #2042.
The PR as it landed broke some test cases and functionality for storing persistent licenses, and it doesn't seem to work even for its intended use case.
To prepare for flattening out the manifest structure to remove
periods, this change moves initSegmentReference and
presentationTimeOffset fields into the SegmentReference object. This
way, the segments on either side of a period transition or HLS
discontinuity can have different offsets or init segments, eventually
allowing us to create a single array of SegmentReferences for
multi-period content.
Issue #1339
Change-Id: Ic7eff0483789644881247ecf8044c5fb6a48f0e6
* fix: Reference issue with SegmentReference createUris
* test: Added Segment GetUris Test for timeline
* feat: Get PSSH from segements if not initdata exists
* feat: Get PSSH from segements if not initdata exists
* fix: JSDoc comments and moved drmEngine update to storage
* fix: Remove comments
* fix: Remove unused import
* fix: Lint erros and dedup initData code
* fix: remove no init data test and add check for use persistent license
It turns out that, on some browsers, incomplete XML does not properly
parse. This means the parseFirstCue tests did not work on those platforms.
This modifies those tests on platforms that do not support partial XML;
when no support is detected, it instead tries to get the first cue
from a non-partial segment.
This also modifies the HLS parser to only load partial text segments if
the text parser supports it; otherwise, the hls parser will load full
captions in order to extract start times.
b/137945635
Issue #2037
Change-Id: I58112864a818baf155b365a65fba1c8a56eb9520
MediaSource throws if endOfStream() is called when
its readyState is equal to 'ended.' This happens if
endOfStream() has already been called.
This change ensures that we don't try to call endOfStream
on the MediaSource that has already marked as 'ended.'
Closes#2050.
Change-Id: I2672b297f0ebb7fd67afcf72ee52df6d5bacf761
1. Make createPeriod_() and createVariantsForTag_() clearer to read.
2. Simplify and remove duplicate code.
Change-Id: Idda7cb40f33905afd9512d427d7e78cb6c96ede9
In a recent refactor that made some internals of DASH parsing async for the first time, we broke the creation of SegmentReferences by having createUris close around values that changed later. This fixes the bug and adds a regression test.
Previously, when the text engine tried to load the start time of
a segment, it would parse every cue in that segment, then check the
time of the first cue. This was judged to not be a significant
performance issue, as parsing cues is a fast operation. However, it
did have an unintended side-effect: in some situations, this method
was being passed partial segments; notably, the HLS parser would load
the first 2048kb of the stream's texts to extract timing data.
If the caption parsers tried to actually parse an incomplete caption,
they would error.
This gives the text parsers "parseFirstCue" methods, and uses those
methods when it only needs the first cue anyway.
Fixes#2037
Change-Id: I2a1fb2f1a96d98967f0c6e6a5c277914a28b42ad
The Chromecast MediaSource polyfill was broken in "Avoid integer for
loops", Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7.
This particular loop used to start at index 1, and the previous change
made it start at 0. Because of a test infrastructure failure that
prevented testing on Chromecast, we missed this mistake.
This bug did not affect any release versions.
This fixes the bug by using shift() to remove the first item before
the loop, instead of [0] to access it in-place.
Change-Id: I3aa53436e23a1b389375df2b06b3bbbab18ecf0b
This trims the textContent containing the base64 code of the subtitles, to avoid trying to decode newlines and other whitespace as part of the base64-encoded data.
Fixes#2028
This field is typed to be a non-nullable string, but the compiler was
ignoring this type since it was defined on the interface. A new
version of the compiler caught this error. Originally cr/257309718.
Change-Id: I9e7589c3b059ca39324078c867dbc27f3742a095
To prepare for an upcoming change to the format of the data stored in
IndexedDB, refactor the storage cells to remove common functionality.
This will make it easier to add a third cell type.
The format will change as we move fields in the manifest structure and
ultimately flatten out periods.
Issue #1339
Change-Id: Ibaeb35596180b2e2362b4d53734019599d6fff77
This was broken in "Replace find/get callbacks with SegmentIndex"
because automated tests for SegmentBase did not cover multiple
Representations with different index/init ranges. Once the parsing
became async in the previous change, the index information was being
pulled from the last Representation parsed, rather than any specific
one.
This fixes the issue by making a shallow copy of the parsing context,
as was already done for SegmentTemplate.
SegmentList is synchronous, so it was not affected.
Issue #1339
Change-Id: I09c606c464b49c99d35d1031734b64872cfa6599
This replaces find/get callbacks in Stream with a SegmentIndex. With
the exception of DASH's SegmentTemplate+duration, all manifests were
already backed by SegmentIndex. Now, all manifests are backed by
SegmentIndex. This will simplify Period-flattening, in which all
tracks will be represented by a list of segments, some of which come
from different Periods.
The SegmentIndex in Stream will not be created until
createSegmentIndex is called. Prior to this change, the find/get
callbacks could be invoked without createSegmentIndex() in some cases
(excluding DASH's SegmentBase), which some lazy tests took advantage
of. Now that find/get are methods on SegmentIndex, createSegmentIndex
must be called in all cases. The tests have been updated accordingly.
Making SegmentIndex generation async in all cases exposed some issues
with the parser context being modified in-place between one
Representation and the next. So the parser now makes a shallow copy
of the context before it is bound into an async callback.
To facilitate updating the SegmentIndex for SegmentTemplate+duration
content, SegmentIndex now has a method to update its list on a timer.
Once per segment duration, the index will be updated to add and remove
SegmentReferences.
The initial expansion of SegmentTemplate+duration will be limited to a
relatively small number of segments, to avoid excessive CPU or memory
consumption. This defaults to 1000 segments, but is configurable.
Issue #1339
Change-Id: I99c007b1096c3b396d04a729750cd7b743cb899d
In the DASH parser, if there was no suggestedPresentationDelay and
ignoreMinBufferTime was set to true, the parser would set the
presentationDelay to NaN. This was because Math.max() will return NaN
if undefined is passed into it.
This changes minBufferTime to default to 0, if ignoreMinBufferTime is
true.
Fixes#2015
Change-Id: I8fc61706a04d14fd729e2185ce993a8bc87e48e5
This fixes a TODO and fixes setting the "active" track when switching
languages when not displaying text.
Fixes#2010
Change-Id: Ic4cf4126ffb9b93a09af998e20f9da0e7af852fb
This is a helper to aid in iterating over items. This returns a list
of objects that contain:
- "item": The current value.
- "prev": The previous value in the list.
- "next": The next value in the list.
- "i": The zero-based index in the list.
Issue #1518
Change-Id: Id18ab977e3ae45dfbfd2b4137a1bffb6e53c6bce