774 Commits

Author SHA1 Message Date
olly
5d7641c6f1 Fix some lint warnings
PiperOrigin-RevId: 424383900
2022-01-28 09:37:06 +00:00
olly
aceacb05ca Fix spurious unsupported tracks toast in demo apps
PiperOrigin-RevId: 424062588
2022-01-25 20:05:06 +00:00
olly
6af74e7f0f Add missing AudioFormat encoding conversions
PiperOrigin-RevId: 423786422
2022-01-25 19:41:56 +00:00
bachinger
e2cf266b1c Set the next live ad in ad group to avoid rebuffering
To avoid the `MediaPeriodQueue`to discard the reading period, we can set the next ad of an ad group early and then (possibly) only change it's duration once we receive the actual duration. This way we avoid a rebuffering as a result of the reading period being discarded.

The change also takes care to properly set ad break and their durations when we join the live stream at the moment when an ad is playing.

PiperOrigin-RevId: 423163467
2022-01-25 19:17:42 +00:00
huangdarwin
f216fa2042 Transformer GL: Clarify variables and comments.
Simplifying and clarifying variables, and adding comments.

Tested by confirming demo-gl and demo-transformer both
correctly display videos

PiperOrigin-RevId: 421792079
2022-01-14 15:34:09 +00:00
ibaker
66c272c9b0 Reword javadoc of TracksInfo.isTypeSupportedOrEmpty
The existing wording would be correct if prefixed with
"Returns false if [...]", but it seems confusing to a document a boolean
method in terms the condition it returns false - so I reworded it in
terms of when it returns true.

#minor-release

PiperOrigin-RevId: 421682584
2022-01-14 15:22:26 +00:00
hschlueter
f8d84eec59 Allow multiple Transformer listeners to be registered.
Multiple listeners can be added to Transformer and its builder.
All or specific listeners can also be removed.

PiperOrigin-RevId: 421047650
2022-01-14 14:39:20 +00:00
ibaker
7d83c979a6 Include role and selection flags when logging a track's Format
Inspired by my investigation of Issue: google/ExoPlayer#9797

#minor-release

PiperOrigin-RevId: 417609076
2021-12-21 17:18:28 +00:00
tonihei
65c444538b Rename HLS master playlist to multivariant playlist
The spec renamed this type of playlist in the latest revision
to use a more inclusive technical term (see
https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-10)

PiperOrigin-RevId: 417560274
2021-12-21 17:14:42 +00:00
ibaker
86ca5b8ec1 Add AdOverlayInfo.Builder and tweak @Purpose IntDef definition
PiperOrigin-RevId: 417378468
2021-12-20 13:53:35 +00:00
ibaker
e8ee6dad2a Revert e148a678ac5fc42e1a87a90bf4e99ad04968818e
Fix the gradle problem

PiperOrigin-RevId: 416011494
2021-12-14 10:29:51 +00:00
huangdarwin
7d93f2d40c Transformer GL: Remove UnsupportedEglVersionException().
UnsupportedEglVersionException() is only used once, and seems a bit too
specific for Transformer. Also, it's possible for eglCreateContext to fail for
other reasons besides lack of support, so it wasn't always accurate when
thrown.

It is possible for devices not to support EGL version 2.0 though, per
https://source.android.com/devices/graphics/implement-opengl-es, which doesn't
specify the EGL version that must be supported.

PiperOrigin-RevId: 415489396
2021-12-10 17:25:53 +00:00
krocard
ddf05a9466 Rollback of 2674e05589
*** Original commit ***

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: 415469179
2021-12-10 17:25:53 +00:00
huangdarwin
69532deb7a 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 17:25:53 +00:00
krocard
2674e05589 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 16:46:50 +00:00
bachinger
a92e48e5f8 Support IMA DAI streams for HLS
PiperOrigin-RevId: 414804513
2021-12-10 16:21:51 +00:00
ibaker
5c2f618613 Migrate usages of Timeline#getPeriodPosition to getPeriodPositionUs
#minor-release

PiperOrigin-RevId: 414671861
2021-12-08 10:01:38 +00:00
huangdarwin
fcdb96f0f1 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-08 10:01:32 +00:00
ibaker
2e55643fbd Add MediaItem.SubtitleConfiguration#id field
Issue: google/ExoPlayer#9673

#minor-release

PiperOrigin-RevId: 414413320
2021-12-07 17:37:16 +00:00
christosts
a40a71a534 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:28:35 +00:00
olly
4af0610067 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-06 13:05:45 +00:00
tonihei
8c90ba5db4 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 15:21:34 +00:00
tonihei
d53d51d57c 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 15:21:33 +00:00
huangdarwin
0e65925bb2 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-11-26 16:16:42 +00:00
tonihei
339d99b860 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-11-26 16:13:34 +00:00
tonihei
92507e02f7 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-11-26 15:33:01 +00:00
bachinger
92c971ecd0 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-11-26 15:20:07 +00:00
andrewlewis
cd6ba0680f 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-26 14:54:33 +00:00
tonihei
4fd6d670c6 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 14:44:57 +00:00
christosts
349160a5cf 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-18 13:13:27 +00:00
tonihei
fde78bc3a7 Bump version to 2.16.1
And make related release notes updates.

PiperOrigin-RevId: 409991879
2021-11-15 17:15:45 +00:00
tonihei
1564d5314c 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 14:47:51 +00:00
olly
67e1499956 Fixes for some minor misc issues
- Unnecessary deprecation suppressions
- Dead code
- Broken Javadoc

PiperOrigin-RevId: 409357884
2021-11-15 10:58:32 +00:00
tonihei
954531bd28 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 11:55:36 +00:00
ibaker
0e36bdb2e6 Fix TrackSelectionOverrides javadoc
#minor-release

PiperOrigin-RevId: 408825328
2021-11-11 10:30:28 +00:00
ibaker
4404404795 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-08 14:32:04 +00:00
tonihei
3e934e5379 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:09:31 +00:00
tonihei
1a81662dad Fix deprecated Javadoc link.
#minor-release

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

PiperOrigin-RevId: 407847729
2021-11-08 09:48:45 +00:00
huangdarwin
14b42a4ed1 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-05 11:53:00 +00:00
tonihei
2d31100264 Bump version to 2.16.0
PiperOrigin-RevId: 407314385
2021-11-03 15:35:19 +00:00
ibaker
7de079493c 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 12:08:18 +00:00
bachinger
70713c8458 Fix rewriting upstream/crypto package in lib-datasource
PiperOrigin-RevId: 406840246
2021-11-01 17:26:19 +00:00
tonihei
861474f6f9 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:12:21 +00:00
tonihei
2702501783 Add missing import for gradle build
PiperOrigin-RevId: 406827799
2021-11-01 17:07:46 +00:00
olly
e039e335cd Rename MediaFormatUtil constants
PiperOrigin-RevId: 406816023
2021-11-01 16:53:30 +00:00
ibaker
23de0be4c9 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 16:34:25 +00:00
ibaker
8829c45d32 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 16:29:33 +00:00
ibaker
42f9ddb54e Remove unecessary warning suppression in PlaybackException
PiperOrigin-RevId: 406783965
2021-11-01 16:15:39 +00:00
olly
8e2083a27b Remove dependency from common tests to exoplayer
PiperOrigin-RevId: 406354526
2021-11-01 09:54:23 +00:00