476 Commits

Author SHA1 Message Date
andrewlewis
43cfb08207 Handle VAST_LINEAR_ASSET_MISMATCH
This error marks the current ad group as unplayable.

Issue: #3801

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185663472
2018-02-16 11:57:22 +00:00
andrewlewis
5b6344a006 Skip ads for which the media failed to prepare
Also make ad group skipping more robust. After calling onError for an ad, IMA
will sometimes trigger an ad group load error, so this needs to be handled in a
way that allows some ads to be loaded already for the ad group.

This change also fixes calculation of the expected ad index to take into account
whether the position is being faked to trigger loading an ad or is the actual
player position.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185655844
2018-02-16 11:55:02 +00:00
andrewlewis
4cb2d255ab Fix handling of ad tags where ad groups are out of order
IMA's cue points may not be in order, so sort them. It looks like IMA events use
time ordered ad indices, so it is not necessary to map between the original cue
point order and the time order.

Issue: #3716

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185495798
2018-02-16 11:48:58 +00:00
olly
77ec24ca58 Translation console import
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185409304
2018-02-16 11:47:49 +00:00
tonihei
c14ef75037 Move (almost all) remaining core library instrumentation tests to Robolectric.
There are 4 tests which can't currently be moved:
 - DownloadManagerTest explicitly uses the main looper which isn't easily
   supported because the test runs on this thread.
 - ContentDataSourceTest uses an AssetFileDescriptor which wraps a
   ParcelFileDescriptor. It seems Robolectric doesn't correctly forward the
   inner wrapped file descriptor leading to NPE.
 - CacheContentIndexTest and SimpleCacheSpanTest both work fine with Gradle
   but fail with seemingly valid test failures on Blaze.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185366678
2018-02-16 11:46:34 +00:00
andrewlewis
b6a46fd3ee Set the expected ad group based on the content position
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185139106
2018-02-16 11:44:29 +00:00
andrewlewis
ac2f6cbf98 Move two further methods from Timeline to AdPlaybackState
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185138158
2018-02-16 11:43:31 +00:00
andrewlewis
f432b52111 Link libopus statically with libopusJNI
We now build one .so file for the opus extension in the
internal build, so make the external build work the same way.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184962896
2018-02-08 14:49:00 +00:00
andrewlewis
6fc70149b5 Fix ad group skipping
Allow skipping an ad group when requested by IMA, even if we aren't currently
playing one, to handle cases where no ads in an ad group will load (so IMA
requests resuming content but we never managed to start playing an ad).

Use the known ad group index (rather than the expected one) when handling ad
group load errors. This ensures we skip the right ad group if we notify IMA of
playback errors for every ad in the ad group, then IMA notifies that the ad
group is empty via a load error.

Also make some other miscellaneous small fixes to ads code:

- Avoid warning about unexpected ad group indices more than once.
- Output a warning if the ad count in an ad group decreases.
- Remove unnecessary assertion.
- Fix getting the ad duration for ad indices that haven't loaded yet.
- Allow setting an ad group state to its current value.
- Fix javadoc for setting the ad resume position.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184831495
2018-02-08 14:49:00 +00:00
andrewlewis
165fce4c64 Get the next ad index to play in MediaPeriodQueue
The ad index in the ad group may need to skip over ads that failed to load, so
it can't just be incremented any more.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184812556
2018-02-08 14:49:00 +00:00
aquilescanta
8f81abee86 Prevent "unexpected read attempt" illegal state exception
When using cronet data source, calling read after the end of input has
been read will trigger this.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184667794
2018-02-08 14:49:00 +00:00
andrewlewis
aa63ad3af0 Handle LOG AdEvents for ad group load errors.
If IMA loads an empty VAST document for an ad group it notifies via a LOG
AdEvent. Handle the event by updating the AdPlaybackState accordingly.

The error state will be handled in ExoPlayerImplInternal in a separate change.

Issue: #3584

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184516585
2018-02-08 14:49:00 +00:00
anjalibh
c57210caaf Reduce Libvpx output buffers to 8, to reduce the chances of out of memory errors.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184317120
2018-02-08 14:49:00 +00:00
andrewlewis
451721d4a7 Update internal opus build
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184274139
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
olly
340501246b Fix dependency in cast extension
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184125114
2018-02-01 15:31:24 +00:00
olly
ca3be996bc Add proper exception checks when returning to native from Java.
The pending exception will be thrown upon returning to Java
from native, but we should return early rather than continuing
to execute the native method to the end so as to avoid undefined
behavior. Note that the return value is irrelevant (because the
pending exception will be thrown).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184119606
2018-02-01 15:22:32 +00:00
olly
1bf4926338 Stop using Map<Integer, X>
Lint recommends switching to SparseArray<X> instead.
This is done for the DASH case. For the Cast case it's
easier to use a switch statement.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184119312
2018-02-01 15:21:08 +00:00
tonihei
430579dcd9 Update developer guide for sending messages again.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184119097
2018-02-01 15:18:13 +00:00
olly
a7d4d2d21c Automated g4 rollback of changelist 184056034.
*** Reason for rollback ***

