106 Commits

Author SHA1 Message Date
tonihei
ffdc17d0e0 Remove generic type parameter from TransferListener.
All known instances use DataSource as generic type and thus code can be simplified
by removing the generic type altogether.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205798542
2018-07-24 14:56:45 +01:00
tonihei
5933d92394 Add simplified Dash and Ss media source factory constructors.
As the manifest and media data sources can be the same now, we can provide
a simplified constructor with just one data source factory.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205658046
2018-07-23 15:55:57 +01:00
olly
d2eb3fbefa Cleanup: Remove unnecessary generic types
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205409290
2018-07-23 10:25:23 +01:00
Oliver Woodman
05a31dfd24 Format cleanup 2018-07-12 16:08:11 +01:00
ojw28
41636ada88
Merge pull request #4391 from kaltura/add-label
Add label attribute support for DASH audio/text
2018-07-12 16:05:19 +01:00
tonihei
acbe52d0d7 Forward TransferListener from MediaSources to DataSources.
This wires up recent changes of passing a transfer listener to the MediaSource and
allowing DataSources to accept new listeners.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203280818
2018-07-06 14:35:17 +01:00
tonihei
abb4d6ff70 Use correct generics type bounds for TransferListener in MediaSources.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203260699
2018-07-06 14:32:46 +01:00
tonihei
f4bcfe082d Add MediaChunkIterator for SmoothStreaming stream elements.
This allows to iterate through the available chunks of the stream.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203105813
2018-07-06 14:26:56 +01:00
tonihei
c8af6d176f Forward queue of media chunks to getNextChunk.
This allows to use this queue in the track selection in the future.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202954871
2018-07-03 11:57:26 +01:00
tonihei
98afaa60d0 Forward TransferListener to media sources.
In the future, this allows to register the BandwidthMeter (managed by the player)
as a listener to all media transfers related to this media source.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202643946
2018-07-03 11:47:15 +01:00
tonihei
dd14500eba Add url (after redirection) to LoadEventInfo.
This url is readily available when creating media source events (from the
data source) but so far not published to external listeners. This change
adds a new field to LoadEventInfo which corresponds to DataSource.getUri().

Issue:#2054

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202459049
2018-06-28 16:18:50 +01:00
aquilescanta
fc2168eb61 Add an errorCount argument to onLoadError
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202313695
2018-06-28 16:18:50 +01:00
eguven
93cbae5bff Use default Deserializers if non given to DownloadManager
Also moved shared code to SegmentDownloadAction between its subclasses.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202294880
2018-06-28 16:18:50 +01:00
aquilescanta
a1f89bec0d Allow configuration of the Loader retry delay
Issue:#3370

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201996109
2018-06-25 22:38:29 +01:00
Itay Kinnrot
cd9041c089 Parse the label of audio and text from stream and add it to Format type + add it to default ui + update from dev-v2 2018-06-19 11:32:04 +03:00
tonihei
877c6965c3 Correctly report type of ParsingLoadable.
The helper method only reported DATA_TYPE_UNKNOWN even if the actual type
is known.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=200067296
2018-06-18 11:09:43 +01:00
eguven
a406dc8bee Use TrackKey in place of RepresentetionKey, StreamKey, RenditionKey
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199767518
2018-06-18 10:58:52 +01:00
olly
a5820b7535 Explicitly null MediaPeriod callbacks on release
If a MediaPeriod uses a Loadable, then there are typically
reference chains of the form:

LoadingThread[GCroot]->Loadable->MediaPeriod->Player

Where the player is the MediaPeriod callback. When the
player is released, this reference chain prevents the
player from being GC'd until Loadable cancellation
completes, which may not always be fast. This in turn
will typically prevent the application's activity from
being GC'd, since it'll normally be registered as a
listener on the player (directly or indirectly via
something like a view).

This change mitigates the issue by removing references
that the MediaPeriod holds back to the player. The
MediaPeriod will still not be eligible for GC, but the
player and application activity will be, which in most
cases will be most of the leak (in terms of size).

Issue: #4249

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199143646
2018-06-05 12:43:59 +01:00
tonihei
27f009d239 Enable Java 8 support.
This enables compiler support for Java 8 features.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198709705
2018-06-05 12:29:14 +01:00
tonihei
74df3766f9 Include checkerframework annotatons with compileOnly and remove lint exclusion
The lint error suppression only works locally and not for external developers
who still see the lint error and need to suppress it themselves.

This changes 'implementation' to 'compileOnly' in gradle to prevent the
dependency from being exported. Also removes the local lint suppression.

Issue:#4234

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196251407
2018-05-12 18:56:12 +01:00
olly
d6d7c41065 Expose manifests/playlists from download helpers
This is useful to get hold of the manifest to then obtain DRM init data in
the download flow for protected content (without having to download the
manifest again).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196168938
2018-05-12 18:51:47 +01:00
olly
590edf5288 Fix checker-framework build issues
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195689456
2018-05-07 19:17:07 +01:00
olly
b9aaf1ebab Improve offline support in the demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195593235
2018-05-07 07:22:53 +01:00
olly
051da40dc3 Misc cleanup
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195552434
2018-05-07 07:17:33 +01:00
olly
416d6c9eeb Move download helpers into core library
Also convert them to exposing periods and track groups, like
regular MediaSources do. This gets us much closer to being
able to use standard track selection components during offline
initialization. The helper is responsible for reverse mapping
selected tracks onto physical streams when generating the
download action. This is trivial except for the HLS case, which
is a TODO for now.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195500826
2018-05-07 07:12:46 +01:00
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
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
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
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
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
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
olly
eb34a2a102 Improve DASH/SS seek performance
This change enables feeding decoders from the closest sync frame
before a specified seek position, where-as previously we'd
always feed decoders from the start of the chunk. This avoids
decoding and discarding many audio samples during each seek. The
same benefit also applies to video chunks containing more than
one key-frame.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190539547
2018-03-28 00:46:49 +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
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
olly
0de6bb28a2 Fix broken Javadoc
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186999051
2018-02-26 15:41:18 +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