479 Commits

Author SHA1 Message Date
olly
5a4155f09f Destroy EGLSurface during DummySurface cleanup
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168020525
2017-09-08 22:28:10 +01:00
tonihei
ec38d0d8ab Check thread is still alive before sending message in Loader.
The release callback handler in Loader might not be alive
anymore. Catch this case to prevent warnings about sending
messages on dead threads.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167996538
2017-09-08 22:25:37 +01:00
andrewlewis
7c3fe19d3f Migrate remaining tests to Robolectric
Remaining instrumentation tests either use android.os.Handler or rely on assets.
In the latter case, the tests are difficult to migrate due to differences
between the internal and external build systems, and configuration needed in
Android Studio. In addition, SimpleCacheSpanTest remains as an instrumentation
test because it fails due to a problem with string encoding on the internal
build (and two other tests in its package are kept with it because they depend
on it).

This test removes a dependency from testutils on Mockito, as a different
version of Mockito needs to be used for instrumentation tests vs Robolectric
tests, yet both sets of tests need to rely on testutils. Mockito setup is now
done directly in the tests that need it.

Move OggTestData to testutils so it can be used from both instrumentation and
Robolectric tests.

It may be possible to simplify assertions further using Truth but this is left
for possible later changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167831435
2017-09-08 22:21:33 +01:00
olly
7d4190f3c8 Regroup final/non-final vars
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167717715
2017-09-06 15:56:48 +01:00
olly
c6fa034eba DecryptionException cleanup + add missing header
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167711928
2017-09-06 15:55:21 +01:00
olly
d66143d96d Add full stops
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167711267
2017-09-06 15:53:57 +01:00
olly
e7992513d3 Remove references to MediaDrm from DefaultDrmSession classes
Everything should go through the ExoMediaDrm layer. We still
need to abstract away the android.media exception classes, but
this is left as future work.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167710213
2017-09-06 15:52:28 +01:00
olly
17232f58a3 Fix position reporting during ads when period has non-zero window offset.
Reporting incorrect positions for ad playbacks was causing IMA to
think the ad wasn't playing, when in fact it was.

Issue: #3180

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167702032
2017-09-06 15:49:34 +01:00
andrewlewis
8ef6a2e7bd Clear gapless playback metadata for clipped media
Also pass an unresolved end point to ClippingMediaPeriod. This removes some
assertions checking timestamps in the ClippingMediaPeriod, but makes it
possible to identify when the end point is at the end of the media.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167683358
2017-09-06 15:48:05 +01:00
zhihuichen
b62eab63a4 Implement multi session to support DRM key rotation.
Spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_Android_Using_Key_Rotation.pdf

1. Implement multisession to support drm key rotation
2. Put MediaDrmEventListener back to manager since this is a per mediaDrm thing.
3. It seems diffrenciate between single/multi session is unnecessary.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167602965
2017-09-06 15:45:22 +01:00
olly
0183a83047 Don't use MediaCodec.setOutputSurface on Nexus 7 with qcom decoder
Issue: #3236

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167581198
2017-09-05 16:47:55 +01:00
tonihei
2f4a3fe1f3 Add postDelayed operation to Clock interface.
The default implementation is just calling through to handler.postDelayed,
while the fake clock uses its internal time value to trigger the handler
calls at the correct time.

