10750 Commits

Author SHA1 Message Date
bachinger
cad2c50c34 Add jacoco.exec files to .gitignore
#minor-release

PiperOrigin-RevId: 359041513
2021-02-23 16:53:06 +00:00
olly
c067ee8853 Fix CacheWriter to handle potential DataSink write failures
- If DataSource.close fails then it's unknown whether the underlying file was
  written to the cache. We should assume that it has not been.
- Always re-query cachedBytes at the start of CacheWriter.cache, since its
  current value may be incorrect if a previous failure was the result of a
  file not being written to the cache.

PiperOrigin-RevId: 359039109
2021-02-23 15:06:38 +00:00
gyumin
520f77bef5 Mark convenience methods as final in BasePlayer
PiperOrigin-RevId: 359021944
2021-02-23 15:06:28 +00:00
bachinger
45b0c98128 Make media session extension depend on common module only
PiperOrigin-RevId: 359001281
2021-02-23 12:30:41 +00:00
marcbaechinger
95fcfdd71d Merge pull request #8539 from larryng:patch-1
PiperOrigin-RevId: 359000734
2021-02-23 12:30:31 +00:00
olly
920d2e03e6 Remove unused mocking in CacheWriterTest
#minor-release

PiperOrigin-RevId: 358998449
2021-02-23 12:30:22 +00:00
olly
b4b22d9808 Simplify Resource.isEndOfInputExpected
- Make it a property of the DataSource, not of the resource.
- Apply it only when a contract test reads using an
  unbounded DataSpec.

PiperOrigin-RevId: 358997735
2021-02-23 12:30:14 +00:00
olly
691ac39fcb Read to end-of-stream for HTTP contract tests
#minor-release

PiperOrigin-RevId: 358847933
2021-02-23 12:30:06 +00:00
ibaker
7b692f9676 Pass the session state to the onDrmSessionAcquired listener method
PiperOrigin-RevId: 358823166
2021-02-23 12:29:59 +00:00
ibaker
c64a1a0c3c Add tests to CopyOnWriteMultisetTest for modification during iteration
This is a key use-case for copy-on-write collections.

PiperOrigin-RevId: 358807866
2021-02-23 12:29:51 +00:00
ibaker
623597addb De-duplicate DRM acquire & release events by EventDispatcher
When we add DRM pre-acquire support to SampleQueue, we'll dispatch
twice the number of acquire and release events. This is slightly
confusing, since there's the same number of
DrmSessionManager#acquireSession() calls.

We can mitigate this by only dispatching each acquire and release
event to at most one EventDispatcher.

This also changes the events fired when playing a stream with both audio
and video encrypted with the same keys (even without pre-acquisition).

Before: The EventDispatcher would see 2 aquires, 1 key load and 2
release events.

After: The EventDispatcher will see 1 acquire, 1 key load and 1 release.
PiperOrigin-RevId: 358804502
2021-02-23 12:29:43 +00:00
gyumin
0eed19d8a3 Add @Documented to FieldNumber @IntDef
PiperOrigin-RevId: 358799813
2021-02-23 12:29:35 +00:00
gyumin
ff269403bf Lower minSdkVersion to 16 for media2 extension
From media2 1.1.0, it supports API level 16 and above.

PiperOrigin-RevId: 358797986
2021-02-23 12:29:27 +00:00
ibaker
8d942dc213 Simplify release event logic in DefaultDrmSession
This is a no-op assuming the class is always used correctly.
When release causes referenceCount to reach zero there can be at most
one EventDispatcher still connected (which is the one that must be
passed to that final release() call), so we can always pass the event
directly to the EventDispatcher passed in to release().

PiperOrigin-RevId: 358794004
2021-02-23 12:29:19 +00:00
krocard
399e1365d0 Add missing @Nullable to method override.
Method override parameter nullness should contravariant.

PiperOrigin-RevId: 358772798
2021-02-22 10:35:41 +00:00
tonihei
ceb76f35e9 Align pattern of calling deprecated listener methods.
There are two different patterns we use at the moment:
 1. Call both deprecated and non-deprecated method from call site with
    no default method implementation body.
 2. Use default method of non-deprecated method to call deprecated
    method.

Pattern 1 is easier to reason about as it makes the calls more explicit,
so changing all usages of pattern 2 to pattern 1.

