42 Commits

Author SHA1 Message Date
huangdarwin
5d743000ec Transformer GL: Explicitly label ignored values.
Refactor GlUtil.java to be a bit more readable. Also, reorder, inline, and
rename a few things. Refactoring change only. No functional changes intended.

PiperOrigin-RevId: 415283874
2021-12-10 11:23:08 +00:00
krocard
34108c6c92 Make audio track min buffer size configurable.
Move the code in its own class as DefaultAudioTrack
is getting very big. It also help for testability.

The new class is easily configurable and highly tested.
Manual test was used to catch any regression.

https://github.com/google/ExoPlayer/issues/8891

PiperOrigin-RevId: 415268938
2021-12-10 11:18:13 +00:00
olly
712bbf580f Make javadoc valid html5
As of JDK-8247957, doclint no longer supports html4.

Follow-up to 3e819d082a

PiperOrigin-RevId: 414999870
2021-12-10 11:14:13 +00:00
bachinger
1218f56db6 Support IMA DAI streams for HLS
PiperOrigin-RevId: 414804513
2021-12-10 11:08:45 +00:00
ibaker
0b09ac5bb0 Migrate usages of Timeline#getPeriodPosition to getPeriodPositionUs
#minor-release

PiperOrigin-RevId: 414671861
2021-12-07 17:37:45 +00:00
huangdarwin
07fdf0e794 GL: Document ambiguous parameter names in comments.
Also, made a few other refactoring changes for clarity. No functional
changes intended.

PiperOrigin-RevId: 414487729
2021-12-07 17:37:31 +00:00
ibaker
59d98b9a4e Add MediaItem.SubtitleConfiguration#id field
Issue: google/ExoPlayer#9673

#minor-release

PiperOrigin-RevId: 414413320
2021-12-07 17:37:31 +00:00
christosts
e4e0c7bce5 Add AudioAttributes.spatializationBehavior
The new field matches the platform's
AudioAttributes.getSpatializationBehavior() API added in Sv2. At the
moment, the platform API is called via reflection, until Sv2 is released
and the compile SDK target can be increased to 32.

PiperOrigin-RevId: 414406126
2021-12-07 17:37:31 +00:00
olly
f2ad8ccd3c Shorten log tags to 23 char limit
When calling Android's Log class directly, there's a LongLogTag
lint check that detects tags over the 23 char limit, however it
cannot detect long log tags in ExoPlayer due to the way that we
log via our own Log class. This commit adds @Size annotations to
enforce the same rule.

PiperOrigin-RevId: 413976364
2021-12-07 17:37:31 +00:00
tonihei
417c242625 Prohibit duplicate TrackGroups in TrackGroupArray
Allowing duplicate groups caused some other code working with the
array to use reference equality comparison. This is error-prone,
easily forgotten (e.g. when using the TrackGroups in a map) and
causes bugs when TrackGroups are serialized to disk or to another
process.

All TrackGroups created by ExoPlayer are already unique and custom
code creating TrackGroupArrays with identical groups can easily
distringuish them by adding an id to each group.

Issue: google/ExoPlayer#9718
PiperOrigin-RevId: 413617005
2021-12-02 11:56:42 +00:00
tonihei
f1a5825d73 Add optional id to TrackGroup.
This allows to give TrackGroups an identifier. The underlying goal is
to provide a way to make otherwise identical TrackGroups
distinguishable.

Also set this id in all internal sources that may produce identical
TrackGroups in certain edge cases.

Issue: google/ExoPlayer#9718
PiperOrigin-RevId: 413430719
2021-12-02 11:56:42 +00:00
olly
b91db3f5e2 Add "3" into media3 version string
PiperOrigin-RevId: 413079384
2021-12-02 11:55:55 +00:00
huangdarwin
f0fcad16a9 GL: Remove redundant use() call.
This is already called in GlUtil.Program().

Tested by confirming that the demo-gl target still runs as expected.

Refactoring change only. No intended functional changes.

PiperOrigin-RevId: 412308564
2021-12-02 11:55:44 +00:00
tonihei
a7d7c7b73a Add preferredVideoRoleFlags to TrackSelectionParameters.
And also tweak existing role flag logic to strictly prefer perfect
matches over partial matches.