This is useful to apply a fake clock in situations where a handler is used to
post delayed messages.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167567914
2017-09-05 16:34:44 +01:00
olly
bec5e6e2b2 Rewrite logic for enabling secure DummySurface
Issue: #3215

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167505797
2017-09-05 16:31:44 +01:00
olly
a0df5bb50a Be robust against unexpected EOS in WebvttCueParser
Issue: #3228

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167504122
2017-09-05 16:30:19 +01:00
olly
472df08f08 Additional secure DummySurface device exclusions
Merge: https://github.com/google/ExoPlayer/pull/3225

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167502127
2017-09-05 16:28:46 +01:00
hoangtc
0d86f4475c Remove the resampling to 16bit step from FlacDecoder.
Currently FlacDecoder/FlacExtractor always perform resampling to 16bit. In some
case (with 24bit audio), this might lower the audio quality if the system
supports 24bit audio.
Since AudioTrack implementation supports resampling, we will remove the
resampling step, and return an output with the same bits-per-sample as the original stream.
User can choose to re-sample to 16bit in AudioTrack if necessary.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167494350
2017-09-04 16:30:37 +01:00
andrewlewis
bab2ce817e Allow EXIF tracks to be exposed
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167493800
2017-09-04 16:29:11 +01:00
olly
ab1e4df11a Update moe eqiuvalence
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167488837
2017-09-04 16:27:40 +01:00
ojw28
0da8e1af67 Merge pull request #3225 from dbrain/3215_additional_dummy_secure_surface_exclusions
#3215 Additional secure DummySurface device exclusions
2017-09-04 15:28:50 +01:00
ojw28
1a6a6c901f Merge pull request #3223 from Shyri/vp09-support
Add support for new codecs parameter string
2017-09-04 10:33:02 +01:00
olly
ca2bfbc56e DashManifestParser: Move schemeType up to DrmInitData
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167171407
2017-09-04 10:23:33 +01:00
andrewlewis
daafbb1f1c Add missing Robolectric test path to codebase
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167151714
2017-09-04 10:22:17 +01:00
andrewlewis
f15ce81c47 Move some unit tests to use Robolectric
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167148146
2017-09-04 10:20:59 +01:00
andrewlewis
0b78837f35 Fix ContentDataSource bytesRemaining calculation
The bytesRemaining didn't always take into account any skipped bytes, which
meant that reaching the end of the file was not correctly detected in read().

Issue: #3216

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167016672
2017-08-31 16:32:28 +01:00
andrewlewis
e80a93d799 Use UTF-8 everywhere
UTF-8 is the default charset on Android so this should be a no-op change, but
makes the code portable (in case it runs on another platform).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167011583
2017-08-31 16:29:44 +01:00
Danny Brain
0c7f11606f #3215 Additional secure DummySurface device exclusions 2017-08-31 14:31:18 +10:00
Shyri Villar
49c2926e45 Add support for new codecs parameter string 2017-08-30 16:25:50 +02:00
olly
b0df6dce98 Fix moe config
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166914821
2017-08-29 23:55:19 +01:00
olly
5bed2bf503 Don't copy primary-track format to non-primary tracks
This time plumbing the track type in from the other side.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166898172
2017-08-29 23:17:16 +01:00
olly
d9cd13ce74 Automated rollback of changelist 166843123.
*** Reason for rollback ***

Doesn't work because trackOutputProvider can be null when extracting init data.

*** Original change description ***

Don't copy primary-track format to non-primary tracks

Copying non-primary-track formats to non-primary tracks
looks non-trivial (I tried; went down a dead-end), so
leaving that for now.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166883654
2017-08-29 23:14:33 +01:00
olly
55e928f75a Make LeanbackPlayerAdapter use a ControlDispatcher + Misc cleanup
1. Make LeanbackPlayerAdapter use a ControlDispatcher. This
   allows apps to suppress control events in some circumstances,
   and is in-line with our mobile controls.
2. Misc simplifications and cleanup to LeanbackPlayerAdapter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166852816
2017-08-29 23:13:13 +01:00
olly
44dc3c3ab3 Make all renderers DRM aware
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166852758
2017-08-29 23:11:55 +01:00
aquilescanta
aafdd2267a Add media queue support to CastPlayer
Also workaround the non-repeatable queue and fix other minor issues.

Issue:#2283

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166848894
2017-08-29 23:09:03 +01:00
olly
f44e30c754 Fix mapping CLEARKEY_UUID to COMMON_PSSH_UUID
This mapping when we call into platform components also needs
to be applied when creating the MediaCrypto instance. The fix
is to stop propagating the UUID through all the createMediaCrypto
methods. This is unnecessary, since the eventual target already
knows its own UUID!

