400 Commits

Author SHA1 Message Date
andrewlewis
4ee1daef0e Make download action custom data a byte[]
This may be preferable for using custom binary data,
and it's still easy to store Strings if needed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195486817
2018-05-07 07:10:46 +01:00
olly
0edc832d67 Get all track key objects into a consistent state
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195421908
2018-05-07 07:07:27 +01:00
olly
c5bf7f4513 Further clean up DownloadActions + DownloadActivity
- Made parts of DownloadActions public that were previously hidden.
  This is necessary so that when an app is listening to the
  DownloadManager, it can tell something about the tasks.
- Simplified DownloadActivity some more. The helpers may migrate
  into their corresponding modules at some point, and also be
  converted to return structured TrackGroupArrays rather than a
  flat list of Formats.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195269824
2018-05-07 06:53:59 +01:00
olly
c466fabb1c Use integers for HLS rendition keys
Currently it's possible to copy a master playlist with a URL
that was never present in the original. This change prevents
this, and also moves the key more in line with DASH/SS.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195065286
2018-05-07 06:47:40 +01:00
olly
d38e4dc8e0 Give actions per-type versioning
A single master version prevents app developers from providing
custom download functionality (because they can't increment the
version). It's also error prone to expect someone modifying the
DASH action to remember to update the ActionFile master version.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194981886
2018-05-07 06:46:33 +01:00
olly
175a0100d0 Remove ability to query Downloader implementations
This was adding a lot of code, and the multiple use cases
for Downloader was pretty confusing (in particular the
ordering of method calls was unclear). It's also not
performant (e.g. it requires loading/parsing manifest(s)
and initialization segments from disk).

In practice I think apps will need to keep a record of
what's offlined in their app's database (or equivalent),
which they can update by registering as a listener on
DownloadManager. This will be done for the demo app in
a subsequent change.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194932876
2018-05-07 06:43:25 +01:00
aquilescanta
d412dc97dc Fix seeking in live HLS streams
Issue:#4187

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194829857
2018-05-07 06:37:47 +01:00
olly
3e76464666 Fix download percentage reporting
- When calculating the downloaded percentage in DASH, there was no
  way to disambiguate between 0 of 0 segments being downloaded because
  there are no cached indexes (i.e. 0% downloaded) and 0 of 0 segments
  being downloaded because the index defines 0 segments (i.e. 100%
  downloaded).
- Also replace use of NaN with a named constant.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194453202
2018-05-07 06:20:59 +01:00
olly
59f01ec333 Use manifest filtering when downloading.
When we play downloaded content, we rely on the manifest filters
to produce a manifest that contains only the content that was
downloaded. It makes sense just to use the same filters during
download too, so we don't have to worry about any implementation
differences.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194380704
2018-05-07 06:18:51 +01:00
aquilescanta
ddef32c9e2 Support multiple EXT-X-MAP tags
Issue:#4182

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194223312
2018-05-07 06:16:32 +01:00
olly
0d9d1998f4 Centralize manifest filtering.
The generic type for track key will go away soon.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194220450
2018-05-07 06:14:25 +01:00
olly
b77d6c4ef4 Remove Downloader.ProgressListener
ProgressiveDownloader never implemented this properly, and we
don't use it in DownloadManager/DownloadService, both of which
use a polling model. A polling model is also what's used elsewhere,
for example to query the current playback position.