Broke everything

*** Original change description ***

Clean up message naming in EPII

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184061352
2018-02-01 15:13:51 +00:00
olly
2f932bfaf7 Clean up message naming in EPII
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184056034
2018-02-01 15:11:00 +00:00
strobe
fb0b7a7f86 Fix green bar bug
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184022988
2018-02-01 15:09:18 +00:00
aquilescanta
e7ba2caf47 Clear the media queue and stop casting on app pause
Simplifies the app and prevents inconsistent states between
both players and the media queue.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183831329
2018-02-01 15:04:54 +00:00
andrewlewis
b82178ecb4 Make ad state immutable and store state of each ad
Before this change, the ad playback state stored the number of played ads in
each ad group. There was no way to represent that an ad had failed to load (and
it wouldn't be possible just to increment the played ad count to signal a load
error because there might be an unplayed ad before the ad that failed to load).

Represent the state of each ad (unavailable, available, skipped, played, error)
in each ad group. In a later change the player will use this information to
update its loaded MediaPeriods in response to future ads failing to load.

Also make the AdPlaybackState immutable and remove copying/duplication of its
fields in the ad timeline and period.

Issue: #3584

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183655308
2018-02-01 14:57:45 +00:00
olly
0c67a5783f Add descriptions for strings.
For our strings to be translated, we're required to provide
added context in the form of a description, and specify a
maximum length for the translated strings.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183651515
2018-02-01 14:56:18 +00:00
olly
1f6d161d4d Fix proguard configurations
1. When we try and load something via reflection and find the
   class, always throw rather than failing silently if we
   subsequently fail to instantiate an instance. This is
   indicative of a broken proguard setup, and failing silently
   makes it hard to spot.
2. Add library/core proguard configuration to ensure extension
   renderer constructors that we access via reflection are kept.
3. Add demos/main proguard configuration to ensure ImaAdsLoader
   constructor that we access via reflection is kept.
4. Added IMA proguard file to hopefully fix #3723, although I
   wasn't actually able to reproduce the issue.

Issue: #3723

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183648187
2018-02-01 14:52:16 +00:00
aquilescanta
ac630b616c Propagate RemoteMediaClient's current duration to timeline if necessary
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183390851
2018-02-01 14:36:20 +00:00
tonihei
46c4ca7ddb Add CompositeMediaSource to handle common tasks for composite media sources.
This removes some boiler-plate code for compostite sources and will also
simplify resuing media source in the future (because this class can keep track
of child listeners).

Issue:#3498

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183387123
2018-02-01 14:33:15 +00:00
aquilescanta
8716c0ee32 Implement a best-effort DRM session acquisition approach
Try to delay failure for as long as possible. That is, propagate
DRM session failures only after an encrypted buffer arrives or clear
sample playback without session is not allowed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183076348
2018-01-24 19:56:41 +00:00
Oliver Woodman
c8298e70b1 Update version of rtmp-client to 3.0.1 2018-01-24 10:51:31 +00:00
andrewlewis
d240249b6c Work around missed ad LOADED events
Track the expected next ad group index so that it can be used as a fallback if
IMA does not notify the ad index via a LOADED event.

Also do some miscellaneous minor cleanup (including logging all LOG events, and
logging at debug level where appropriate).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183048612
2018-01-24 10:33:29 +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
olly
4828f275c7 Make play button behave differently in IDLE and ENDED states
- In IDLE, the button will now call a preparer. This allows
  removal of the separate retry button from the demo app.
- In ENDED, the button will seek back to the default position
  and play.
- Behavior is made consistent with LeanbackPlayerAdapter.

