3161 Commits

Author SHA1 Message Date
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
olly
f2f5aac7c5 Allow audio position to jump on first input buffer
Allow the position to jump on receiving the first presentable input buffer,
if and only if the buffer timestamp differs significantly from what was
expected. This prevents a stuck buffering case for streams that are thought
to start at t=0, but actually start at t=large_value.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186990214
2018-02-26 15:41:18 +00:00
olly
e3d4464635 Drop EMSG atoms before MOOV
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186454715
2018-02-21 23:40:48 +00:00
olly
44f683e04e Fix robolectric tests when running with gradle
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186291489
2018-02-20 14:32:34 +00:00
olly
69496eb17e Bump to 2.7.0 and prepare release notes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186200840
2018-02-19 13:24:51 +00:00
tonihei
2406785160 Move DownloadManagerTest to Robolectric.
The waiting for a ConditionVariable to be false was replaced by a
CountDownLatch whose count is asserted to be one. The timeout of a
ConditionVariable doesn't work in Robolectric unless someone is
manually increasing the SystemClock time.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186003125
2018-02-19 13:23:32 +00:00
andrewlewis
6c3b677ddb Catch exceptions in all IMA callbacks
If an exception is thrown in an IMA callback it crashes the process with lots of
logging from WebView (including several stack traces, etc.). This change wraps
ImaAdsLoader code that might throw, skips any remaining ads (as the errors are
not recoverable, in general) and notifies a new load error callback so that the
application can implement its own handling. The intention is to make the loader
robust to unexpected requests from IMA and avoid crashes.

Also handle IMA loading an ad in an ad group that has no available ads. In rare
cases IMA will try to load an ad for which an error was previously notified, so
this drops those load requests allowing playback of the content to continue.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185985850
2018-02-19 13:20:15 +00:00
aquilescanta
8ffd40ab9a Add little endian and 14-bit mode support for DtsReader
Issue:#3340

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185973510
2018-02-16 12:11:46 +00:00
tonihei
67780bfbc2 Add window sequence number to MediaPeriodId.
All media periods are part of a queue of windows buffered and played by
ExoPlayer. When repeating windows, the current MediaPeriodId is insufficient
to distinguish between the repetitions of the same period. This makes it hard
to see to which media period load events belong to, and it is also difficult to
determine whether two media periods belong to the same logical window or
whether they are part of different repetitions of the same window.

Therefore this change adds a unique sequence number to each window in the
sequence of windows and this sequence number is saved as part of the
MediaPeriodId.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185829509
2018-02-16 12:10:25 +00:00
tonihei
6af2a3c9ef Broaden the surface switching workaround to other Moto C+ variants.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185681751
2018-02-16 12:06:23 +00:00
aquilescanta
1d4bc7dda7 Add initial support for EXT-X-GAP
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185676652
2018-02-16 12:03:49 +00:00
eguven
c8e950537d Run DownloadManager on a custom thread while testing
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185674707
2018-02-16 12:02:36 +00:00
olly
55f2b09340 Use stable order for subtitle buffers with identical timestamps
Issue: #3782

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185673731
2018-02-16 12:01:19 +00:00
aquilescanta
115d199532 Fix CeaUtil's invalid SeiMessage skipping
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185673454
2018-02-16 12:00:05 +00:00
aquilescanta
4d26b316cc Make ID3 GEOB frames parsing more robust
Issue:#3792

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185668919
2018-02-16 11:58:52 +00:00
tonihei
09de29d534 Add Meizu M5C, Lenovo K4 Note, and Sony Xperia E5 to surface workaround.
Also added comments for all existing devices for easier reference.

Issue:#3835
Issue:#3236

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185661900
2018-02-16 11:56:08 +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
b9f9232b9d Release Extractors on the loading thread
Releasing the player released the internal playback thread once renderers were
released. Releasing a MediaPeriod queued a Loader.ReleaseTask on the loading
thread which would post back to the playback thread. If the playback thread had
been quit by the time this happened, the release task wouldn't be run.

Release on the loading thread instead of the playback thread. This avoids
needing to block releasing the player until the loading threads have ended, and
ensures that release tasks will run eventually. As part of this change,
ExtractorMediaPeriod's call to Extractor.release will now run on the loading
thread (which means that all Extractor methods are called on that thread) and
other cleanup in ReleaseCallback will run on the loading thread instead of the
playback thread.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185651320
2018-02-16 11:53:51 +00:00
olly
2dab21ab4e Add Y611 to setOutputSurfaceWorkaround
Issue: #3724

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185548632
2018-02-16 11:52:37 +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
tonihei
51a88ac59d Add Moto C+ to surface switching workaround.
Issue:#3835

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185501181
2018-02-16 11:50:05 +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
eguven
fc7a6d2596 Increase character limit for download notification strings
This is requested for Romanian translation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185359071
2018-02-16 11:45:27 +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
eguven
2c2aaf0a4b Make SegmentDownloadAction constructor keys parameter simpler
Removed option to pass null keys parameter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185134822
2018-02-16 11:42:21 +00:00
tonihei
4916baabf0 Fix bug in media period queue update at dynamic timeline changes.
If the period uid doesn't match, the update procedure currently doesn't
remove the correct periods. This may cause the player to get stuck or to play
the wrong periods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185129503
2018-02-16 11:41:16 +00:00
aquilescanta
a9e11e4107 Extend support of 608 captions in SEI messages
Issue:#3816

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185124378
2018-02-16 11:40:20 +00:00
andrewlewis
34a318d348 Check sys.display-size on Philips ATVs
Device models are from
https://support.google.com/googleplay/answer/1727131?hl=en. It looks like among
these devices Build.MANUFACTURER can be set to either "PHILIPS" or "Philips",
based on looking at internal bug reports.

