205 Commits

Author SHA1 Message Date
olly
f549cf5635 Fix Aes128DataSourceTest portability issue
For background on why doing this works, see below. I don't want to change
how we get our Cipher instance in non-test code, since PKCS7 always works
on Android. It's only when the tests are running on a non-Android host
machine that they can fail. An alternative would be to make it an androidTest,
but androidTests are slow.

------

Background:

"While Java considers PKCS5 and PKCS7 padding to be the "same" (and
one should always use the string "AES/CBC/PKCS5Padding" because
"AES/CBC/PKCS7Padding" will cause NoSuchAlgorithmException to be thrown
when initializing an AES block cipher using the Java crypto API), I
consider this a gross misnaming in the Java platform because the pure
technical definitions of these paddings are not the same."

Ref: https://stackoverflow.com/questions/10193567/java-security-nosuchalgorithmexceptioncannot-find-any-provider-supporting-aes-e

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207234518
2018-08-06 11:25:34 +01:00
aquilescanta
4eee474555 Remove minLoadableRetryCount from HLS components
Remove minLoadableRetryCount from HLS components in favor of
LoadErrorHandlingPolicy#getMinimumLoadableRetryCount.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206298419
2018-08-01 13:49:20 +01:00
tonihei
d3c2cb2aa4 Update remaining DataSource's with new addTransferListener method.
The new method allows to add TransferListeners after the DataSource
has been created. Most implementations just forward to their wrapped
upstream DataSource. Implementation which directly read data implement
BaseDataSource instead.

Also removes the temporary default no-op implementation in DataSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206289986
2018-08-01 13:49:20 +01:00
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
1d636520ca Auto-register AnalyticsCollector as bandwidth meter listener.
This allows to automatically forward bandwidth estimate events to
AnalyticsListeners.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205642752
2018-07-23 13:32:44 +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
olly
b25a124239 HLS: Fill primary sample formats with track format info (e.g. bitrate)
Issue: #3297

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204732266
2018-07-17 20:28:52 +01:00
aquilescanta
e247a08a36 Parameterize load error handling in HLS
Issue:#2844
Issue:#2981

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204718939
2018-07-17 20:25:18 +01:00
olly
450448b220 Fix bug where sourceId wasn't set for the first chunk
The sample queues haven't been created when the first init call
occurs. In this case we need to set sourceId when we subsequently
create the queues.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204467538
2018-07-17 20:21:10 +01:00
olly
ef728178a8 Improve format derivation for chunkless preparation
1. Copy label into derived formats
2. If audio is the primary track type, copy additional fields from
   the variant formats. This is probably a no-op in practice, since
   I don't think variant formats have these fields set anyway, but
   it seems like the right thing to do in case they ever are set in
   the future.

Note: It's a bit strange to use createXContainerFormat rather than
createXSampleFormat, but in practice the methods used here are
better matched for what we're trying to do.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204467287
2018-07-17 20:19:57 +01:00
olly
18ab4b9112 Fix / improve format merging
1. Prefer label and language values in the manifest to those in
   the media. This is particularly helpful if the sample format
   contains "und" as the language.
2. Copy label when deriving formats in HlsSampleStreamWrapper
3. When there's only one variant in HlsSampleStreamWrapper, use
   the regular copyWithManifestFormatInfo. This allows more
   information to be retained from the sample format.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204340008
2018-07-17 20:13: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
Oliver Woodman
e4b05a5ae6 Merge branch 'dev-v2' of https://github.com/JungleGenius/ExoPlayer into JungleGenius-dev-v2 2018-07-12 15:54:47 +01:00
tonihei
095c6e4bf8 Add MediaChunkIterator for HLS media playlists.
This allows to iterate through the available segments of the playlist.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204100116
2018-07-11 14:57:49 +01:00
tonihei
264bed06f2 Forward addTransferListener for all wrapping data sources.
This allows to register a listener on an outer wrapping data source which
receives data transfer events from the wrapped source.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203358981
2018-07-06 14:37: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
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
aquilescanta
caa90844c6 Allow overridable empty closed caption format list in DefaultTsPayloadReaderFactory
Issue:#4451

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202923630
2018-07-03 11:52:31 +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
aquilescanta
efa714ab4f Support EXT-X-INDEPENDENT-SEGMENTS in the master playlist
From the spec:

If the EXT-X-INDEPENDENT-SEGMENTS tag appears in a Master
Playlist, it applies to every Media Segment in every Media
Playlist in the Master Playlist.

----

This requires propagation of attributes from the master
playlist to the media playlists. This CL only includes
independent segments, but other inheritable attributes
will be supported in following changes. Other inheritable
attributes include variable substitution definitions and
session keys.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202628422
2018-07-03 11:44:56 +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
f850c0de73 Rename HlsPlaylistTracker's release to stop
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202103550
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
tonihei
fcc0bd403f Report uri and response headers of chunks.
Both values are helpful for event reporting, but are only available while
the data source is open. Similar to bytesLoaded, they need to be reported
through the Chunk.

Issue:#2054
Issue:#4361

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201664907
2018-06-22 17:41:51 +01:00
aquilescanta
8802da6bb3 Fix re-starting of DefaultHlsPlalyistTracker
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201530049
2018-06-22 17:39:04 +01:00
eguven
01ce549e8f Fix HlsMediaPlaylist download using HlsDownloadHelper
Issue: #4396

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201324467
2018-06-20 18:04:20 +01:00
aquilescanta
d8a61aade7 Normalize timestamps in HlsChunkSource
Issue:#4394

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201178909
2018-06-20 18:01:31 +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
aquilescanta
943de70a15 Pass HTTP DataSource's response headers to HlsExtractorFactory
Issue:#2025

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=200212344
2018-06-18 11:14:17 +01:00
tonihei
37516d3126 Add missing onLoadStarted events to HLS playlist tracker.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=200211755
2018-06-18 11:13:13 +01: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
andrewlewis
448ce43ddf Fix unused playlistParser in deprecated constructor
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199792156
2018-06-18 11:04:01 +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
aquilescanta
bb684b528e Promote getResponseHeaders to DataSource
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199607604
2018-06-18 10:51:31 +01:00
ojw28
ad2996afe4
Merge pull request #4314 from TakuSemba/fix-bug-when-loading-init-data
close initDataSource after reading
2018-06-05 19:25:01 +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
olly
6cfc7b7ebb Remove Loadable.isLoadCanceled
This simplifies Loadable implementations, and also removes the
possibility of an incorrect Loadable implementation causing the
wrong Loader.Callback method being called (perviously, for the
correct method to be called, we relied on isLoadCanceled being
implemented correctly).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198871133
2018-06-05 12:36:23 +01:00
aquilescanta
7f866b2a07 Extract HlsPlaylistTracker interface
This allows injection of custom implementations and configuration of
DefaultHlsPlaylistTracker without modifying the HlsMediaSource interface.

Issue:#2844

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198846607
2018-06-05 12:32:32 +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
takusemba
368534909b close initDataSource after reading 2018-05-29 15:46:42 +09:00
tonihei
7b855e45e6 Enable HLS sample queues as soon as possible.
Currently, the sample queues are lazily enabled when they are first read from.
This causes problems when the player tries to discard buffer and the
HlsSampleStreamWrapper assumes the sample queue is disabled even though it's
actually enabled but hasn't been read from.

This change moves setting the sample queue index of the sample stream back into
HlsSampleStreamWrapper. It enables the sample queues at track selection if the
queues are already built, or immediately after they have been built for
chunkless preparation.

Issue:#4241

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197415741
2018-05-22 09:12:55 +01:00
aquilescanta
317d2c7b5c Fail for non-blacklistable playlist load errors in HLS
This CL allows failure if a playlist load fails with a non-blacklistable
error. For example, loss of internet connection.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197006579
2018-05-18 15:04:55 +01:00
aquilescanta
9a45d504d3 Fix playback of live HLS streams with #EXT-X-PROGRAM-DATE-TIME tags
Issue:#4239
Issue:#4254

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196796569
2018-05-18 15:04:55 +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
b7399c7559 Fix bug in Aes128DataSource
Open was not calling through to upstream.open. This was not problematic for
reading, because DataSourceInputStream.read would open the upstream if it's
not open already. It was however a problem for calling getUri() between
calling open and the first call to read, which would end up calling
upstream.getUri() on the not-yet-opened upstream.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195689472
2018-05-07 19:18:05 +01:00