12341 Commits

Author SHA1 Message Date
hschlueter
52c330c1d7 Write sample size to dumpfile in transformer tests.
If the number of samples changes, the sizes will help us to verify
whether they are just split differently or extra data was added.

PiperOrigin-RevId: 407346280
2021-11-09 10:09:13 +00:00
christosts
91a0f0203b Add DefaultMediaCodecFactory.getCodecAdapter() method
Add protected method DefaultRenderersFactory.getCodecAdapter(), so that
subclasses of DefaultRenderersFactory that override
buildVideoRenderers() or buildAudioRenderers() can access the
DefaultRenderersFactory codec adapter factory and pass it to
MediaCodecRenderer instances they may create.

#minor-release

PiperOrigin-RevId: 407345431
2021-11-09 10:09:13 +00:00
samrobinson
9c32d5ac46 Fix END_OF_STREAM transformer timestamp matching previous.
This cause the muxer to fail to stop on older devices/API levels.

#minor-release

PiperOrigin-RevId: 407309028
2021-11-09 10:09:13 +00:00
kimvde
7168f93829 WavExtractor: split header reading state into 2 states
This refactoring is the basis to support RF64 (see
Issue: google/ExoPlayer#9543).

#minor-release

PiperOrigin-RevId: 407301056
2021-11-09 10:09:13 +00:00
ibaker
043a80a5ba Fix most IntDef violations in MediaControllerImplLegacy
This commit doesn't resolve all the violations. Specifically,
INDEX_UNSET is still being incorrectly passed as various IntDef values
to the PlayerInfo constructor, but making these parameters (and the
corresponding PlayerInfo fields) @Nullable is a more involved change
(and it's not obvious at what point we can guarantee the value will be
non-null/non-INDEX_UNSET), so it's left for a later commit.

PiperOrigin-RevId: 407294091
2021-11-09 10:09:13 +00:00
olly
8f88127b8e Prepare for adding ServerSideInsertedAdsMediaSource for IMA
PiperOrigin-RevId: 407274072
2021-11-09 10:09:13 +00:00
tonihei
3a5bf735fa Add missing RetentionPolicy for IntDef
PiperOrigin-RevId: 407162673
2021-11-09 10:09:13 +00:00
aquilescanta
ab9741aced Parse HDR static metadata from MP4 files
#minor-release

PiperOrigin-RevId: 407136922
2021-11-09 10:09:13 +00:00
tonihei
e88c158524 Suppress lint warnings in leanback module.
These warnings are caused by the fact that this is a library and the
lint check doesn't see any app using the library in a TV context.

PiperOrigin-RevId: 407110725
2021-11-09 10:09:13 +00:00
samrobinson
04efc03d4b Update the TransformerMediaClock trackTime before deducting the offset.
#minor-release

PiperOrigin-RevId: 407086818
2021-11-09 10:09:12 +00:00
ibaker
8b34d160dc Fix implementations of MediaLibrarySessionCallback to pass params
The documentation makes it clear this value should be propagated
through to the result.

PiperOrigin-RevId: 407085751
2021-11-09 10:09:12 +00:00
ibaker
dfb87e2161 Throw unsupported exception from deprecated MediaController methods
This is consistent with existing deprecated methods that have never been
supported on MediaController.

PiperOrigin-RevId: 407071712
2021-11-09 10:09:12 +00:00
ibaker
65c2bd981c Add missing LibraryResult type parameters
PiperOrigin-RevId: 407051126
2021-11-09 10:07:30 +00:00
tonihei
cb86a8af49 Suppress lint warning about IntDef assignment.
The values returned by the framework method are equivalent to the local IntDef values.

PiperOrigin-RevId: 407048748
2021-11-09 10:07:30 +00:00
christosts
72f56760bb Replace map with a switch statement in bandwidth meter implementations
#minor-release

PiperOrigin-RevId: 407042882
2021-11-09 10:07:30 +00:00
ibaker
686f2ca96d Migrate usages of Window-based Player methods
Where this introduced an inconsistency (e.g. assigning to something
called `windowIndex`), I generally renamed the transitive closure of
identifiers to maintain consistency (meaning this change is quite
large). The exception is code that interacts with Timeline and Window
directly, where sometimes I kept the 'window' nomenclature.

#minor-release

PiperOrigin-RevId: 407040052
2021-11-09 10:07:30 +00:00
huangdarwin
4f46e679a6 Transformer GL: Undo accidental setResolution changes().
Accidental changes were introduced in c07c4cc95d

PiperOrigin-RevId: 406858888
2021-11-09 10:07:30 +00:00
samrobinson
c3fbe2e1d3 Allow remove video transformer option.
PiperOrigin-RevId: 406849436
2021-11-09 10:07:30 +00:00
tonihei
90f74dc7a1 Suppress lint warning about wrong IntDef in FrameworkMuxer
The values are equivalent and we can suppress the warning.

PiperOrigin-RevId: 406839242
2021-11-09 10:07:30 +00:00
Ian Baker
302053c033 Merge pull request #9576 from TiVo:p-fix-duration-round
PiperOrigin-RevId: 406839109
2021-11-09 10:07:30 +00:00
tonihei
ea2851b56e Add missing IntDef constant.
The video scaling mode and stream type defines a default constant
that needs to be added to the IntDef definition to be assignable.

PiperOrigin-RevId: 406835696
2021-11-09 10:07:30 +00:00
tonihei
90a4383c6b Remove wrong IntDef usage.
The variable is storing OpenGL's draw mode, which is different from Projection.DrawMode.

PiperOrigin-RevId: 406820812
2021-11-09 10:07:30 +00:00
tonihei
665910ab76 Suppress lint warning about wrong IntDef assignment.
The return values of AudioManager.getPlaybackOffloadSupport are the same as the values defined in C.AudioManagerOffloadMode.

PiperOrigin-RevId: 406817413
2021-11-09 10:07:30 +00:00
olly
99ace2dbb1 Rename MediaFormatUtil constants
PiperOrigin-RevId: 406816023
2021-11-09 10:07:30 +00:00
tonihei
d1e13b629d Fix rounding error in fMP4 presentation time calculation
The presentation time in fMP4 is calculated by adding and subtracting
3 values. All 3 values are currently converted to microseconds first
before the calculation, leading to rounding errors. The rounding errors
can be avoided by doing the conversion to microseconds as the last step.

For example:
In timescale 96000:  8008+8008-16016 = 0
Rounding to us first: 83416+83416-166833=-1

#minor-release

PiperOrigin-RevId: 406809844
2021-11-09 10:07:30 +00:00
tonihei
7b84d6b051 Throw pending clipping errors created during period preparation.
Currently, clipping errors are never thrown if we already have a
MediaPeriod. This may happen for example for ProgressiveMediaSource
where we need to create a MediaPeriod before knowing whether clipping
is supported. Playback will still fail, but with unrelated assertion
errors that are hard to understand for users.

Fix this by setting the pending error on the ClippingMediaPeriod.

#minor-release

Issue: Issue: google/ExoPlayer#9580
PiperOrigin-RevId: 406809737
2021-11-09 10:07:30 +00:00
ibaker
15e2a13ea3 Re-position IntDefs in media3 stable API
These IntDefs are now annotated with TYPE_USE [1], so they can be moved
to directly before the type (int).

[1] Since https://github.com/androidx/media/commit/9ba21a75f

PiperOrigin-RevId: 406803555
2021-11-09 10:07:00 +00:00
ibaker
b3c8c2a06c Add TYPE_USE to IntDefs used in the media3 stable API
This allows the use of the intdef in parameterized types,
e.g. List<@MyIntDef Integer>

For IntDefs that are already released in ExoPlayer 2.15.1 we add
TYPE_USE in addition to all other reasonable targets, to maintain
backwards compatibility with Kotlin code (where an incorrectly
positioned annotation is a compilation failure). 'reasonable targets'
includes FIELD, METHOD, PARAMETER and LOCAL_VARIABLE but not TYPE,
CONSTRUCTOR, ANNOTATION_TYPE, PACKAGE or MODULE. TYPE_PARAMETER is
implied by TYPE_USE.

For not-yet-released IntDefs we just add TYPE_USE.

#minor-release

PiperOrigin-RevId: 406793413
2021-11-09 10:07:00 +00:00
olly
cc65daa7aa Upgrade gradle plugin version
PiperOrigin-RevId: 406789671
2021-11-09 10:07:00 +00:00
tonihei
10dcdd1df5 Add large renderer position offset.
This helps to prevent issues where decoders can't handle negative
timestamps. In particular it avoids issues when the media accidentally
or intentionally starts with small negative timestamps. But it also
helps to prevent other renderer resets at a later point, for example
if a live stream with a large start offset is enqueued in the playlist.

#minor-release

PiperOrigin-RevId: 406786977
2021-11-09 10:07:00 +00:00
ibaker
7115058ccd Remove unecessary warning suppression in PlaybackException
PiperOrigin-RevId: 406783965
2021-11-09 10:07:00 +00:00
ibaker
729b2b64f3 Don't pass deviceVolume as volume in MediaControllerImplLegacy
deviceVolume (int) and volume (float) are not the same. Elsewhere
MediaControllerImplLegacy doesn't support volume and defaults to 1
(setVolume, getVolume), so defaulting to 1 here seems correct.

PiperOrigin-RevId: 406780391
2021-11-09 10:07:00 +00:00
huangdarwin
bf18aae99d GL: Make ProjectionRenderer's GL Program @MonotonicNonNull.
PiperOrigin-RevId: 406385758
2021-11-09 10:07:00 +00:00
kimvde
8586127d88 WavExtractor: split read stages into states
This refactoring is the basis to support RF64 (see
Issue: google/ExoPlayer#9543).

#minor-release

PiperOrigin-RevId: 406377924
2021-11-09 10:07:00 +00:00
samrobinson
51aee84d13 Change Transformer to use Player.Listener.
AnalyticsListener should not be used for non-analytical actions.

PiperOrigin-RevId: 406355758
2021-11-09 10:07:00 +00:00
olly
a3b71d5400 Remove dependency from common tests to exoplayer
PiperOrigin-RevId: 406354526
2021-11-09 10:07:00 +00:00
ibaker
0d144366c3 Mark MediaSessionService.MediaNotification final
PiperOrigin-RevId: 406347510
2021-11-09 10:07:00 +00:00
christosts
2c98e8bb4f ExoPlayer.Builder: lazily initialize default components
Initialize default components lazily in ExoPlayer.Builder to avoid
redundant component instantiations, useful in cases where apps
overwrite default components with ExoPlayer.Builder setters.

The fields in ExoPlayer.Builder are wrapped in a Supplier (rather than
just making then nullable and initializing them in
ExoPlayer.Builder.build()) so that we maintain the proguarding
properties of this class.

PiperOrigin-RevId: 406345976
2021-11-09 10:06:11 +00:00
christosts
9d5fd4f402 DefaultExtractorsFactory: lazily load flac extension
PiperOrigin-RevId: 406332026
2021-11-09 10:06:11 +00:00
bachinger
80c5e00b18 Defer setting defaults for rendition reports until playlist is parsed
This makes sure that #EXT-X-RENDITION-REPORT tags can be placed before
the list of segments/parts as well. We were previously assuming that
these come at the end, which naturally would make sense and is done like
this in all examples, but it is not explicitly defined by the spec.

Issue: google/ExoPlayer#9592
PiperOrigin-RevId: 406329684
2021-11-09 10:05:40 +00:00
bachinger
222db48298 Make package in test manifest consistent
PiperOrigin-RevId: 406255369
2021-11-08 15:18:26 +00:00
ibaker
a60843ead5 Migrate callers of deprecated C.java methods to Util.java
#minor-release

PiperOrigin-RevId: 406166670
2021-11-08 15:17:26 +00:00
ibaker
67640dff0e Remove confusing @throws clauses from MediaLibrarySessionCallback
These seem to be describing an exception being thrown based on a
property of the value being returned from this method? Or is the
expectation that every implementation of this interface throws the
AssertionError themselves.

Given AssertionError is unchecked, and shouldn't be explicitly caught
anywhere, it seems easiest just to remove all this documentation?

PiperOrigin-RevId: 406107606
2021-11-08 15:16:11 +00:00
huangdarwin
7f64a5a1aa Transformer GL: Simplify GL program handling.
Relanding 9788750ddb, with some changes
applied to improve primarily readability, naming,
and nullness checks.

PiperOrigin-RevId: 406101742
2021-11-08 15:15:02 +00:00
ibaker
f37e980018 Migrate media3.session references from Window to MediaItem
#minor-release

PiperOrigin-RevId: 405927299
2021-11-08 15:13:41 +00:00
ibaker
d83fe03d88 Update most Player parameter & doc references from Window to MediaItem
Only deprecated references remain.

Usages of the deprecated methods will be migrated in a follow-up change.

#minor-release

PiperOrigin-RevId: 405927141
2021-11-08 15:12:32 +00:00
ibaker
b60acca872 Clarify that ExoPlayer.Builder constructor overloads only exist for R8
Also add a setRenderersFactory() method, so that all constructor-provided
components can also be passed via setters.

This comment already appears on the constructor that takes all
components, but it applies to these ones as well.

PiperOrigin-RevId: 405917343
2021-11-08 15:11:15 +00:00
andrewlewis
e6242690ff Elaborate migration info in media3 README
PiperOrigin-RevId: 405909676
2021-10-27 17:52:39 +01:00
hschlueter
399172d63f Refactor nullness checks in renderers.
`checkNotNull` should be avoided where possible.
This change adds `@EnsuresNonNull` or `@EnsuresNonNullIf` to configuration methods for fields they initialize.

`checkNotNull` is now avoided for the `@MonotonicNonNull` formats by adding `@RequiresNonNull` annotations.

`checkNotNull` is now avoided for the encoder and decoder in `feedMuxerFromEncoder()`, `feedEncoderFromDecoder()`, `feedDecoderFromInput()`, etc. by creating local variables for `encoder` and `decoder` in `render` after the configuration method calls and passing these as non-null parameters.

PiperOrigin-RevId: 405893824
2021-10-27 17:51:40 +01:00
ibaker
60a68f8891 Remove IntRange from Player.getMediaItemAt
No other index-related methods in Player are annotated, it's considered
obvious that these should be >=0.

PiperOrigin-RevId: 405882756
2021-10-27 17:50:41 +01:00