Issue: #3807

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185121182
2018-02-16 11:39:15 +00:00
eguven
0e51a77839 Add message parameter to DownloadNotificationUtil.createNotification
DownloadNotificationUtil should not use getData().

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185002149
2018-02-16 11:38:11 +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
tonihei
81eed7c2c3 Support isAtomic flag in DynamicConcatenatingMediaSource.
This feature is supported in the ConcatenatingMediaSource and is easily copied to this
media source. Also adding tests to check whether the atomic property works in normal
concatenation and in also in nested use.

Also fixes a bug where timeline methods of the DeferredTimeline were not correctly
forwarded.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184526881
2018-02-08 14:49:00 +00:00
tonihei
4437de4818 Fix potential media source release before media period release.
This could happen when a media source is removed from a
DynamicConcatenatingMediaSource and one of its media periods is still active.
This media period is only removed by the player after the player received
a timeline update and thus we shouldn't release the removed child source
as long as it has active media periods.

Issue:#3796

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184522836
2018-02-08 14:49:00 +00:00
andrewlewis
901dd19e3e Fix media period queue updating for ads
Resolve the media period for ad playback when resolving a subsequent period and
when receiving a timeline where the playing period in range (but wasn't before).

Fix the seek position calculation when a current ad must be skipped and is
followed by another ad.

Check MediaPeriodInfos match when checking MediaPeriodHolders, to handle cases
where a future ad should no longer be played. This may involve playing two
content media periods consecutively.

Issue: #3584

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184514558
2018-02-08 14:49:00 +00:00
eguven
de293af3a4 Fix not thread safe static buffer usage
DefaultExtractorInput.SCRATCH_SPACE buffer is used to skip data by
reading it into this buffer and discarding.

Simultaneous use of skip methods corrupts this buffer. Normally the
read data is discarded so it doesn't matter but the underlying
DataSource may use the buffer too. If it's a CacheDataSource it uses
this buffer to read data from upstream then write to cache.

Issue: #3762

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184502170
2018-02-08 14:49:00 +00:00
andrewlewis
e437248f4f Refer to E-AC3 JOC rather than Atmos in MIME type/comments
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184501752
2018-02-08 14:49:00 +00:00
andrewlewis
75574928e5 Only override gapless data if set in ClippingMediaPeriod
This avoids reading a format that is not equal because of switching between
NO_VALUE and 0.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184298076
2018-02-08 14:49:00 +00:00
andrewlewis
0b2497799f Interrupt the test thread for uncaught errors
This makes assertion errors in code running on the Looper less easy to miss.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184294290
2018-02-08 14:49:00 +00:00
andrewlewis
10033623e7 Handle repeat mode/shuffle mode changes in MediaPeriodQueue
This should be a no-op change.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184150266
2018-02-08 14:49:00 +00:00
eguven
a075b23893 Fix API level 16 method use without guard and refactoring
For below API level 16, the logic copied from ConnectivityManagerCompat.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184131406
2018-02-08 14:49:00 +00:00
eguven
61ba0f2827 Fix FilteringHlsPlaylistParser
Only filter HlsMasterPlaylists.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183394956
2018-02-08 14:49:00 +00:00
eguven
e1dbaf26c2 Add DownloadNotificationHelper
Helper class to create notifications for downloads using DownloadManager.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183225948
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
tonihei
c8f39fe14d Update ExoPlayer doc to specifically discourage parallel access instead of allowing it.
Even if a developer synchronizes every method, thread safety is still not guaranteed
because the internal callback methods can't be synced from outside.

Issue:#3773

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184122072
2018-02-01 15:30:00 +00:00
olly
51963dea2e Clean up message naming in EPII
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184122057
2018-02-01 15:28:30 +00:00
olly
1950152378 Tweak download notifications
1. Add string for STATE_CANCELED. Lint doesn't like that the
   switch statement on the state IntDef doesn't have a case
   for STATE_CANCELED. May as well add one, even if we're not
   planning on our demo app showing notifications for this
   state.
2. Replace non-human-readable error message with one provided
   by ErrorMessageProvider.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184120892
2018-02-01 15:27:01 +00:00
olly
e8fb3078d6 Normalize language code independently of device language
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184120873
2018-02-01 15:25:31 +00:00
olly
696ebf3ded Suppress proguard notes about unresolved classes
In the case of the components we deliberately access via
reflection, it's normal that they might not be resolved
due to proguarding (i.e. if the app isn't being built to
include them). Don't note their omission.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184120611
2018-02-01 15:24:00 +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