Commit Graph

40 Commits

Author SHA1 Message Date
Michelle Zhuo a09ae24b85 Add audio channels count configuration
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
2018-04-06 20:51:28 +00:00
Joey Parrish 5e7bbf77d8 Fix MP4+VTT in HLS
Our HLS parser made init segment references for everything but text
streams.  This condition was unnecessary, and the
createInitSegmentReference_ method already returns null if there is
no init segment specified in the playlist.

Closes #1270

Change-Id: Ia9e92a561dc0f9ee3caccfac30f3fb936d9dac87
2018-03-01 15:00:09 -08:00
Jacob Trimble 0200f498cf Convert 'var' to 'let'/'const' (4 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: Ib395106b14156a1f4000b516131684e319db78de
2018-02-20 11:09:07 -08:00
Jacob Trimble 3bb897dca4 Ignore HLS text streams when calculating duration.
Closes #1271

Change-Id: Ia17f43d032c9a277e0c3fe0a8568f2b3abf529c5
2018-02-07 17:35:51 +00:00
Benjamin Wallberg cf3e1e3337 Change so that default presentation delay for DASH is configurable (#1235)
It is useful to have the default presentation delay configurable when the stream provider isn't able to add `suggestedPresentationDelay` in the manifest

Fixes #1234
2018-01-22 09:31:22 -08:00
Joey Parrish 9b9140ed4e Fix MP4 timescale assumptions in HLS
We can now parse the MP4 timescale from the MP4 init segment.

Issue #1191

Change-Id: Ideaace6e1d5bfb5192a269b91601030b9b4ac53c
2018-01-18 20:18:26 +00:00
KongQun Yang c9175fb98c Add support for SAMPLE-AES-CTR method
Per the definition in the latest specification:
https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf

Keep the old method SAMPLE-AES-CENC, which will be deprecated in a
future release.

Issue: #1227

Change-Id: Ib6e553d2d20130822fd2e4e30ffb81e44f8bd64b
2018-01-17 23:32:46 +00:00
Joey Parrish 6e626cc84a Increase HLS partial segment size
This increases the amount of data we fetch to get HLS segment start
times.  The presence of a large PSSH box in Widevine-encrypted content
was pushing the "tfdt" box past the 1kB mark, so we will now fetch
2kB.

Issue #1137
References FR in google/shaka-packager#294

Change-Id: I51a1407c4d992e42d07c3e6c6c501051100d1620
2017-11-21 00:41:30 +00: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
Joey Parrish e9d4c22f99 Fix updating of variant stream indexes in HLS live
Issue #740

Change-Id: I0257db2042da8bf98b64a84267b3ac108ed0bb08
2017-11-02 15:37:14 -07:00
Joey Parrish f30b07a0e7 Fix URI extension parsing in HLS parser
Instead of directly splitting on dots, use the URI parser to deal with
URL parameters and hash parameters, then split only the path component
of the URI to extract an extension.

This required the update of all of our fake URLs used in testing, from
test://foo to test:/foo, so that the Uri parser would be able to see
"/foo" as a path, rather than "foo" as a domain.

Closes #1085

Change-Id: Ie7140b03ac689f721562b2537b83432f99667585
2017-11-01 16:59:11 +00:00
Joey Parrish 946f51fa4d Correct HLS VOD detection
The presence of EXT-X-ENDLIST means VOD, regardless of other tags.
Some new sample content exposed this bug, and this change adds a
regression test that mirrors that content.

Issue #740

Change-Id: I11548c83a87c4f993737744ef1b374c7fc013672
2017-11-01 16:59:11 +00:00
Joey Parrish a35c2d621d Get timestamps from HLS TS segments
This adds a TS packet parser to find PTS values from the segments
themselves.

Issue #740

Change-Id: I267a9dbe5e4fc050ae63b5738c143a91cfa4f12b
2017-11-01 16:59:11 +00:00
Joey Parrish a18dc01874 Remove broken HLS time offset code
We misinterpretted the EXT-X-START tag before.  Now, we ignore this
tag and parse segment times from the segments themselves.  This is
more robust for both VOD and live HLS content.

We avoid segment parsing when updating normal, well-behaved live
streams.  For poorly-behaved live streams, we will fall back to
segment parsing and recover.

This also addresses the issue of VOD content which does not start at
zero.  Instead of using configuration to make this playable, we will
now offset VOD content back to 0 automatically.

Issue #740
Closes #1011

Change-Id: Ib3a59f87e3a050244cd39854409d8e3542c50b0a
2017-10-30 18:51:29 +00:00
Sandra Lokshina 113d9744a7 Add support for HLS playlists with type LIVE
Issue #740

Change-Id: Ia3dcdd29d8b85f5f1b266455d70a6cafbdc94757
2017-10-24 23:58:37 +00:00
Joey Parrish 44fb94a0e3 Add support for MP4+TTML in HLS
Previously, our HLS implementation only supported WebVTT, because
that seemed to be the only supported format in HLS.

Now, we add support for other formats by extending the MIME and codec
guessing system to text streams.  We also add a parser registration
for HLS's new "stpp.TTML.im1t" codec string.

Closes #986

Change-Id: I0a58ca4650675ff0546e36edf4114290f7931239
2017-08-30 12:36:44 -07:00
Sandra Lokshina 051531b80f Add support for HLS playlists with type EVENT.
HLS Live comes in two flavors: LIVE and EVENT.
EVENTs append segments to the end of the playlist, but do not
ever remove segments. LIVE can both append segments to the end
and remove segments from the beginning of the playlist.
This CL lays the ground for supporting both types and introduces
support for EVENTs.

Issue #740.

Change-Id: I2042660daf9d1e7209cb1b40f50ab8b24571faa4
2017-08-22 19:02:04 +00:00
Joey Parrish b66c903ae2 Fix test failure in HLS parser tests
A new test was added to this file.  Meanwhile, in another CL, all
tests in the file were updated to reflect a new check against live
streams.  Since the two landed independently, the new test started
failing.

Change-Id: I2b733ec9357c98216eabd15ab0b129b03cd0578c
2017-08-07 20:23:54 -07:00
Sandra Lokshina 5f0a830c36 Reject HLS live content until we have support for it.
Change-Id: I57842758cf62ec05df0c552886b8a80d2c15b38e
2017-08-07 22:06:57 +00:00
Michelle Zhuo d67764b5ff New Error Code for Content unsupported by Browser
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.m3u8

Closes #868.

Change-Id: Ied135b687190919abbeb1561c2bff36a7203136e
2017-08-04 11:07:07 -07:00
Theodore Abshire 820a6a19c9 Fixes parsing Microsoft-packaged HLS.
Microsoft HLS packaging tools generate audio-only variants in an odd way;
specifically, the variants have an AUDIO tag despite being audio-only, and
thus double-link to the stream.
Previously, the way we detected stream type lead to us assigning one version
of the audio stream to audio and one to video, thus erroneously making those
variants appear to be video+audio variants.
This makes it so that, if the AUDIO tag has the same content URI as the base
stream, it only uses the version in the AUDIO tag.

Change-Id: Ie940970587e95a9020ed67589042008d0568e153
2017-07-06 09:50:18 -07:00
Jacob Trimble 78fc6d9b36 Disallow unknown properties (2/5).
This is part of adding a new conformance rule to add additional type
safety.  This will disallow using properties of unknown types or using
unknown properties.

The first parts will be fixing errors caused by the new rule.  These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.

Change-Id: I48335fc6659d3c33a6d55b00d087b59410c79cf7
2017-06-27 19:47:42 +00:00
Michelle Zhuo f09999aa80 Add channel count information for HLS audio tracks
Adding the count of channels, as a new field for tracks and streams.
Used for HLS audio tracks.

Resolves #826.

Change-Id: I1448b4a8cfaf6dd798670bb2f0f3981d6c7e40c3
2017-06-22 11:34:36 -07:00
Theodore Abshire 1e119e40cf Adds option to fail gracefully on xlink failure.
At the moment, when there is an xlink problem, the manifest parser
returns a rejected promise. This adds a configuration variable to
instead simply not replace the xml tag.

Closes #788

Change-Id: Iace953233c83a57820130033150e7cd9a9385d6f
2017-05-25 21:10:09 +00:00
Joey Parrish 16f9ca6a97 Make some educated guesses about HLS missing info
- Default CODECS attribute to 'avc1.42E01E,mp4a.40.2'
 - Infer stream type and multiplexed status from number of codecs,
   associated groups, and video-specific attributes.
 - Recombine codec strings when we detect multiplexed content

Closes #805

Change-Id: Ib1298033360b52091b7d871fed0eca047a00ad22
2017-05-22 18:47:19 +00:00
Sandra Lokshina 2e84717803 Hls Parser: Make segment request to establish mime type.
Closes #769.

Change-Id: I8692fb0e9e851a31f38d04ab3bfeece0a1ea3375
2017-05-03 20:00:59 +00:00
Sandra Lokshina b14867bc65 Add config to ignore key system and init data in DASH manifest.
Closes #750.

Change-Id: I551a671eb153428f7d9a7900bf9b47cb37694f95
2017-04-17 17:22:37 +00:00
Jacob Trimble 575f2ad109 Add an indicator for critical errors.
This adds a severity field to Error objects.  This can be used to
detect whether an error is recoverable.  All the same errors are still
reported so the field can be ignored.

There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
  load() again

Closes #564

Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
2017-04-04 23:57:59 +00:00
Joey Parrish db909b0f2e Add support for Widevine-encrypted HLS content
This abstracts the creation of DrmInfo to parse the EXT-X-KEY tag
differently per KEYFORMAT.

Issue #279

Change-Id: I2e187dcfc01f7306183c9090c54de58e81872bc4
2017-03-31 12:34:10 -07:00
Sandra Lokshina 4f10bd7878 HLS: allow spaces in the codecs list.
According to the HLS spec, CODECS attribute should have a comma-
separated list of codecs. The example in the spec doesn't contain
spaces between the elements of the list.
However, I encountered spaces in the codecs list in content
encoded by Apple. It's easy to support both ways, so I decided to
do it rather than fight that battle.

Issue #279.

Change-Id: Iecb706207365a51b5964f013e32ffe13e99604c6
2017-03-29 11:36:04 -07:00
Sandra Lokshina a3d6186dd4 Add support for multiple media tags with the same group-id (HLS).
Currently HLS parser expects only one media tag to have a given
group id. According to the spec that might not be the case.
This change adds support for multiple tags with the same gruop id
and insures the parser creates variants for all of them.

Issue #279.

Change-Id: I327e52387f7513464fc56c4b6b8d07ead689d6cc
2017-03-14 15:07:49 -07:00
Sandra Lokshina f946067535 Add HLS language canonicalization.
b/36134603

Change-Id: I425baa0aba373d1eae32d0097c66ec379347136c
2017-03-14 11:21:18 -07:00
Sandra Lokshina c6729d7c14 Add hls config with default time offset.
Apple encoded content has a default time offset of 10 seconds.
Every other packeger we've encountered so far doesn't.
New config will default to 0 and allow the application to specify
the offset for their content according to the packager's standards.

Issue #279

Change-Id: I65b16b05a5974a2f0318cd1f9847c3a56c38b745
2017-03-02 13:32:17 -08:00
Jacob Trimble 33c277ae82 Remove HLS requirement for init segment.
An init segment is not required for all streams, some streams are
self-initializing (e.g. MPEG2-TS).

Issue #279

Change-Id: I99556ee26f6568cc5e712b50d0bb4de78cb2bd9d
2017-02-17 11:21:13 -08:00
Sandra Lokshina eff3225563 Add constants for shaka content types and stream kinds.
Change-Id: I6630863e3a53caf9c863e5df6a593cddba516f2a
2017-02-17 09:59:37 -08:00
Sandra Lokshina 109065b3f2 Add support for subtitles to HLS parser.
Issue #279.

Change-Id: Ie32ab228ab0d00f0def9f2ee8d7c1e496b346ef8
2017-02-15 21:19:59 +00:00
Sandra Lokshina 24c17d2d44 Implement basic HLS manifest parser.
Issue #279.

Change-Id: Iec504a7f180f6f069d08bea471a7d4970f7ae7d4
2017-02-09 21:04:50 +00:00
Sandra Lokshina 0553f61528 Refactor HLS manifest text parsing into it's own class.
HLS parsing will be split into parsing the text of the manifest into
shaka internal objects and parsing those into a shakaExtern.Manifest.
This will make logic more clear and allow to test ManifestTextParser
independently of HlsParser.

Issue #279.

Change-Id: I44349966d3617e2d208185e3ad125ecea89732b4
2017-01-20 19:13:21 +00:00
Sandra Lokshina 8afadb4773 Add HLS objects and basic routines to parse manifests into them.
Issue #279.

Change-Id: I5b6f90b682d77849ce075a2a76a4202c56e5d882
2017-01-09 10:50:55 -08:00