PiperOrigin-RevId: 358769803
2021-02-22 10:35:30 +00:00
ibaker
93a608d507 Static import Assertions methods in DefaultDrmSessionManager
PiperOrigin-RevId: 358384778
2021-02-22 10:35:22 +00:00
ibaker
74ad0949fd Add support for preparing DRM sessions before they're needed
This adds an optional DrmSessionManager#preacquireSession() method
and implements it on DefaultDrmSessionManager.

The manager doesn't promise to keep the preacquired sessions alive, and
will proactively release them if a ResourceBusyException suggests the
device is running out of available sessions in the underlying framework.

In a future change, SampleQueue will preacquire sessions on the loading
thread and keep track of preacquired 'references', releasing them
when seeking or clearing the queue.

Issue: #4133
PiperOrigin-RevId: 358381616
2021-02-22 10:35:14 +00:00
aquilescanta
ecb109dad8 Make MediaParser available for use in progressive media
PiperOrigin-RevId: 358379167
2021-02-22 10:35:06 +00:00
bachinger
36cbcb30b6 Set explicit export attributes in all demo apps
Starting with Android 12 all components of an app that have an intent filter need to have an explicit attribute android:export that is set to either true or false. If a component filters for the MAIN or a VIEW action it needs the attribute explicitly set to true. Prior to Android 12 these were exported implicitly.

See https://medium.com/androiddevelopers/lets-be-explicit-about-our-intent-filters-c5dbe2dbdce0

PiperOrigin-RevId: 358368785
2021-02-22 10:34:58 +00:00
tonihei
1a12018dae Add ConcatenatingMediaSource version that fully combines windows.
The published Timeline contains one window only with all periods of
the child sources.

Issue: #4868
PiperOrigin-RevId: 358150276
2021-02-19 10:58:05 +00:00
andrewlewis
7b119beffb Add Maven publishing support
The release AAR and Android sources are included for each published artifact.

Issue: #5246
Issue: #8353

#minor-release

PiperOrigin-RevId: 358146555
2021-02-19 10:57:57 +00:00
tonihei
7830eb7ae5 Ensure non-fatal errors are logged to logcat.
We already report these errors through callbacks to interested listeners.
However, to ease debugging with bugreports and local error detection,
it's helpful to also log these non-fatal execptions to logcat. Otherwise
nothing in logcat indicates that the player recovered from an exception.

Issue: #6384
PiperOrigin-RevId: 357923899
2021-02-19 10:57:49 +00:00
tonihei
f191000e20 Report unexpected discontinuity as non-fatal audio sink error.
This is preferable to just logging to LogCat so that listeners can
report this to analytics systems if required.

Issue: #6384
PiperOrigin-RevId: 357906079
2021-02-19 10:57:41 +00:00
gyumin
dea6a67ce9 Remove nullable utility methods in Bundleable
PiperOrigin-RevId: 357845774
2021-02-19 10:57:32 +00:00
olly
2e5e1e7c0f SilenceSampleStream.readData: Handle flags-only buffers
The SampleStream.readData contract is that when reading a sample
with a flags-only buffer, the buffer timestamp and flags should
be set and the read position should not be advanced.

#minor-release

PiperOrigin-RevId: 357842130
2021-02-19 10:57:24 +00:00
olly
5da9fd83e9 Improve documentation of StreamStream/SampleQueue read methods
PiperOrigin-RevId: 357734165
2021-02-19 10:57:16 +00:00
olly
1a34de5954 Add plumbing for reporting internal decoder errors
PiperOrigin-RevId: 357732695
2021-02-19 10:57:08 +00:00
andrewlewis
e009322edd Fix seeking to a non-zero position in a preloaded ad item
`ImaAdsLoader` will preload the first ad of a subsequent media item, but the
preloaded ad might not actually play because the user could seek to a non-zero
position in that media item (which could trigger playback of a midroll, not the
preroll). In this case, playback would get stuck because the midroll ad
expected to play after the seek would never load, because the IMA SDK expected
the preroll to play first.

Fix this behavior by discarding the preloaded ad break. If there isn't a seek,
the transition to the next media item is still seamless.

#minor-release

