Added a preferred audio channel count to configuration, default set
to 2.
Choose the codec with the largest number of audio channels less than
or equal to the configured number of output channels. If this is not
possible, choose the smallest number of channels.
Closes#1013.
Issue #1071.
Change-Id: I6c6a956e33637cf34bd4bd79af563dc10a595e94
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
Google style guide requires adding curly braces to all block statements
even if it is only has one line. This fixes it by using eslint's
--fix flag followed by running clang-format to reformat the change.
Change-Id: Idc086c2aa8c02df5ef8b2140a11bfb9128eeb4bd
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
Beforehand, if there were some text streams with a given language
which had a role, and some which did not, the no-role text streams
would never be chosen.
Now, they are chosen if there is no preferred role.
Closes#1212
Change-Id: I28b426304b1a828f500012425b8d89c94ccc3178
Before, filterStreamsByLanguageAndRole would take a period, this changes
it to take an array of stream to better match the function name.
Change-Id: I4621f98ff17d8d1c3c95162217eef9b8cf7aaebc
Before, filterVariantsByLanguageAndRole would take a period, this changes
it to take an array of variants to better reflect the function name.
Change-Id: Ic090baf4a281798ec855e369b0b4acdf519fee14
To prevent us from packing and unpacking audio and video from an object
this changes filterNewPeriod to just take audio and video rather than
a map.
Change-Id: I152f2b1762d4ff9ce21cb5b501579bca315e4e4a
Originally some of the logic in Stream Utils was iterating over elements
manually and doing its own splicing and index manipulations. This changes
it to use array.filter so that the logic is simpler.
Change-Id: I2a8d1db9336a574e0992e0de430afd006dea4846
There were two functions is stream utils that were used to check
for compatibility. However they were named as statements, and this changes
them to be named as questions.
Change-Id: I0ca7e4a6597910a8f65192c50b9def895e2ac437
Some platforms (such as Chromecast) support extra MIME parameters like
framerate, bitrate, width, height, and channels. Since other
platforms will ignore these extra parameters, we should always query
using these parameters.
This introduces the framework to construct these "extended" MIME types
from Stream objects. Extra parameters for other platforms can easily
be added later.
Change-Id: I8936ca93e84068da18f12127fbc8fc1a0646695a
Previously "UNPLAYABLE_PERIOD" exception is thrown when a browser
doesn't support the container or codecs in a piece of content, which is
confusing to developers and customers.
Changing it to "CONTENT_NOT_SUPPORTED_BY_BROWSER" exception.
Test manifest:
https://media-ci.foxford.ru/dist/hls-issue/issue.master.m3u8Closes#868.
Change-Id: Ied135b687190919abbeb1561c2bff36a7203136e
While I set out to fix failing assertions during playback, I found
many more changes necessary to clean up the code and make things more
consistent.
When we changed switch history to include variants instead of streams,
we broke the filtering logic that is applied to the history. This
caused assertions at runtime that were not caught by the tests.
This moves the filtering logic to addToSwitchHistory_ and makes it
aware of variants. It also adds a regression test that would have
caught the assertions.
This fix affected many other tests, though, which necessitated other
API changes and cleanup.
Many interfaces are simplified, as is switching logic in Player. The
data flow is also easier to follow, since there are fewer transitions
between variant and stream. Everything up to StreamingEngine uses
Variants, and StreamingEngine uses Streams internally.
- All stream-based interfaces on AbrManager replaced
- switch callback takes a variant
- chooseStreams replaced with chooseVariant
- setTextStreams has been dropped
- Player maintains compatibility with old interfaces until v2.3
- Most stream-based interfaces on StreamingEngine replaced
- onChooseStreams callback to Player returns variant & text
instead of a stream map
- switch was replaced with switchVariant and switchTextStream,
both of which delegate to switchInternal_, which is largely
unchanged from the original switch method
- still has getActiveStreams, which I hope some day can become
getActiveVariant and getActiveTextStream so Player no longer
has to convert anything
- Most stream-based logic in Player replaced
- deferred switches map broken into variant and text members
- switch history logging broken into simpler variant and text
methods
- simplified manual and automatic track selection logic using
new AbrManager and StreamingEngine APIs
- player no longer filters duplicate selections, StreamingEngine
handles that
- replaced one case of deferred switches with an assertion
Closes#954
Change-Id: Ia49f6ffb9c5fa13ed8790dd03eeeded5122f7683
Adding the count of channels, as a new field for tracks and streams.
Used for HLS audio tracks.
Resolves#826.
Change-Id: I1448b4a8cfaf6dd798670bb2f0f3981d6c7e40c3
Exposing the roles of tracks, which come from the manifest, in the
select audio language method. This is a follow up on commit
b27861050c11451db57d87270ec1385c1906627a.
Closes#767.
Change-Id: Iebb873f1db8834c7275a8a9fc01c3b855c0288aa
This change creates a lib/text directory and moves all files
with text-related logic to it. It also lays the ground for
separating text parsing and display logic. (That change will
introduce even more files with text-related logic which will
crowd lib/media directory).
Issue #796.
Change-Id: I65ac134020a0126ff02a8f2067beb73870232e65
This change is to expose an audio track's role in order to differentiate
among a main / caption / commentary track that shares the same
language.
Issue #767.
Change-Id: I05d38cba2170d0005611cf160b7ae45996fe77dd
The audio and video codecs were combined in Track, so it's hard to
detect whether the track variant has video or audio track.
Changing the combined codec to two separate fields.
Closes#758.
Change-Id: I9fbd0b85830cac306dc09db2d71cf96f77146cbe
This adds the new configuration options that will be used in gap
jumping. This also changes Playhead to accept the config over the
rebuffing goal directly.
Issue #555
Change-Id: I467690ad1f417e69634087e04e0b44c98e1c9b81
By default, we will now store all text tracks, regardless preferences.
This not only helps with our demo, but makes sense for applications
that have not bothered to configure the track callback for offline
storage.
This also fixes bugs in the default track selection algorithm,
changes the default audio track selection to fall back on primary
variants in cases where the audio language preference cannot be met,
and adds tests for the default selection algorithm to verify correct
behavior.
Change-Id: Iead0499039e9ec596514aa7577265a7472914621
Before, we would select every variant when there was no preference
or primary tracks. This meant that AbrManager could adapt between
different languages. Instead, we should select an arbitrary language
initially so we only adapt within one language.
b/36094412
Change-Id: I4670a8bf02683fb78cfe572992c6268ed32e649d
Before, the Player would query StreamingEngine for the "active" streams.
The Player would use this to set the |track.active| field. However,
this causes problems with multi-Period content. Once StreamingEngine
has buffered through a Period transition, it will report the active
streams from the new Period. This will mean that in
|player.getVariantTracks|, none of the tracks will be active.
Now, Player will track the IDs of the active tracks for every Period
so it can correctly report which tracks are active.
Closes#680
Change-Id: Ib5ffc88b32e165f088e6472930eeb1b29b5adfe9
Before, we would fire a 'trackschanged' event when StreamingEngine
asked us to select streams for a new Period. However, this is not
when the tracks change, they change when the playhead moves into a
different Period.
This adds code to Playhead to track where the current Period is and
raise an event when it changes. This also reduces any extra events so
a 'trackschanged' event is only fired when the tracks actually change.
Issue #680
Change-Id: I85aedaed737f9324d5871201d952066886ea290c
Add UI options to select current audio and text language.
Split selectTrack() into selectText() and selectVariant().
Stop automatically disabling ABR manager when a variant is selected.
Add a warning if selectVariant() is called while abr is enabled.
Issue #412.
Issue #626.
Change-Id: I15f1c3c4fdc6d6b641f708fbef19dbcf10cbcfc6
This adds a second Restrictions object to the Player configuration to
restrict ABR decisions. The original restrictions will remove any
non-matching streams from the manifest, like before. This new
configuration will only apply to AbrManager choices. Any restricted
track can still be explicitly selected using Player.selectTrack.
Closes#565
Change-Id: I52379b096e81f97df22b6683669c5787694d87e7
During recent refactoring, we introduced a bug in which we would
filter out any text stream with a non-empty codecs parameter.
Replaces PR #639
Change-Id: I9a45ef7e1bc250fd989e3972c0670f3e48336511
The DASH parser was not always correctly deducing the content type.
For unspecified content types, the type can be deduced from the MIME
type. For example, video/mp4 is video, and audio/webm is audio.
For text, things are a little more complicated. Text types do not
always start with text/. In particular, embedded text, such as VTT
in MP4, have a MIME type that starts with application/mp4.
To deal with that, if we see an unknown type, we ask TextEngine if it
supports it. If so, we deduce that the content type should be text.
This check against TextEngine was only happening for MIME types
specified on the Representation, but not on AdaptationSet. This
replaces a weaker deduction in the general frame parser with the same
TextEngine check we were using elsewhere.
Furthermore, Player mishandled the content types it passed to
AbrManager. AbrManager will only choose audio, video, and text
streams. It ignores all other types. Player, meanwhile, threw a
confusing error if AbrManager failed to choose some of the types
passed to it. Therefore, Player should only pass audio, video, and
text types to AbrManager.
This fixes both issues and adds new unit tests for both.
Closes#631
Change-Id: Ib1311d37d00c3989367fd066f66e1eba85652e40
Text parsers can easily be changed during playback, unlike the
browser's media decoders. Whenever we change text tracks,
reinitialize the text parser.
This also removes restrictions on text tracks of different types
when we filter manifests.
Closes#571
Change-Id: I3c243dde951cd04554c2fa1be2c8ebf06988791b
Type compatibility checks are important for multicodec or
multicontainer content, and there's no good reason to exclude text
from those checks. The new Axinom v7 test vectors have multicodec
text (both mp4+VTT and mp4+TTML).
Change-Id: I999aaf5b37cda8a9243538b4dd21c503df33dcb9
When a piece of content has several StreamSets with the same
language and role, pick an audio set with lower average bandwidth,
pick a video set with the highest top resolution. Pick the first one
when the above is not applicable.
Closes#476
Change-Id: Id2cb9095994e8aa6b205024504a5d665f8656437
If a key status is 'output-restricted', treat the key as unusable.
In many cases it is, and we have no way of differentiating when it is
or is not. So our treatment of this status should be conservative,
and we should treat the key as unusable. This will prevent
HDCP-related failures that may be caused by adapting to a stream whose
output restrictions may not be met. The hasOutputRestrictions flag on
streams and tracks is now gone.
The caveat to this change is that if content is encoded with the same
key for SD and HD, and HD streams have HDCP restrictions that cannot
be met, we will now consider both the SD and HD streams to be
unplayable, even though we could still play the SD streams. Because
we can't separate the status of the two streams, we don't know for
sure if the SD streams can be played.
We will no longer support such content due to the complexity of doing
so, and due to the risk of playback failures on adaptation to
restricted streams. Streams with different security requirements
should always be encrypted with different keys. Content which does
not follow this best practice will no longer be playable in Shaka
without modifying the player.
Change-Id: Ia29db8efa0b6f83c0376199dea5210c9b468bc40
Original Chromecast devices can output a max of 1080p, and may have
issues digesting higher resolution content. Since higher resolution
content would be downscaled for display anyway, limit Chromecast to
1080p to avoid both decoder issues and wasted bandwidth.
Some Cast devices may support UHD content, but the max res for
Chromecast is currently hard-coded until we have a way to detect a
device's capabilities at runtime.
Issue #261
Change-Id: I3dd093b07f9a964116f81422f3c298dfbf7e2e52
Some streams have the same mime type, but incompatible codecs. For
example, mp4a.40.2 and ec-3. Once a stream has been selected, filter
out incompatible codecs.
Closes#391
Change-Id: Id3f5521cb3f995d88d93255c0bc5cfda8e239fcd
* Set this.parser_ to the correct property in load()
(stops old manifests from being fetched).
* Stop load() from unloading first when the Player is a new instance.
* Handle multiple repeated calls to load().
* Fully cleanup after partial loads.
* Add additional destruction checks.
Issue #369
Change-Id: I43d5ed90c8119b1040b87a0dc187f52738e1c683