1227 Commits

Author SHA1 Message Date
eguven
810e06c338 Fix starting the download service in the background throw exception
This happens when the device screen is locked.

This fixes a previous attempt to fix the problem.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199130325
2018-06-05 12:43:03 +01:00
tonihei
0f1931cbcf Add getTransferListener to BandwidthMeter.
This will allow the player to obtain the transfer listener used by the
bandwidth meter in order to pass it automatically to the relevant data
sources.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199124880
2018-06-05 12:42:08 +01:00
andrewlewis
bdaea799f1 Fix variable name
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199120421
2018-06-05 12:41:13 +01:00
falhassen
8e4e5fe0cc Fix javadoc in CacheKeyFactory.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199110920
2018-06-05 12:40:17 +01:00
tonihei
007d3c61bd Allow setting player lazily in AnalyticsCollector.
This helps to use the AnalyticsCollector without SimpleExoPlayer. Currently,
that may be problematic, if the contructor needs the player, but in order to
create the player, one already needs the AnalyticsCollector as a listener for
the renderers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199105012
2018-06-05 12:39:19 +01:00
falhassen
49eb27da0a Add a CacheKeyFactory to CacheDataSource.
A CacheKeyFactory can be passed to the CacheDataSource constructor, allowing clients to dynamically generate a custom cache key for any given upstream uri.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198878723
2018-06-05 12:38:20 +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
eguven
47c1404865 Avoid starting RequirementsWatcher if there is no download task
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198860680
2018-06-05 12:35:23 +01:00
tonihei
bf3c943b23 Replace hash by Object reference for uids.
There is the small (but unlikely) chance that the uids clash because the
Objects have the same hash code.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198855724
2018-06-05 12:34:27 +01:00
tonihei
b6113763b4 Allow lazy preparation of child source in a concatenation.
This adds an optional parameter to ConcatenatingMediaSource to prepare
child sources only lazily when are needed. This is helpful for long playlists
of media sources with manifests to prevent a lot of simultaneous manifest
loads.

Issue:#3972

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198855676
2018-06-05 12:33:31 +01:00
olly
29b9320fb9 Avoid possibility of leaking an activity/service context
The bug here was that we'd create a VideoFrameReleaseTimeHelper
using whatever context DefaultRenderersFactory has, and it would
then hold a reference to that context via DisplayManager. A leak
could then occur if the player outlived the life of the context
used to create it (which would be strange/unusual, but not
impossible).

Issue: #4249

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198747599
2018-06-05 12:31:11 +01:00
olly
69b4aa9e36 Explicitly null out LoadTask.callback on release
As highlighted by the ref'd issue, we can end up with
memory leaks if Loadable.load implementations take a long
time to return upon cancelation. This change cuts off one
of the two problematic reference chains.

This doesn't do much about the ref'd issue, since there's
a second reference chain that's much harder to deal with:
Thread->LoadTask->loadable. But since it's easy just to
cut this one off, I figure it makes sense to do so.

Issue: #4249

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198735386
2018-06-05 12:30:11 +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
2813c0699f Clarify threading requirements for the player in the doc.
This makes the requirement that all calls are made on one thread more
explicit and also mentions this in the Getting Started guide.

Issue:#4278

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198694579
2018-06-05 12:28:16 +01:00
sammon
3639f1281a Explicitly support MediaChunk.chunkIndex = C.INDEX_UNSET. This is common in
Manifestless streams.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198445216
2018-06-05 12:24:11 +01:00
olly
25f4ee22d6 Make BaseMediaChunkOutput properly public
I think it was just wrong that it was package private before, since
it resulted in our public API referencing something that's not part
of the public API:

https://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/source/chunk/BaseMediaChunk.html#init-com.google.android.exoplayer2.source.chunk.BaseMediaChunkOutput-

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198396555
2018-06-05 12:23:15 +01:00
eguven
f073316547 Roll forward of []
Set content length and redirect uri in a single transaction.

