2700 Commits

Author SHA1 Message Date
aquilescanta
fed2a1a6ea Fix PTS wraparound in HLS+Webvtt
Issue:#2928

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169246424
2017-09-19 18:17:43 +01:00
olly
5b0e693419 Fix DefaultDashChunkSource.updateLiveEdgeTimeUs
Very subtle, but lastAvailableSegmentNum is shifted by
RepresentationHolder.segmentNumShift. When accessing the
index directly it's necessary to unshift. The easiest way
to do this is to call through the holder, which does this
for you.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169239928
2017-09-19 18:16:18 +01:00
eguven
9bdf1ee944 Check if the cache is already empty before trying to evict more span
This case may happen if the max span size is more than the max size the
evictor is configured.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169101093
2017-09-19 18:14:54 +01:00
aquilescanta
5e2c7d967a Fix 2 CEA decoder bugs
1- Avoid dropped buffers by using a PriorityQueue instead of a set.
2- Process the end of stream after non-EOS buffers.

Issue:#3250

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169077365
2017-09-19 18:13:31 +01:00
andrewlewis
457d0ba1b9 Work around broken AAC decoders on Galaxy S6
Issue: #3249

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168844850
2017-09-15 23:49:34 +01:00
aquilescanta
6592a6474e Improve documentation for SCTE35-related metadata
Also expose break_durations in microseconds instead of 90kHz.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168816992
2017-09-15 23:47:12 +01:00
olly
a3a2fb506c Provisioning: Fix some (admittedly quite theoretical) issues:
1. Only tell sessions that want provisioning when provisioning occurs.
2. Also propagate failure to provision to these sessions.
3. If a session responsible for provisioning is released, start
   provisioning using another session instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168713918
2017-09-15 23:44:38 +01:00
olly
a479afff5f Fix potential NPE/ThreadSafety issues with MediaDrm listener
- MediaDrmEventListener.onEvent is typically called on the
  app's main thread. mediaDrmHandler is instantiated on the
  playback thread. Hence mediaDrmHandler should be volatile
  to ensure visibility.
- Nulling mediaDrmHandler could result in a NPE in onEvent.
  Instantiate mediaDrmHandler (and don't null it again) to
  avoid this. MediaDrmHandler.handleMessage will correctly
  discard any events for sessions that are now closed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168707938
2017-09-15 23:43:18 +01:00
andrewlewis
58293abc11 Remove IMA dependency and add AdsMediaSource
AdsMediaSource lives in the core library so only ImaAdsLoader remains in
the ima extension. AdsMediaSource takes an AdsLoader implementation.

ImaAdsMediaSource is deprecated rather than removed for now.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168707921
2017-09-15 23:41:59 +01:00
andrewlewis
f2aed7186e Workaround the skip ad button not being focused
Issue: #3258

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168669969
2017-09-15 23:39:19 +01:00
hoangtc
b3004ab1c3 Do not apply SampleStream skip-ahead for NoSampleRenderer.
Currently, to make transition to next media period seamless, after the renderer
has read until the end of the current SampleStream, we may send it the next
SampleStream so the renderer may read from the next SampleStream ahead of the
transition.
For NoSampleRenderer, we should avoid doing this: skipping ahead for such
renderer doesn't have any benefit (the renderer does not consume data from
SampleStream), and it will change the provided rendererOffsetUs while the
renderer is still rendering from the playing media period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168669800
2017-09-15 23:38:06 +01:00
tonihei
7d59383cc4 Add reason to onPositionDiscontinuity.
This allows listeners to easily determine the source of the discontinuity.
Reasons can be period transitions, seeks, and internal reasons.

Listeners still using the deprecated ExoPlayer.EventListener interface were
updated to Player.EventListener.

GitHub: #3252

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168549612
2017-09-15 23:36:46 +01:00
andrewlewis
872cbec9e1 Add TrimmingAudioProcessor for gapless
Remove gapless functionality that relies on MediaCodec, and implement this in
an AudioProcessor instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168547487
2017-09-15 23:35:33 +01:00
hoangtc
c9591d7617 Added support for No-Sample Renderer.
Currently our Renderer is always associated with and consume data from
some SampleStreams, which were constructed from the provided MediaSource.
There are use-cases, in which the users want to have simple Renderer
implementation that does not consume data from SampleStream at all, but
render using their custom logic at each rendering position - they mostly just
need ExoPlayer to keep track of the playback position and enable/disable the
renderer.
This CL adds support for such Renderer by adding a TRACK_TYPE_NONE.
Renderer of such type will be:
- Associated with null TrackSelection as the result of track-selection
operation.
- Associated with EmptySampleStream.

GitHub: #3212

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168545749
2017-09-15 23:34:21 +01:00
hoangtc
5019da3e7b Update ABR logic in AdaptiveTrackSelection for live streaming case
In live streaming, if the playback position is very close to live edge,
the buffered duration will never reach minDurationForQualityIncreaseMs,
which prevents switching from ever happening. So we will provide the
durationToLiveEdgeUs to AdaptiveTrackSelection in live streaming case,
so it can handle this edge case.

GitHub: #3017

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168535969
2017-09-15 23:33:10 +01:00
olly
39dbb9a7fc De-dupe ACTION_DOWN events
Issue: #3259

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168378650
2017-09-15 23:31:54 +01:00
aquilescanta
f257300d8e Add tv module for USB tuner support + demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168366847
2017-09-15 23:30:41 +01:00
olly
0adb4502f6 Ignore all-zero defaultKid
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168259911
2017-09-15 23:29:28 +01:00
olly
340d0be40a Bump to 2.5.2
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168155713
2017-09-10 16:48:39 +01:00
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
013379fd3e Workaround for SurfaceView not being hidden properly
This appears to be fixed in Oreo, but given how harmless
the workaround is we can probably just apply it on all
API levels to be sure.

Issue: #3160

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167709070
2017-09-06 15:51:01 +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
olly
fb023da529 Fix attr inheritance in SimpleExoPlayerView
When creating PlaybackControlView inside SimpleExoPlayerView,
we want certain attributes to be passed through. This lets you
set control attributes on the SimpleExoPlayerView directly. We
don't want all attributes to be propagated though; only our own
custom ones.

Not sure if there's a cleaner way to do this. Pragmatically this
solution seems ... ok :)?

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167619801
2017-09-06 15:46:44 +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
Oliver Woodman
74b8c45e6d Minor cleanup to AspectRatioFrameLayout 2017-09-04 11:34:57 +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
ojw28
21363d2f8e Merge pull request #3187 from stellabei/stellabei/aspect-ratio-crop
Support zoom mode for AspectRatioFrameLayout
2017-09-04 10:31:21 +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
olly
6bd0ba887c Allow more aggressive switching for HLS with independent segments
We currently switch without downloading overlapping segments, but
we do not actually switch more aggressively. This change fixes
this. Note there's an implicit assumption made that if one media
playlist declares independent segments, the others will too. This
is almost certainly true in practice, and if it's not the penalty
isn't too bad (the player may try and switch to a higher quality
variant one segment's worth of buffer too soon).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167120992
2017-08-31 16:33:43 +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