Caveat: Video role flags only supported for fixed track selections
(same issue as Issue: google/ExoPlayer#9519).

Issue: google/ExoPlayer#9402
PiperOrigin-RevId: 412292835
2021-12-02 11:55:44 +00:00
tonihei
736ea9a148 Remove ExoPlayerImpl inheritance from BasePlayer.
This inheritance is really confusing because ExoPlayerImpl is not
a full Player interface implementation. It also claims to be an
ExoPlayer implementation in the Javadoc which isn't true in its
current state.

Removing the inheritance also allows to clean up some unused methods.

PiperOrigin-RevId: 411756963
2021-12-02 10:05:29 +00:00
bachinger
dc887070c8 Don't drop updates of the playing period for skipped SSI ads
Before this change ExpPlayerImplInternal dropped a change of the playing period when a change in the timeline occurred that actually changed the playing period but we don't want to update the period queue. This logic also dropped the update of a skipped server side inserted preroll ad for which we want the periodQueue to 'seek' to the stream position after the preroll ad and trigger a SKIP discontinuity.

This change now introduces an exception so that a skipped SSI ad is still causing an update in the period queue which leads to a 'seek' and a discontinuity of type SKIP.

PiperOrigin-RevId: 411607299
2021-12-02 09:58:49 +00:00
andrewlewis
5b22b06ec4 Encapsulate attributes and uniforms within Program
Document that apps should retain `GlUtil.Program` while the program is in use,
and keep a reference to attributes/uniforms within the program to make sure
they don't get GC'd causing any allocated buffers passed to GL to become
invalid.

Tested manually by running gldemo and transformer.

PiperOrigin-RevId: 411516894
2021-11-22 17:21:14 +00:00
tonihei
9ab021543b Add method to reset ad group from final states to be playable again.
The player will not play ads in final states (played, skipped, error)
again. To allow ads loader customizations to play ads again, we can
add a method that resets the state back to available or unavailable
(depending on whether we have the URI for the ad).

Issue: google/ExoPlayer#9615
PiperOrigin-RevId: 411042842
2021-11-19 15:18:45 +00:00
christosts
d5b6250350 Populate ICY headers into MediaMetadata
Populate ICY headers into MediaMetadata so that they can
propagate to the app via AnalyticsListener#onMediaMetadataChanged().
This change copies IcyHeaders.name into MediaMetadata.description
and IcyHeaders.genre into MediaMetadata.genre.

Note: MediaItem.metadata maintain their precedence and overwrite any
ICY headers parsed.

Issue: google/ExoPlayer#9677

#minor-release

PiperOrigin-RevId: 410495676
2021-11-19 14:55:51 +00:00
tonihei
c0ffeb262c 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-19 14:47:08 +00:00
olly
c046f40fd0 Fixes for some minor misc issues
- Unnecessary deprecation suppressions
- Dead code
- Broken Javadoc

PiperOrigin-RevId: 409357884
2021-11-19 14:44:25 +00:00
tonihei
1c8d00a47d 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-19 14:37:58 +00:00
ibaker
ad305b44a0 Fix TrackSelectionOverrides javadoc
#minor-release

PiperOrigin-RevId: 408825328
2021-11-19 14:31:36 +00:00
ibaker
77c5bc8e31 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-09 10:10:11 +00:00
tonihei
8900d655d9 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-09 10:10:10 +00:00
tonihei
39d6ad855f Fix deprecated Javadoc link.
#minor-release

PiperOrigin-RevId: 408269341
2021-11-09 10:10:10 +00:00
ibaker
429672903f Migrate usages of deprecated MediaItem symbols
#minor-release

PiperOrigin-RevId: 407847729
2021-11-09 10:10:10 +00:00
huangdarwin
edc4bd5be1 GL: Misc GL refactoring.
* Remove GlUtil.Program String[] constructor to unify and just use the
  String constructor.
* Add getAttributeArrayLocationAndEnable() to simplify things a tiny bit.
* Increase usage of constant values.

PiperOrigin-RevId: 407570340
2021-11-09 10:10:10 +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
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
olly
99ace2dbb1 Rename MediaFormatUtil constants
PiperOrigin-RevId: 406816023
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
ibaker
7115058ccd Remove unecessary warning suppression in PlaybackException
PiperOrigin-RevId: 406783965
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
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
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
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
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
ibaker
9a49a9ccda Remove all references to @NonNull
Our package-info.java files are annotated with @NonNullApi which results
in everything being non-null by default, so this annotation is never
needed.

#minor-release

PiperOrigin-RevId: 405864737
2021-10-27 17:48:40 +01:00
Andrew Lewis
933e207b3e Update to androidx.media3
PiperOrigin-RevId: 405656499
2021-10-27 09:12:46 +01:00