This is effectively doing the TODO in ProgressiveDownloader.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194214579
2018-05-07 06:13:24 +01:00
olly
b6f646ed96 Clean up DownloadAction instances
This removes a fair chunk of code. The line delta would
be more negative if it not for adding all the /* x= */
comments in DashDownloadActionTest!

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194136689
2018-05-07 06:11:49 +01:00
olly
1f3adacac3 Use parcelable keys for HLS downloads to remove special casing
This removes the need for separate String/Parcelable filter paths in
the demo app. Hopefully this is a temporary measure as we work
toward using track groups + consistent keys for all media types.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194065499
2018-05-07 06:08:34 +01:00
aquilescanta
400619c1c6 Preemptively declare an ID3 track for HLS chunkless preparation
Issue:#3149
Issue:#4016

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193664294
2018-05-07 05:48:42 +01:00
aquilescanta
d2c6871ce6 Fix HLS encryption method detection
Issue:#4145

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193494319
2018-05-07 05:37:04 +01:00
tonihei
66d2b76a6c Remove test max SDK version overrides.
These don't seem to be needed anymore. All tests run without them in gradle
and Blaze.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191867518
2018-04-08 16:39:57 +01:00
tonihei
6b82d1c2bd Add setters to MediaSource factories for custom window tag.
This field (formerly "id") is almost impossible to use so far. Having setters
in the factories allows to specify custom tags for all media sources.

Also added a ExoPlayer.getCurrentTag() method to retrieve the tag of the
currently playing media source in a convenient way.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191738754
2018-04-07 19:12:21 +01:00
olly
8b5a34769f Remove unnecessary line from test manifests
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191409777
2018-04-03 15:30:40 +01:00
olly
3a98f7aa99 Make toUpperCase conversions locale invariant
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190942033
2018-03-29 18:00:05 +01:00
eguven
acca4f238b Add missing @Nullable annotations
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190817805
2018-03-29 13:45:38 +01:00
aquilescanta
74b7b90555 Propagate non-MediaSource-preparation playlist load errors through HlsChunkSource
Erroneous condition:
===================
If the track selection contains a subset of the available variants in the
master playlist, but only the selected variants return 404, the playlist
tracker will never propagate the error.

Fix:
====
The Chunk source will propagate the playlist load error if no more
alternative playlists are available (because all are already blacklisted).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190624484
2018-03-28 00:57:01 +01:00
aquilescanta
71e5b2c073 Assume TS when the HLS segment URI has no path
Issue:#4033

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190603518
2018-03-28 00:55:19 +01:00
aquilescanta
f0bb6bb263 Make MediaPeriod implementations compliant with its specification
Currently, MediaPeriod states that continueLoading may be called
during preparation. Some implementations would throw an error if
this happened.

Also make MediaPeriod documentation clearer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190596870
2018-03-28 00:52:04 +01:00
tonihei
6c0d676050 Add callbacks for media period life cycle.
This adds callbacks for creating, releasing, and starting to read from media
periods.

Such events allow listeners to keep a list of active media periods. This is
useful to determine when no further events for a certain media period are
expected. It also allows listeners to associate renderer events unambigiously
with a reading media period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190462717
2018-03-28 00:41:29 +01:00
eguven
764d18f68f Add ability to play filtered manifests in PlayerActivity
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189796293
2018-03-28 00:20:27 +01:00
andrewlewis
07f898d441 Use @IntDef for some more int-based enumerations
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188853170
2018-03-13 15:41:06 +00:00
tonihei
4f56636328 Add window index and media period id to media source event listener events.
This allows to distinguish between media source events of multi-window and
multi-period media sources. In this change, only media sources currently reporting
events are changed. Proper support in composite sources will be added in a later
change.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188847366
2018-03-13 15:39:25 +00:00
tonihei
8f952162ff Allow multiple media source event listeners.
This is achieved by moving the listener registration and the creation of the
event dispatcher into BaseMediaSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188461932
2018-03-12 15:15:34 +00:00
andrewlewis
4373e63fac Make the period and initial window positions match for all HLS streams
Before this change, HlsMediaSource timelines had a period starting at the epoch.
For VOD streams the window position in the period was the program date time.

This change makes period and initial window positions match. For live streams
the window position advances as segments are removed, so its position in the
period is the difference between the initial program date time and the program
date time of the latest playlist.

This also makes it possible to insert ads in VOD HLS content with program date
time, as the period and window are now aligned.