New: Fixed the code where DataSpec.uri is set to null in []

Automated g4 rollback of changelist 196765970.

*** Reason for rollback ***

Fixed the code where DataSpec.uri is set to null in []

*** Original change description ***

Automated g4 rollback of changelist 194932235.

*** Reason for rollback ***

This CL breaks the playability of Mango's offlined progressive videos.

*** Original change description ***

Set content length and redirect uri in a single transaction

NORELNOTES=true
NO_BUG

***

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198370211
2018-06-05 12:22:19 +01:00
sammon
610ed6c185 Exposing BaseMediaChunkOutput as public so that BaseMediaChunk.init() is unit testable.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198062017
2018-06-05 12:21:22 +01:00
tonihei
0912fd1d74 Serialize recursive listener notifications.
When the player state is changed from an event listener callback, we may
get recursive listener notifications. These recursions can produce a wrong
order, skip or duplicate updates, and send different notifications to
different listeners.

This change serializes listener notifications by clustering all update data
in a helper data class and adding the updates to a queue which can be handled
in a loop on the outer layer of the recursion.

As playWhenReady updates also reference the current playbackInfo, we need to
redirect the listener notifcations for setPlayWhenReady to the same queue.

Issue:#4276

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198031431
2018-06-05 12:20:13 +01:00
hoangtc
0cb34dcd1c Add SurfaceCapturer base class, and provide the first implementation
Use PixelCopy API for the first SurfaceCapturer implementation. This supports
devices from API 24+.

Github: #3609.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197732711
2018-06-05 12:19:00 +01:00
tonihei
a98d8fedfa Fix nullness errors in at least one file per module to be able to use test.
Some module/extensions couldn't use the static test so far because all files
needed to be put on the blacklist. To ensure the test it set up for all
modules, this fixes at least one file for each of the modules.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197731449
2018-06-05 12:17:54 +01:00
Anton Potekhin
ff8b3ebfb8 Blacklist Moto C from setOutputSurface
Issue: #4315
2018-05-29 10:28:17 +03:00
andrewlewis
2a23838116 Bump version to 2.8.1 and update release notes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197535443
2018-05-22 11:31:10 +01:00
andrewlewis
1896f2fa7c Save/restore current cues in SimpleExoPlayer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197531839
2018-05-22 10:29:16 +01:00
Andrew Lewis
49691e5117
Merge pull request #4252 from pedromfmachado/save_current_subtitle_cues
Saving current subtitle cues on SimpleExoPlayer
2018-05-22 10:13:56 +01:00
hoangtc
f3e650b8c7 Update InstrumentationTestCase to use JUnit4.
InstrumentationTestCase has been deprecated, and it does not offer some useful
features, such as targeting SDK version level for tests, or skipping tests if
necessary.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197141082
2018-05-22 09:08:43 +01:00
tonihei
2b9c31a14f Add MediaSource and DataSource to inject playback nonce into URLs.
A new playback nonce is created for each playback of the same item. Thus we
need to inject the nonce dynamically into the data source factory.

