1765 Commits

Author SHA1 Message Date
tonihei
3eeb3acb3b Remove nullness suppressions.
These were added in an internal clean-up and are better fixed than suppressed.

PiperOrigin-RevId: 236118715
2019-03-06 17:29:18 +00:00
tonihei
2ae07936ba Handle !resetPosition as initial seek position.
The flag in ExoPlayer.prepare is documented as keeping the current window
index and window position. We are currently using the current period UID and
period position instead. This causes problems when the media source is changed
but the position is not reset.

Using the initial seek position instead ensures we actually use the window
index and position.

Issue:#5520
PiperOrigin-RevId: 236101024
2019-03-06 17:29:18 +00:00
tonihei
377e550d0f Improve new error type documentation and prevent NPE in error listener.
Adding new error types may cause issues when listeners assume a fixed set of
error types and don't handle arbitrary defaults.

Fixing error handling in one case and improving documentation to make people
aware of the issue.

PiperOrigin-RevId: 236093265
2019-03-06 17:29:18 +00:00
tonihei
92a7bb534a Remove wrong documentation.
This is a left-over from the past and is no longer true.

PiperOrigin-RevId: 236089921
2019-03-06 17:29:18 +00:00
olly
b25d2c9978 Adding @SuppressWarnings for the latest stable SDK Q drop
Global Presubmit : https://test.corp.google.com/ui#id=OCL:235456897:BASE:235767406:1551211793273:aa1704f6

LSC doc: go/android-sdk-lsc

PiperOrigin-RevId: 235812819
2019-03-06 17:29:18 +00:00
andrewlewis
8edecd5ccb Update Matroska video codec FourCCs
Issue: #5503
PiperOrigin-RevId: 235523955
2019-03-06 16:55:19 +00:00
andrewlewis
f394697d4a Fix updating rate with codec reuse while disabled
While disabled the renderer does not have non-null stream formats. This means
that setting the operating rate could cause a NullPointerException if there was
a codec for reuse.

Check for being enabled/started before trying to set the operating rate. After
the renderer is enabled it should receive a new input format which will update
the operating rate as needed.

PiperOrigin-RevId: 235494384
2019-03-06 16:55:02 +00:00
andrewlewis
caeaa9574e Avoid draining audio processors while reset
If the DefaultAudioSink was reconfigured in a way that was compatible with the
previous configuration just after having been reset, we would try to drain audio
processors despite not having an AudioTrack. This could result in a
NullPointerException if speed adjustment was active.

Fix this behavior by only trying to drain audio processors if we actually have
an AudioTrack.

PiperOrigin-RevId: 235355466
2019-03-06 16:54:44 +00:00
aquilescanta
eea1ce3e0a Fix channel count propagation on HLS traditional preparation
PiperOrigin-RevId: 235189983
2019-03-06 16:54:08 +00:00
olly
3e03e71cf9 Start enabling database based SimpleCache indexing
- Expose constructor (package private for now, for tests only)
- Add some tests for cache initialization
- Add some TODOs for handling initialization failure

PiperOrigin-RevId: 235188386
2019-03-06 16:53:51 +00:00
olly
ff7f0304e5 Automated g4 rollback of changelist 235153912.
*** Reason for rollback ***

Breaks ExoPlayer's gradle build

*** Original change description ***

Migrate Mockito Matchers.{hamcrestMethods} to MockitoHamcrest.{hamcrestMethods}

All methods accepting a hamcrest Matcher in org.mockito.Matchers have been changed
to only accept an ArgumentMatcher. The corresponding methods are now available on
MockitoHamcrest.

For more information see http://go/mockito-2-lsc

Tested:
    TAP --sample for global presubmit queue
    http://test/OCL:235033293:BASE:234998256:1550793421835:c2ccbbda

***

PiperOrigin-RevId: 235186705
2019-03-06 16:53:32 +00:00
olly
325029d58e Migrate Mockito Matchers.{hamcrestMethods} to MockitoHamcrest.{hamcrestMethods}
All methods accepting a hamcrest Matcher in org.mockito.Matchers have been changed
to only accept an ArgumentMatcher. The corresponding methods are now available on
MockitoHamcrest.

For more information see http://go/mockito-2-lsc

Tested:
    TAP --sample for global presubmit queue
    http://test/OCL:235033293:BASE:234998256:1550793421835:c2ccbbda
PiperOrigin-RevId: 235153912
2019-03-06 16:52:58 +00:00
andrewlewis
8746d4a885 Automated g4 rollback of changelist 230206675.
*** Reason for rollback ***

Reverting as this may break playback on other Amlogic devices and/or playback of non-interlaced content.

*** Original change description ***

Add max video size workaround for Amlogic decoder.

The Amlogic awesome decoder reduces the video size of interlaced videos by half
if the internal configuration isn't force reset with new maximum input size
values. The product of these new values must exceed 1920x1088 to force the
reset.

Issue:#5003

***