Issue: #3689

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182506855
2018-01-23 19:07:52 +00:00
olly
c577d9d351 Let SimpleExoPlayerView/LeanbackPlayerAdapter bind with any Player
Also sanitize naming (PlayerView/PlayerControlView).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182364487
2018-01-23 19:00:20 +00:00
eguven
965bc4f677 Add JobDispatcherScheduler
This is a Scheduler implementation which uses Firebase JobDispatcher.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182051350
2018-01-23 18:44:17 +00:00
andrewlewis
6bed2ffc04 Remove ndk-build from [] flac build rules
Android NDK r9 in [] is deprecated (see []

Update the ExoPlayer flac extensions to use android_jni_library.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182017669
2018-01-23 18:41:05 +00:00
Oliver Woodman
141f3aa836 Simplify PGS captions + sync with internal tree 2018-01-15 14:13:30 +00:00
ojw28
96b7daa93a
Merge pull request #3667 from alexcohn/ndk-r16-support
minimal fix to support NDK r16
2018-01-15 13:47:05 +00:00
andrewlewis
13fbe7b2f2 Fix cronet extension package name
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181331715
2018-01-15 11:40:29 +00:00
andrewlewis
96e490d7fe Make it possible to subclass LibvpxVideoRenderer
Make LibvpxVideoRenderer non-final and add protected methods to match
MediaCodecVideoRenderer.

Reorganize methods to separate BaseRenderer, protected and internal methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181320714
2018-01-15 11:36:09 +00:00
tonihei
4ee971052b Improve Extractor partial read tests.
Partial reads were performed once using a partial size of 1 byte.
This was not enough to detect problems which only occur in combination
with IOExceptions. Partial reads are now only applied when no exception
is thrown.

Moreover, the tests didn't check whether the total number of sampled bytes
is what it is supposed to be. Added a field to the data dumps checking
the total number of bytes in the sampled data.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181296545
2018-01-15 11:33:23 +00:00
andrewlewis
682953c411 Fix typos
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180778084
2018-01-04 15:54:01 +00:00
tonihei
183870d9d3 Update Cronet extension readme on how to enable Java 8 features.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180660349
2018-01-04 15:45:26 +00:00
olly
7b9f71b44d Don't kill the process if SimpleDecoder.decode throws.
Issue: #3645

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180659855
2018-01-04 15:44:00 +00:00
Alex Cohn
2cc044ded1 minimal fix to support NDK r16 2018-01-04 13:22:13 +02:00
tonihei
22f8ee37d4 Clean-up of player message handling.
Some readability fixes for PlayerMessage and the handling in
ExoPlayerImplInternal.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180544294
2018-01-03 13:34:36 +00:00
tonihei
ec71c05e8b Add possiblity to send messages at playback position.
This adds options to ExoPlayer.sendMessages which allow to specify a window index
and position at which the message should be sent. Additionally, the options can be
configured to use a custom Handler for the messages and whether the message should
be repeated when playback reaches the same position again.

The internal player converts these window positions to period index and position
at the earliest possibility. The internal player also attempts to update these
when the source info is refreshed. A sorted list of pending posts is kept and the
player triggers these posts when the playback position moves over the specified
position.

Issue:#2189

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179683841
2018-01-03 13:34:36 +00:00
tiffanywong
3b633f81b2 Automated g4 rollback of changelist 179563355.
*** Original change description ***

Add possiblity to send messages at playback position.

This adds options to ExoPlayer.sendMessages which allow to specify a window index
and position at which the message should be sent. Additionally, the options can be
configured to use a custom Handler for the messages and whether the message should
be repeated when playback reaches the same position again.

The internal player converts these window positions to period index and position
at the earliest possibility. The internal player also at...

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179666357
2018-01-03 13:34:36 +00:00
tonihei
6c2d1e1966 Add possiblity to send messages at playback position.
This adds options to ExoPlayer.sendMessages which allow to specify a window index
and position at which the message should be sent. Additionally, the options can be
configured to use a custom Handler for the messages and whether the message should
be repeated when playback reaches the same position again.

The internal player converts these window positions to period index and position
at the earliest possibility. The internal player also attempts to update these
when the source info is refreshed. A sorted list of pending posts is kept and the
player triggers these posts when the playback position moves over the specified
position.

Issue:#2189

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179563355
2018-01-02 21:36:07 +00:00
andrewlewis
8e35bffcc3 Use playAd/stopAd to control position updates switching
Previously the ad/content progress updates were toggled based on whether the
player was playing ads or content. After this change, we switch based on
whether playAd/stopAd has been called instead.

This seems to resolve an issue where occasionally the player would get stuck at
the start of an ad, but as I don't have a root cause for that issue and it's
only sporadically reproducible I'm not certain this is a reliable fix.

Issue: #3525

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179169296
2017-12-15 12:15:20 +00:00