1250 Commits

Author SHA1 Message Date
tonihei
d1fdc518fb Use AnalyticsListener in EventLogger.
This replaces the existing listeners and provides some additional meta data
for each event.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194770421
2018-05-07 06:27:52 +01:00
olly
c0fdbde903 Fix permissions lint errors.
- Add ACCESS_NETWORK_STATE to core library. It seems fairly fundamental. We should
  also be using it elsewhere (e.g. to fail fast if there's no network).
- Add annotation to force apps using PlatformScheduler to declare RECEIVE_BOOT_PERMISSION

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194763051
2018-05-07 06:26:46 +01:00
olly
9c15c63d4e Add util method for starting foreground services
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194761771
2018-05-07 06:25:40 +01:00
olly
159979e69e Remove spurious TargetApi annotation
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194535300
2018-05-07 06:23:06 +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
hoangtc
fe32401792 Supports extracting from AMR container format.
Supports extracting data from AMR container format for both narrow and wide
band formats. Also added AmrExtractor as one of the default extractor to be
used in DefaultExtractorsFactory.

GitHub: #2527.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194407507
2018-05-07 06:19:55 +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
dcff063709 Fix DefaultTrackSelector bug + improve equals check
- clone() wasn't performing a deep enough copy
- Sort tracks in overrides to improve equals check

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194220596
2018-05-07 06:15:29 +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
c9bb102f93 Use Uri rather than string for ProgressiveDownloadAction
This makes it consistent with the other download types.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194089486
2018-05-07 06:10:44 +01:00
tonihei
f320d9e0ab Deprecate add/remove video/audio debug listener in SimpleExoPlayer.
Using addAnalyticsListener provides the same functionality with additional
information.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194071893
2018-05-07 06:09:40 +01:00
tonihei
874dc202f8 Prevent timeline access in AnalyticsCollector for future windows and periods.
Some of the events are emitted by the media periods itself and their index may
not be available in the publicly accessible timeline yet.

To prevent this, we currently check for timeline.isEmpty() only. But this may
also happen for dynamic changes, e.g. when new sources are added in fast
succession and a manifest for one of the new sources starts loading before the
updated timeline is reported.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194057401
2018-05-07 06:07:29 +01:00
olly
f7c5e475a7 Prevent native crash in raw decoder
Playback will still fail if an input sample is larger
than 32K, but will now fail gracefully.

Issue: #4057

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193951955
2018-05-07 06:04:13 +01:00
olly
895ac660a8 Default playClearSamplesWithoutKeys consistently to false
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193942368
2018-05-07 06:03:12 +01:00
andrewlewis
ddd603a1ee Add DownloadService constructor for notification channel
Also move NotificationUtil from the UI module to the core module.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193941401
2018-05-07 06:02:07 +01:00
andrewlewis
f6d5cb9934 Add a convenience constructor for DownloadManagers
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193940183
2018-05-07 05:59:59 +01:00
olly
adc77fd0b1 Simplify & clean up offline support in demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193938140
2018-05-07 05:58:59 +01:00
olly
7d6b0e1fda Move renderer flags, overrides and tunneling ID into Parameters
- This is needed to make DefaultTrackSelector properly thread
  safe, and enable atomic changes to the selector that, for
  example, disable a renderer and enable another one at the same
  time.

- This change also saves/restores parameters and the start
  position in PlayerActivity, resolving the ref'd issue.

Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193913350
2018-05-07 05:56:48 +01:00
andrewlewis
5926e20105 Use the codec MIME type for configuration
This may differ from the format MIME type for audio/eac3-joc.

Issue: #4165

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193906521
2018-05-07 05:55:43 +01:00
olly
d3cdf52591 Sanitize MappedTrackInfo API
Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193897041
2018-05-07 05:53:05 +01:00
eguven
53a003bae2 Start downloads on DownloadService creation if there are no requirements
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193662396
2018-05-07 05:46:02 +01:00
eguven
80c28f14b3 Re enable single SimpleCache instance assertion and add helper methods
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193637830
2018-05-07 05:42:40 +01:00
falhassen
0666e4f306 Override ChunkIndex#toString.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193600860
2018-05-07 05:41:36 +01:00
andrewlewis
2b367759cf Allow overriding skipping/scaling with custom AudioProcessors
Issue: #3142

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193519029
2018-05-07 05:38:10 +01:00
olly
cdb13dd548 Make SelectionOverride parcelable
Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193494016
2018-05-07 05:35:55 +01:00
andrewlewis
5fe0b0a13b Fix @link typo
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193491200
2018-05-07 05:34:49 +01:00
eguven
35e3892dbf Invoke CacheDataSource EventListener.onCacheIgnored once per request
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193480939
2018-05-07 05:33:45 +01:00
olly
d4aceef8a8 Add getPlaybackError to Player/ExoPlayer interface
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193400443
2018-05-07 05:31:37 +01:00
eguven
a8e16f3cfe Simplify DownloadService notification requirements
This makes DownloadService easier to use in general and when only single
notification is used for all downloads.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193165982
2018-05-07 05:29:20 +01:00
olly
fec7d32836 Remove TrackSelection.Factory from SelectionOverride
Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193045534
2018-05-07 05:28:06 +01:00
olly
45ed7c304c Update moe equivalence
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193016758
2018-05-07 05:25:36 +01:00
Oliver Woodman
d4eb2e5b85 Resync internal/external codebases 2018-04-16 11:36:59 +01:00
ojw28
b5912efb03
Merge pull request #3921 from wischnow/dev-v2
support zlib compressed PGS subtitles
2018-04-16 11:07:26 +01:00
ojw28
650f96fd6e
Merge pull request #4000 from jianx9/dev-v2
Provide an option to skip file descriptor sync in CacheDataSink. closeCurrentOutputStream
2018-04-16 11:07:11 +01:00
tonihei
92dd708ef8 Automated g4 rollback of changelist 192816182.
*** Reason for rollback ***

Added the missing initialization to Timeline.EMPTY.

*** Original change description ***

Automated g4 rollback of changelist 192742299.

*** Reason for rollback ***

Culprit for b/78018932.

*** Original change description ***

Auto-register analytics collector in SimpleExoPlayer.

This automatically registers and deregisters an analytics collector in
SimpleExoPlayer. Doing this also allows to write integration tests checking
whether the reported window indices and media period ids are correct.

***

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193006701
2018-04-16 10:55:42 +01:00
falhassen
752b90027c Automated g4 rollback of changelist 192742299.
*** Reason for rollback ***

Culprit for b/78018932.

*** Original change description ***

Auto-register analytics collector in SimpleExoPlayer.

This automatically registers and deregisters an analytics collector in
SimpleExoPlayer. Doing this also allows to write integration tests checking
whether the reported window indices and media period ids are correct.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192816182
2018-04-16 10:54:28 +01:00
vyao
ebc1b2d2cc Automated g4 rollback of changelist 191834511.
*** Reason for rollback ***

Rolling back to re-disable the exception as the crash is still appearing on latest version

*** Original change description ***

Automated g4 rollback of changelist 191128111.

*** Reason for rollback ***

This was a temp fix to be cherrypicked into YouTube Andorid Main App 13.12  to resolve P0 b/77315136.

*** Original change description ***

Temp fix for b/77315136: Don't lock or check cache directories in SimpleCache

To be immediately rolled back after submission

Submitting on behalf of cblay.

***

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192789263
2018-04-16 10:53:07 +01:00
olly
67cde97a70 Move code unrelated to mapping to DefaultTrackSelector
Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192759210
2018-04-16 10:47:55 +01:00
olly
0ee3963789 Follow 307/308 POST redirects for license requests
I was considering putting this directly in DefaultHttpDataSource, however:

- We'd need to modify at least OkHttpDataSource as well. I'm not sure whether
  Cronet follows this type of redirect automatically or not.
- HttpDataSource instances don't know how they're going to be used, so it's
  probably correct that they behave like the underlying network stack.

Issue: #4108

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192745408
2018-04-16 10:46:38 +01:00
andrewlewis
22b8ab5c09 Fix initial application of playback parameters
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192744823
2018-04-16 10:45:19 +01:00
tonihei
b4a3385a6f Auto-register analytics collector in SimpleExoPlayer.
This automatically registers and deregisters an analytics collector in
SimpleExoPlayer. Doing this also allows to write integration tests checking
whether the reported window indices and media period ids are correct.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192742299
2018-04-16 10:44:05 +01:00
andrewlewis
387cc2f2bd Trim more than one sample for elst gapless
Allow trimming an arbitrary small number of samples (needing to trim up to two
samples actually seems to be common). For larger numbers of samples we do coarse
trimming by applying the edit list in the normal path, and don't use gapless
playback.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192736956
2018-04-16 10:42:48 +01:00
tonihei
0a68d1f09c Fix pending stream offset activation in video renderer.
Currently, pending stream offset changes are kept until an output buffer
timestamp surpasses the next pending stream offset. However, this is
problematic if the next stream offset overlaps with the current output
buffer sample times (e.g. because the next stream starts at a non-zero start
time).

To correctly time the switch to the next stream offset, this change keeps
the timestamp of the last queued input sample as switch point. And we only
switch to the new offset after an output sample timestamp reached this switch
point.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192736637
2018-04-16 10:41:27 +01:00
eguven
9a4e083b4e Blacklist Philips QM163E from setOutputSurface
Issue: #4104

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192629223
2018-04-16 10:40:07 +01:00
tonihei
0802ecfee3 Automated g4 rollback of changelist 192621199.
*** Reason for rollback ***

Rollback only needed to cherry-pick into Photos release.

*** Original change description ***

Automated g4 rollback of changelist 190906020.

*** Reason for rollback ***

Breaks looping.

*** Original change description ***

Automated g4 rollback of changelist 190628272.

*** Reason for rollback ***

b/76391022 was caused by a timestamp correction in StabilizableSimpleExoPlayer which will be fixed with this CL.

*** Original change description ***

Automated g4 rollback of changelist 189570277.

*** Reason for rollback ***

causes b/76391022, motion still playback in Photos is broken

**...

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192621719
2018-04-16 10:38:48 +01:00
falhassen
692b7a674a Automated g4 rollback of changelist 190906020.
*** Reason for rollback ***

Breaks looping.

*** Original change description ***

Automated g4 rollback of changelist 190628272.

*** Reason for rollback ***

b/76391022 was caused by a timestamp correction in StabilizableSimpleExoPlayer which will be fixed with this CL.

*** Original change description ***

Automated g4 rollback of changelist 189570277.

*** Reason for rollback ***

causes b/76391022, motion still playback in Photos is broken

*** Original change description ***

Used fixed time frame in clipping media period.

Currently, whenever the clipping is updated, we...

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192621199
2018-04-16 10:37:29 +01:00
eguven
8809193266 Add ContentMetadataInternal helper class
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192596362
2018-04-16 10:34:46 +01:00
andrewlewis
3c78dc22f6 Handle non-empty EoS buffers, for audio
This fixes gapless playback of streams with encoder padding on devices where the
decoder could set the end of stream flag on a non-empty final buffer.

Issue: #3449

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192407924
2018-04-16 10:30:45 +01:00