PiperOrigin-RevId: 234967314
2019-02-21 11:56:10 +00:00
olly
1450b3713f Suppress warnings emitted by Checker Framework version 2.6.0
PiperOrigin-RevId: 234917536
2019-02-21 11:56:02 +00:00
olly
2685b8bd90 Support multiple instances of database features
- Use Cache UID for CacheContentIndex and CacheFileMetadataIndex. This
  enables SD card swapping for a single device.
- I'm hopeful of finding a way to get the Cache UID to DefaultDownloadIndex
  so we can do the same there.

PiperOrigin-RevId: 234662753
2019-02-20 13:56:08 +00:00
aquilescanta
774c01d020 Make MimeType top level check related methods more robust
Throwing an IllegalArgumentException doesn't help the method signature.

PiperOrigin-RevId: 234579722
2019-02-19 13:23:19 +00:00
andrewlewis
8e7ae9201a Bump version for 2.9.6 release
PiperOrigin-RevId: 234578712
2019-02-19 13:23:19 +00:00
olly
0622afe170 Migrate to androidx
Issue: #5489
PiperOrigin-RevId: 234507428

Add missing annotation dependency

Issue: #5489
PiperOrigin-RevId: 234566177
2019-02-19 13:22:54 +00:00
eguven
03e28d4689 Support stopping/starting single downloads
Also added intent actions to stop/start one or all downloads.

Issue: #4433
Issue: #4860
PiperOrigin-RevId: 234481515
2019-02-18 18:45:49 +00:00
andrewlewis
2b67f2a626 Avoid crashing process on OOM
Catch OutOfMemoryErrors and surface them as unexpected ExoPlaybackExceptions.

PiperOrigin-RevId: 234481140
2019-02-18 17:40:48 +00:00
andrewlewis
e97910a694 Fix seek exception unit
PiperOrigin-RevId: 234475237
2019-02-18 17:40:48 +00:00
andrewlewis
5d8e1784b9 Fix MIME type for divx in Matroska
Issue: #3863
PiperOrigin-RevId: 234453728
2019-02-18 17:40:48 +00:00
andrewlewis
bcadb47a74 Fix typo
PiperOrigin-RevId: 234137695
2019-02-18 17:40:48 +00:00
eguven
b69041bea2 Prevent NullPointerException exceptions in SimpleCache initialization
This is a temporary fix to prevent NullPointerException exceptions.
Though writing to cache will still fail if the cache folder isn't a real
folder.

There are a few thing we can try:
* The listing might be failing because the cache folder is just created.
We can wait and try again.
* If the cache folder is a regular file, we can try deleting and creating
a folder with the same name.

PiperOrigin-RevId: 234121925
2019-02-18 17:40:48 +00:00
andrewlewis
31911ca54a Drain audio processors on reconfiguration
Previously we would get a new AudioTrack and flush all audio processors if any
AudioProcessor needed to be flushed on reconfiguration. This was problematic for
the case of TrimmingAudioProcessor because it could become active or inactive
due to transitioning to a period with gapless metadata or without it (we don't
keep it active all the time because it is wasteful to populate its end buffer
for content that is not gapless).

This change handles the case where we don't need an AudioTrack but
AudioProcessors do need to be flushed. In this case we drain all the audio
processors when next handling data then switch to the new configuration.

This avoids truncation when period transitions change whether
TrimmingAudioProcessor is active but don't require a new AudioTrack, and is also
a step towards draining the AudioTrack when transitioning between periods if we
do need a new AudioTrack.

To do this, it needs to be possible to drain any pending output data from an
AudioProcessor after it's configured to a new format, so this change makes sure
AudioProcessors allow calling playToEndOfStream and getOutput after
reconfiguration and before flush.

PiperOrigin-RevId: 234033552
2019-02-18 17:40:48 +00:00
andrewlewis
83545fb7b2 Factor out common audio processor functionality
PiperOrigin-RevId: 234025553
2019-02-18 17:40:48 +00:00
andrewlewis
03006f0595 Fix some AudioProcessor nits
- Fix nullness warnings
- Fix annotations
- Make TeeAudioProcessor flush its sink for every format change

PiperOrigin-RevId: 234017068
2019-02-18 17:40:48 +00:00
andrewlewis
3e6cf42f83 Factor out default audio sink configuration
This cleanup is in preparation for draining audio processors on reconfiguration
to a format that doesn't require a new AudioTrack to be created.

PiperOrigin-RevId: 233990983
2019-02-18 17:40:48 +00:00
tonihei
edabbd52d0 Update Robolectric and Truth.
PiperOrigin-RevId: 233612344
2019-02-18 15:59:32 +00:00
eguven
5782bbc6e5 Use DownloadState in DownloadManager
PiperOrigin-RevId: 233587184
2019-02-18 15:59:17 +00:00
olly
c66d26b601 Fix EventMessage timestamp issue
Stop encoding/decoding presentation time as part of the message.
What's actually in emsg boxes is a presentation time delta,
which is why it's only 32 bits, and hence why it doesn't handle
large absolute timestamps. We were using this field to hold
absolute timestamps only for the purpose of passing presentation
times from DashManifestParser.parseEvent back to the calling
method. After this change, we return Pair<Long, EventMessage>
instead.