Issue: #3865

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187590948
2018-03-02 09:30:40 +00:00
hoangtc
fcb796a80c Migrate ExoPlayer Gradle build files.
- Change 'compile' configuration (deprecared) to using 'implementation'
and 'api' configurations instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187311778
2018-03-02 09:20:02 +00:00
tonihei
b2c445776a Allow parallel reuse of media sources.
This is achieved by adding a BaseMediaSource which keeps a reference count of the
number of times the source has been prepared and forwards to the actual implementations
only once, such that only minimal changes are needed for each media source.

Issue:#3498

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187186691
2018-03-02 09:08:28 +00:00
tonihei
b47fb2826b Move extension tests to Robolectric.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187021822
2018-02-27 11:03:50 +00:00
Daniel Thompson
90ee038f89
Merge branch 'dev-v2' into dev-v2 2018-02-16 18:32:33 -05:00
aquilescanta
1d4bc7dda7 Add initial support for EXT-X-GAP
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185676652
2018-02-16 12:03:49 +00:00
andrewlewis
b9f9232b9d Release Extractors on the loading thread
Releasing the player released the internal playback thread once renderers were
released. Releasing a MediaPeriod queued a Loader.ReleaseTask on the loading
thread which would post back to the playback thread. If the playback thread had
been quit by the time this happened, the release task wouldn't be run.

Release on the loading thread instead of the playback thread. This avoids
needing to block releasing the player until the loading threads have ended, and
ensures that release tasks will run eventually. As part of this change,
ExtractorMediaPeriod's call to Extractor.release will now run on the loading
thread (which means that all Extractor methods are called on that thread) and
other cleanup in ReleaseCallback will run on the loading thread instead of the
playback thread.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185651320
2018-02-16 11:53:51 +00:00
eguven
73e3e16949 Fix SmoothStreaming manifest url for downloading
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185526653
2018-02-16 11:51:19 +00:00
eguven
2c2aaf0a4b Make SegmentDownloadAction constructor keys parameter simpler
Removed option to pass null keys parameter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185134822
2018-02-16 11:42:21 +00:00
Daniel
cb46e875e4 Added parsing of optional human-readable title #EXTINF:<duration>,[<title>] 2018-02-15 14:51:34 -05:00
eguven
61ba0f2827 Fix FilteringHlsPlaylistParser
Only filter HlsMasterPlaylists.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183394956
2018-02-08 14:49:00 +00:00
eguven
b3da82dc1c Open source DownloadService, DownloadManager and related classes
Issue: #2643

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184844484
2018-02-08 14:47:54 +00:00
eguven
1dde2adbf3 Add SegmentDownloader.getAllRepresentationKeys method
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183656655
2018-02-01 14:59:11 +00:00
eguven
f6541b498a Fix FilteringHlsPlaylistParser
Only filter HlsMasterPlaylists.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183394956
2018-02-01 14:42:54 +00:00
aquilescanta
8ba3335145 Use long segment indices for DASH
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183389701
2018-02-01 14:34:41 +00:00
tonihei
d418204e26 Allow reusing HlsMediaSource.
GitHub:#3498

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183373647
2018-02-01 14:28:26 +00:00
aquilescanta
677fc291cf Use long for HLS media sequences
Issue:#3747

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183366339
2018-02-01 14:25:01 +00:00
eguven
8b79028880 Add filtering manifest parsers for DASH, HLS and SmoothStreaming
These parsers can be used to get a manifest which includes only the
representations identified by the given keys.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182932874
2018-01-23 19:36:41 +00:00
tonihei
e991a8015b Use Truth instead of framework asserts in all tests.
This achieves two things:
1. All our tests use the same type of assertions.
2. The tests currently run as instrumentation test can be moved to
   Robolectric without changing the assertions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182910542
2018-01-23 19:29:12 +00:00
kqyang
06be0fd712 Add SAMPLE-AES-CTR, which replaces SAMPLE-AES-CENC per latest spefication: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182407790
2018-01-23 19:05:03 +00:00
aquilescanta
605aeb3a42 Make id3 context usage robust against container format changes
Issue:#3622

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182363243
2018-01-23 18:58:47 +00:00