PiperOrigin-RevId: 357682510
2021-02-19 10:57:00 +00:00
gyumin
2326b56132 Implement Bundleable for MediaItem and MediaMetadata
PiperOrigin-RevId: 357656504
2021-02-19 10:56:52 +00:00
olly
9de6a75891 Remove dynamic data from ExoTrackSelection.Definition
PiperOrigin-RevId: 357587767
2021-02-19 10:56:44 +00:00
olly
abaf1e10a2 Respectful language cleanup
PiperOrigin-RevId: 357587009
2021-02-19 10:56:35 +00:00
olly
7f5b5c9b6d Add static TrackSelection type
This type is different to the selection reason, which is
dynamic (i.e., corresponds to the individual selected track,
which can change during playback). The static type is
exposed via TrackSelection, where-as the selection reason
will be internal to the core (i.e., player) module.

PiperOrigin-RevId: 357578201
2021-02-19 10:56:27 +00:00
andrewlewis
f74918a674 Fix ad tag loader period index
Previously it was safe to query the first period in the timeline, but
now we support using the ads loader in concatenations we need to use
the current period index instead.

#minor-release

PiperOrigin-RevId: 357578003
2021-02-19 10:56:19 +00:00
olly
ff46a87d39 Remove track selection override reason and data
These have limited value, and are confusing because they're only
actually used if the override only selects a single track (if the
override is an adaptive selection then the values are never used).
The simpliest path forward is to remove them.

PiperOrigin-RevId: 357573186
2021-02-19 10:56:10 +00:00
kimvde
926884d2f2 Upgrade extensions NDK version
#minor-release
Issue:#8581
PiperOrigin-RevId: 357563419
2021-02-19 10:56:02 +00:00
olly
f52e4bed3d Don't clear audioSessionId when audio disabled
Issue: #8585
#minor-release
PiperOrigin-RevId: 357553237
2021-02-19 10:55:54 +00:00
olly
1b6dd40aa5 Move Spherical UI components to the UI module
PiperOrigin-RevId: 357549002
2021-02-19 10:55:46 +00:00
gyumin
6a642ec58b Generalize exception thrown by fromBundle
It allows Bundleable classes throw a RuntimeException which is broader
than IAE. Now, Bundleable implementation may utilize checkNotNull for
brevity.

PiperOrigin-RevId: 357546375
2021-02-19 10:55:37 +00:00
tonihei
8a084daaff Clarify/correct restrictions of AdsMediaSource.
The source can be used in compositions (in fact, every source is
automatically used in an internal composition when constructing the
playlist), and there is not really a concept of top-level media source
any more since the Player supports playlists.

The actual restriction is that the content media source needs to have
exactly one period to be able to create a SinglePeriodAdTimeline.

#minor-release

PiperOrigin-RevId: 357544191
2021-02-19 10:55:29 +00:00
kimvde
842ca9c09f Add method to query whether a command is available
- Other commands will be added later.
- The returned value is a boolean until we decide what it should be.

PiperOrigin-RevId: 357535877
2021-02-19 10:55:20 +00:00
gyumin
c7751344d4 Use compact String keys for Bundleable
To save bytes in serialized format, it uses shorter keys in Bundles.

PiperOrigin-RevId: 357492840
2021-02-19 10:55:11 +00:00
olly
0b63c17a7e Fix RequiresApi annotation
#minor-release

PiperOrigin-RevId: 357273184
2021-02-12 22:53:40 +00:00
olly
18722bfb0b Bump version to 2.13.1
PiperOrigin-RevId: 357219132
2021-02-12 19:55:57 +00:00
kimvde
c1ef00ab42 Revert logic to decide whether meta atom is full
The previous logic was changed under the assumption that the first box
inside a meta box was not always an hdlr box, but this is not true.

#minor-release

PiperOrigin-RevId: 357200713
2021-02-12 19:55:47 +00:00
christosts
086d8f3a8e Contract test for TransferListener callbacks
PiperOrigin-RevId: 357190780
2021-02-12 16:40:40 +00:00
kimvde
b303eceafd Add support for MP4/QuickTime non-full meta atoms
#minor-release

PiperOrigin-RevId: 357160215
2021-02-12 16:40:31 +00:00
kimvde
158e6de25a Add comment explaining Dolby Vision fallback logic
PiperOrigin-RevId: 357158075
2021-02-12 16:40:23 +00:00
kimvde
6afb669aa7 Enable next button if window is live
This behavior is consistent with DefaultControlDispatcher#dispatchNext().

#minor-release

PiperOrigin-RevId: 357145076
2021-02-12 16:40:14 +00:00
olly
0dba806894 Move DebugTextViewHelper to core
It's closely tied to SimpleExoPlayer, so cannot be part of a UI module
that depends only on common.

PiperOrigin-RevId: 357085802
2021-02-12 16:40:05 +00:00