Issue: #5490
PiperOrigin-RevId: 233561731
2019-02-18 15:58:47 +00:00
andrewlewis
ad69a93708 Handle alternative DV MIME types
Also detect ISOBMFF brand for DV when sniffing.

PiperOrigin-RevId: 233433449
2019-02-18 15:58:42 +00:00
olly
a21572f0dd Fix minor issues and lint errors
PiperOrigin-RevId: 233428556
2019-02-18 15:58:37 +00:00
eguven
6a7157de11 Fix flaky test DownloadManager.differentDownloadActionsMerged
PiperOrigin-RevId: 233421480
2019-02-18 15:58:32 +00:00
andrewlewis
56944caa21 Allow registration of control overlays for ad viewability
Switch from passing an ad UI ViewGroup to passing an object that can also
provide information about controls overlays.

Also switch to using a dedicated overlay for ads instead of the overlay frame
layout, which apps have easy access to.

PiperOrigin-RevId: 233393500
2019-02-18 15:58:06 +00:00
olly
8401097ead Upgrade gradle plugin and friends
PiperOrigin-RevId: 233390513
2019-02-18 15:57:55 +00:00
tonihei
abb53d7ce7 Support multiple overrides in TrackSelectionView and factor out Builder.
Supporting multiple overrides allows to select tracks from multiple groups, if
enabled. As more options are added, the creation of the dialog is moved to a
separate builder class.

PiperOrigin-RevId: 233366282
2019-02-18 15:57:44 +00:00
andrewlewis
9b6caf9eda Merge #5438: Dolby Vision
Imported from GitHub PR https://github.com/google/ExoPlayer/pull/5438

Plus the following changes:
- Only support profile 5 (handling other profiles requires
  backward-compatibility changes in the renderer which are left for a later
  change.)
- Only add KEY_PROFILE to the codec configuration MediaFormat for Dolby Vision.
- In MediaCodecUtil support all DV profiles that Android has constants for. This
  includes ones that are "not supported for new applications". Since we don't
  extract these profiles, this is currently only for the benefit of custom
  extractors.
- Misc code style fixes and reordering for consistency.

Merge 37878b975c2bc082b0568e21cbe62bfcef97c10d into 67be9e77834c0dc9d2b5d462c01c2f39718c8817

PiperOrigin-RevId: 233066799
2019-02-18 15:57:14 +00:00
olly
434b5a3029 Enable use of database storage in CachedContentIndex
It's not yet enabled in the SimpleCache layer, however, so
this is a no-op change.

PiperOrigin-RevId: 233064490
2019-02-18 15:57:09 +00:00
andrewlewis
9c3ac92ae8 Allow extension of MatroskaExtractor
Subclasses can handle arbitrary elements.

PiperOrigin-RevId: 233057241
2019-02-18 15:57:04 +00:00
olly
fd979790f2 Some no-op CacheContentIndex cleanup
Push Cipher and SecretKeySpec instantiation into AtomicFileStorage,
since SQLiteStorage no longer needs them.

PiperOrigin-RevId: 233043754
2019-02-18 15:56:49 +00:00
olly
42e691519a Generate per-cache unique identifier.
PiperOrigin-RevId: 233030337
2019-02-18 15:56:44 +00:00
andrewlewis
dec00997e3 Remove deprecated ImaAdsMediaSource and constructors
Given the change to require setPlayer on AdsLoaders, it seems like a good
opportunity to clean up deprecated ads-related symbols.

PiperOrigin-RevId: 233020171
2019-02-18 15:56:39 +00:00
olly
1a5bf28669 Cleanup for database on internal storage
PiperOrigin-RevId: 232923385
2019-02-18 15:56:34 +00:00
olly
dd99fdcb82 Changes for SQLite databases on internal storage
- Remove ability to encrypt content index for SQLite storage
- Remove hack for specifying arbitrary database location

PiperOrigin-RevId: 232863763
2019-02-18 15:56:29 +00:00
olly
a7324061b3 Fix proguard configuration
PiperOrigin-RevId: 232835218
2019-02-18 15:56:24 +00:00
tonihei
f898bddbfc Do not prepare MediaPeriods in a loop.
They may prepare immediately and let pendingMediaPeriods become empty before
all other periods are even created.

PiperOrigin-RevId: 232675283
2019-02-18 15:56:13 +00:00
olly
a6c1dbe156 Implement CacheFileMetadataIndex using SQLite
PiperOrigin-RevId: 232670039
2019-02-06 15:47:08 +00:00
eguven
7eed60c9e3 Add DownloadManager.stopDownloads(int manualStopReason)
Also removed STOP_FLAG_DOWNLOAD_MANAGER_NOT_READY.

PiperOrigin-RevId: 232669463
2019-02-06 15:46:57 +00:00
olly
bdc87a4fc7 API and plumbing for indexing file metadata (length + timestamp)
When SimpleCache uses a CacheFileMetadataIndex, it will be able to avoid
querying file.length() and renaming files, both of which are expensive
operations on some file systems.

PiperOrigin-RevId: 232664255
2019-02-06 15:46:47 +00:00