Issue: #3138

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166843372
2017-08-29 23:07:39 +01:00
olly
3e76227006 Don't copy primary-track format to non-primary tracks
Copying non-primary-track formats to non-primary tracks
looks non-trivial (I tried; went down a dead-end), so
leaving that for now.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166843123
2017-08-29 23:06:16 +01:00
andrewlewis
ba6d208fe9 Use Math.abs in Sonic.java
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166820970
2017-08-29 23:04:52 +01:00
eguven
cc58b515b7 Make Downloaders open source
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166486294
2017-08-29 23:03:08 +01:00
tonihei
30b31b5679 Support empty concatenations and empty timelines in concatenations.
Both cases were not supported so far. Added tests which all failed in the
previous code version and adapted the concatenated media sources to cope with
empty timelines and empty concatenations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166480344
2017-08-29 23:01:41 +01:00
olly
6e03dcdfa1 Add LocalMediaDrmCallback. Useful for providing local keys.
Issue: #3178

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166330215
2017-08-29 22:55:51 +01:00
olly
57bad31e4c Update documentation with new demo app location
Plus a few misc doc fixes / adjustments

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166323135
2017-08-29 22:54:26 +01:00
tonihei
eeebb3968b Implement shuffle mode logic in ExoPlayerImplInternal.
This is mostly connecting the already stored shuffleMode with the timeline queries
for the playback order.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166199330
2017-08-29 22:50:49 +01:00
tonihei
f7eba77ee0 Add shuffle support to dynamic concatenating media source.
The media source is initialized with a DefaultShuffleOrder which can be changed at
any time. Whenever the list of media source is changed, the shuffle order is adapted
accordingly (either on the app thread if the player is not prepared yet, or on the
player thread). The shuffle order is then used to construct the timeline.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166198488
2017-08-29 22:48:10 +01:00
tonihei
e15633e906 Add shuffle support to ConcatenatingMediaSource.
The media source is initialized with a DefaultShuffleOrder which can be changed at
any time. This shuffle order is then used within the corresponding timeline.

The isRepeatOneAtomic flag is extended to also suppress shuffling (now called
isAtomic only).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166197184
2017-08-29 22:46:54 +01:00
andrewlewis
8115e11489 Allow subclasses to customize the MediaFormat
Make getMediaFormat protected so that subclasses can set additional MediaFormat
keys. For example, if the decoder output needs to be read back via an
ImageReader as YUV data it is necessary to set KEY_COLOR_FORMAT to
COLOR_FormatYUV420Flexible.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166195211
2017-08-29 22:45:28 +01:00
tonihei
9fd19d0e7c Add shuffle logic to concatenated timelines.
The implementation in the abstract base class takes care to forward the queries
to the correct methods given the shuffle mode and a given shuffle order.

All concatenated timeline implementations use an unshuffled order so far. The
handling of the shuffle orders will follow in other changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166191165
2017-08-29 22:42:56 +01:00
tonihei
4883a9ba9a Add shuffle support to infinitely looping timeline.
In addition, let unit test assert window indices for both shuffle modes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166191069
2017-08-29 22:41:39 +01:00
tonihei
bd81181892 Add shortcut methods to query next or previous window index.
This functionality is most likely needed by UI modules which currently need
to obtain the timeline, the current repeat and shuffle modes and are only then
able to query the next/previous window index using this information.

Adding these methods simplifies these cumbersome requests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166181202
2017-08-29 22:40:13 +01:00
tonihei
2c8d5f846e Pass shuffle mode to timeline assertion helper methods.
This allows to test the expected behaviour of timeline with different shuffle modes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166181091
2017-08-29 22:38:50 +01:00
tonihei
10f1bd7396 Add shuffle mode parameter to Timeline interface methods.
This parameter is used by methods such as getNextWindowIndex
and getPreviousWindowIndex to determine the playback order.
Additionally, there are method to query the first and last
window index given the shuffle mode.

None of the timeline implementations nor the ExoPlayer
implementation supports shuffling so far.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166170229
2017-08-29 22:37:27 +01:00
tonihei
5214bfa7b1 Update ExoPlayerImplInternal with shuffle mode changes.
The shuffle mode is saved using a message on the playback thread.
After setting the shuffle mode, the same media period holder verification
as for repeat mode changes gets executed.

Note: the shuffle mode is not used yet to change the playback order.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166060231
2017-08-22 16:27:18 +01:00