This CL adds the DataSource which does the actual insertion into the request
URLs and a MediaSource which listens to new media periods, to request the
nonce and to configure the data source factory for this media period to use
this nonce.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197134217
2018-05-18 15:04:55 +01:00
andrewlewis
f459611e04 Notify consistent event information to listeners
Issue: #4262

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197126757
2018-05-18 15:04:55 +01:00
hoangtc
1541354819 Support TTML font size using % correctly.
For TTML, if the font size is expressed in %, the font size should be relative
to the cellResolution of the document which we did not support before. This CL
adds support for handling this correctly.
Note that this still does not support font size using c unit.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196985694
2018-05-18 15:04:55 +01:00
andrewlewis
5e1b430839 Fix check for missing profile/level
SparseIntArray.get(key) defaults to zero for missing keys (the null check was
left over from when a Map was used).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196957452
2018-05-18 15:04:55 +01:00
eguven
7d76685e60 Fix padding oracle in CachedContentIndex
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196838184
2018-05-18 15:04:55 +01:00
hoangtc
17abab455e Fix a bug with TTML font styling.
Due to a bug, for each TTML node, when applying its style to the encompassed
regions, it applies child nodes's styling several time for each region (the
number of time is equal to the number of region). This leads to a styling issue
if there are multiple regions in a node displayed at the same time in TTML file.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196810046
2018-05-18 15:04:55 +01:00
pfxing
5ffb4d8f55 Rollback set content length and redirect URI
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196765970
2018-05-18 15:04:55 +01:00
andrewlewis
75db04d51d Fix extraction of PCM (sowt) in MP4/MOV
The sample size from the stsd box takes precedence over the sample size in the
stsz box.

Also remove assumption that C.INDEX_UNSET is -1 in ChunkIterator (which is a
no-op change).

Issue: #4228

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196661751
2018-05-18 14:31:12 +01:00
tonihei
0c3b1a6401 Allow canceling player messages.
This adds a cancel method to PlayerMessage.

Issue:#4230

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196638901
2018-05-18 14:29:45 +01:00
hoangtc
8a0af84c42 Supports seeking for FLAC stream using binary search.
Added FlacBinarySearchSeeker, which supports seeking in a FLAC stream by searching for individual frames within the file using binary search.

Github: #1808.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196587198
2018-05-18 14:28:18 +01:00
hoangtc
d3d4b33cac Blacklist Moto E(4) from setOutputSurface.
GitHub: #4134.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196562078
2018-05-18 14:26:49 +01:00
eguven
eb151a79e6 Small DownloadManager fixes
Fix suppressing initial "state changed to paused" listener invocations
for new added tasks that are immediately started.

Notify listeners for loaded actions queued state if they are not started
immediately.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196542693
2018-05-18 14:25:21 +01:00
Pedro Machado
2c55f58938 Fixed nullability issues 2018-05-14 17:51:49 +01:00
Pedro Machado
edd237e196 Saving current subtitle cues on SimpleExoPlayer 2018-05-14 15:44:29 +01:00
andrewlewis
f848d0e339 Remove stray space
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196323463
2018-05-12 18:57:20 +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
hoangtc
0fce0a0bcb Refactor DummySurfaceThread, move code to generate SurfaceTexture to new class
This makes way for reusing EGLSurfaceTexture in other places, such as metadata
and frame retriever.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196240576
2018-05-12 18:55:07 +01:00
tonihei
81c3769880 Add missing @Nullable to equals implementations.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195947382
2018-05-09 21:23:45 +01:00
olly
483cf77120 Revert retention of audio decoders
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195752931
2018-05-08 02:05:40 +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
6e8867c39e Fix broken notification (missing line in onStartCommand)
Also only listen to requirements when actually necessary, else we can
put the service into the foreground when it needn't be there.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195597750
2018-05-07 07:26:01 +01:00
olly
7afdf84a9d Fix DownloadService notification flicker
This type of flicker was visible (at least on my S8) whenever starting
the demo app process (from being properly killed) when other notifications
(e.g. completed download notification) was present.

This change passes whether the service was started as foreground through
the intent, and only applies the show-notification-on-stop hack if it
was. It's only necessary to start as foreground if your app is not already
in the foreground, so it's not necessary to do this from activity/ui
components.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195594930
2018-05-07 07:25:02 +01:00
olly
983fe9cc9f Add DownloadManager.Listener.onInitialized
If an app wants to reconcile its own state with that of a DownloadManager,
it's helpful to know when the DownloadManager has finished restoring any
previously persisted tasks.

Also suppress initial "state changed to paused" listener invocations for
tasks that are immediately started.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195594881
2018-05-07 07:23:58 +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