8241 Commits

Author SHA1 Message Date
tonihei
9e8af7c250 Add additional documentation regarding resource acquisition.
The main point of the IDLE state is that the player is not holding
resources. Clarify this in the documentation of STATE_IDLE, prepare and
stop.

PiperOrigin-RevId: 409950785
2021-11-15 17:18:06 +00:00
tonihei
d9f2fc9f81 Use buildUpon instead of creating new overrides in UI ControlView.
Creating a new set of overrides removes previously set overrides that
should be kept.

Issue: google/ExoPlayer#9690
PiperOrigin-RevId: 409933541
2021-11-15 17:17:55 +00:00
olly
34b2572d37 Fixes for some minor misc issues
- Unnecessary deprecation suppressions
- Dead code
- Broken Javadoc

PiperOrigin-RevId: 409357884
2021-11-15 17:17:43 +00:00
hschlueter
cfe61dbbda 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-11 13:55:12 +00:00
tonihei
8bae89f1c4 Fully support per-track-type selection overrides.
Currently, TrackSelectionOverrides are documented as being applied
per track type, meaning that one override for a type disables all
other selections for the same track type. However, the actual
implementation only applies it per track group, relying on the
track selector to never select another renderer of the same type.

This change fixes DefaultTrackSelector to fully adhere to the
TrackSelectionsOverride definition. This solves problems when
overriding tracks for extension renderers (see Issue: google/ExoPlayer#9675)
and also simplifies a workaround added to StyledPlayerView.

#minor-release

PiperOrigin-RevId: 409121711
2021-11-11 13:54:45 +00:00
christosts
aa2a4e3055 Async buffer queueing: do not throw from flush/shutdown
The asynchronous MediaCodec adapter queues input buffers in a
background thread. If a codec queueuing operation throws an exception,
the buffer enqueuer will store it as a pending exception and re-throw it
the next time the adapter will attempt to queue another input buffer.

The buffer enqueuer's flush() and shutdown() may throw an exception if
the pending error is set. This is subject to a race-condition in which
the pending error can be set while the adapter is flushing/shutting down
the enqueuer, e.g., if an input buffer is still being queued and the
codec throws an exception. As a result, the adapter cannot flush or
shutdown gracefully.

This change makes the buffer enqueuer to ignore any pending error
when flushing/shuttinf down so that the adapter can flush/release
gracefully even if a queueing error was detected.

PiperOrigin-RevId: 409113054
2021-11-11 13:54:33 +00:00
christosts
ac413a14b3 Add experimental method to turn-off async flush
When operating the MediaCodec in asynchronous mode, after a
MediaCodec.flush(), we start MediaCodec in the callback thread,
which might trigger errors in some platforms. This change adds an
experimental flag to move the call to MediaCodec.start() back to the
playback thread.

PiperOrigin-RevId: 407801013
2021-11-11 13:53:42 +00:00
christosts
84c24fb677 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.

PiperOrigin-RevId: 407345431
2021-11-11 13:53:10 +00:00
tonihei
e408a474af Make TrackSelectionOverride.getTrackType public
This method is helpful when iterating the list of track overrides
to figure out which type the override applies to.

Issue: google/ExoPlayer#9665
PiperOrigin-RevId: 409108977
2021-11-11 13:51:18 +00:00
tonihei
898da1470d Update track selection documentation.
The Javadoc of DefaultTrackSelector can be shortened as it's not the
right place to document detailed options of the Player track selection
parameters.

The documentation page about track selection is updated to the new
APIs and extended with most relevant options and information needed
to work with ExoPlayer's track selection API.

#minor-release

PiperOrigin-RevId: 409088989
2021-11-11 13:51:02 +00:00
ibaker
5891b76ba2 Add contract tests for DataSource#getResponseHeaders
PiperOrigin-RevId: 408840409
2021-11-11 13:50:45 +00:00
ibaker
df0e89c167 Make DefaultHttpDataSourceContractTest an instrumentation test
Robolectric uses the JRE HttpURLConnection [1], while real Android
devices and emulators use OkHttp to implement HttpURLConnection. This
can lead to important differences in behaviour, so it's better to use
instrumentation tests when specific HTTP behaviour is important.

[1] https://github.com/robolectric/robolectric/issues/6769#issuecomment-943556156

PiperOrigin-RevId: 408840295
2021-11-11 13:50:36 +00:00
ibaker
c1aaf580f7 Fix TrackSelectionOverrides javadoc
#minor-release

PiperOrigin-RevId: 408825328
2021-11-11 13:36:37 +00:00
tonihei
5c6ee883e6 Add missing deprecation for old track selection override getters.
The setters in the Builder are already deprecated and using the
old getter is error-prone as they only return the overrides set
with the deprecated setters.

Issue: google/ExoPlayer#9665
PiperOrigin-RevId: 408817640
2021-11-11 13:35:15 +00:00
tonihei
eec8d31544 Merge pull request #9543 from KasemJaffer:rf64
PiperOrigin-RevId: 408816643
2021-11-11 13:34:48 +00:00
kimvde
334fe47b60 WavExtractor: skip unknown chunks consistently
#minor-release

PiperOrigin-RevId: 408550935
2021-11-11 13:34:37 +00:00
tonihei
864e5a2dbc Add missing @Nullable for ExoPlayer.getPlayerError.
#minor-release

Issue: google/ExoPlayer#9660
PiperOrigin-RevId: 408323173
2021-11-11 13:34:03 +00:00
ibaker
942bfdb140 Add @Deprecated to MediaSourceFactory deprecated overrides
This is needed to ensure the deprecation warning appears on usages in
Android Studio and in javadoc.

#minor-release

PiperOrigin-RevId: 408319182
2021-11-11 13:33:49 +00:00
ibaker
f9c1cab541 Split MediaItemTest#setSubtitles into two tests
Each test exercises one of the setters. Together they assert that both
setters set both fields.

PiperOrigin-RevId: 408309207
2021-11-11 13:33:20 +00:00
christosts
3bc7ffe644 Minor fix in AsynchronousMediaCodecAdapter.signalEndOfInputStream()
PiperOrigin-RevId: 407635099
2021-11-08 10:47:31 +00:00
tonihei
f7c9b439a4 Rename indexes to indices in TrackSelectionOverrides
And in a couple of related places.

This is for consistency with the rest of the codebase where
we exclusively use indices.

#minor-release

PiperOrigin-RevId: 408273372
2021-11-08 10:17:42 +00:00
tonihei
80ebbbf18f Fix deprecated Javadoc link.
#minor-release

PiperOrigin-RevId: 408269341
2021-11-08 10:17:30 +00:00
ibaker
e5fc714136 Migrate usages of deprecated MediaItem symbols
#minor-release

PiperOrigin-RevId: 407847729
2021-11-08 10:17:18 +00:00
tonihei
127aa29fa7 Fix track selection with mixed empty/non-empty overrides
When we have multiple overrides for TrackGroups associated with
one renderer, we need to look at all of them to find the non-empty
one. Empty ones should only be used to remove previously selected
tracks for this group and otherwise be ignored.

Currently this is broken because the first override (no matter if
it's empty or not) is used as the final selection for this renderer.

Issue: google/ExoPlayer#9649

PiperOrigin-RevId: 407792330
2021-11-08 10:16:06 +00:00
tonihei
de71fd6eba Bump version to 2.16.0
PiperOrigin-RevId: 407314385
2021-11-03 15:58:14 +00:00
samrobinson
f6e0790a68 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-03 15:58:05 +00:00
kimvde
9e247d287f 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-03 15:57:39 +00:00
tonihei
ac66487013 Add missing RetentionPolicy for IntDef
PiperOrigin-RevId: 407162673
2021-11-03 15:57:29 +00:00
aquilescanta
be4ea151c4 Parse HDR static metadata from MP4 files
#minor-release

PiperOrigin-RevId: 407136922
2021-11-03 15:57:11 +00:00
samrobinson
5a98c823fc Update the TransformerMediaClock trackTime before deducting the offset.
#minor-release

PiperOrigin-RevId: 407086818
2021-11-03 15:56:47 +00:00
tonihei
368f4d6754 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-02 13:10:41 +00:00
christosts
e246eccc10 Replace map with a switch statement in bandwidth meter implementations
#minor-release

PiperOrigin-RevId: 407042882
2021-11-02 13:10:30 +00:00
ibaker
1654842050 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-02 13:10:20 +00:00
tonihei
f5cdf1657a Remove FfmpegVideoRenderer from 2.16.0 release 2021-11-02 11:57:30 +00:00
huangdarwin
14eba83df6 Transformer GL: Undo accidental setResolution changes().
Accidental changes were introduced in c53924326d

PiperOrigin-RevId: 406858888
2021-11-02 08:58:49 +00:00
samrobinson
2c2705aa6b Allow remove video transformer option.
PiperOrigin-RevId: 406849436
2021-11-02 08:58:34 +00:00
bachinger
58f36fb854 Fix rewriting upstream/crypto package in lib-datasource
PiperOrigin-RevId: 406840246
2021-11-01 17:39:24 +00:00
tonihei
455fb89cd4 Suppress lint warning about wrong IntDef in FrameworkMuxer
The values are equivalent and we can suppress the warning.

PiperOrigin-RevId: 406839242
2021-11-01 17:39:08 +00:00
tonihei
8cefb845df Merge pull request #9576 from TiVo:p-fix-duration-round
PiperOrigin-RevId: 406839109
2021-11-01 17:38:51 +00:00
tonihei
f67ec8973c 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-01 17:38:35 +00:00
tonihei
45ef34eb2f Add missing import for gradle build
PiperOrigin-RevId: 406827799
2021-11-01 17:38:20 +00:00
tonihei
3ecf882c34 Remove wrong IntDef usage.
The variable is storing OpenGL's draw mode, which is different from Projection.DrawMode.

PiperOrigin-RevId: 406820812
2021-11-01 17:38:06 +00:00
tonihei
f382ef0ae2 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-01 17:37:42 +00:00
olly
eeaa617160 Rename MediaFormatUtil constants
PiperOrigin-RevId: 406816023
2021-11-01 17:37:24 +00:00
tonihei
4803ab3bd1 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-01 17:36:49 +00:00
tonihei
08f66c4d5b 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-01 17:36:35 +00:00
ibaker
56b589c422 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 <unknown commit>

PiperOrigin-RevId: 406803555
2021-11-01 17:36:08 +00:00
ibaker
3f4cde1873 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-01 17:35:50 +00:00
tonihei
4e6960ee16 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-01 17:35:10 +00:00
ibaker
4c40e80da6 Remove unecessary warning suppression in PlaybackException
PiperOrigin-RevId: 406783965
2021-11-01 17:34:23 +00:00