161 Commits

Author SHA1 Message Date
Manisha Jajoo
743437e34f Clean up RtpMpeg4Reader 2022-01-31 17:31:01 +05:30
Haruki Hasegawa
1074078d2b
Fix build error when androidxMediaModulePrefix is specified
When the media3 modules are referred from an external project and
gradle.ext.androidxMediaModulePrefix is specified, build error occurs
like the following.

> gradle.ext.androidxMediaModulePrefix = "media-"

> A problem occurred evaluating project ':media-lib-common'.
> > Project with path ':media-media-lib-cast' could not be found in project ':media-lib-common'.

As you can see, the build script of the common module is trying to
use an incorrect named project which has duplicated prefixes.
2022-01-30 17:42:32 +09:00
olly
d2cc14a98b Fix some lint warnings
PiperOrigin-RevId: 424383900
2022-01-28 08:46:46 +00:00
Manisha Jajoo
d2f807ebae Add support for RTSP MPEG4
Added MPEG4 RTP packet reader and added support for MPEG4
playback through RTSP

Change-Id: I57c9a61b18471dbd2c368177ebfb89ee662f995b
2022-01-28 14:02:28 +05:30
olly
47fd32f1d4 Fix spurious unsupported tracks toast in demo apps
PiperOrigin-RevId: 424062588
2022-01-25 19:22:30 +00:00
olly
79f3e2d862 Add missing AudioFormat encoding conversions
PiperOrigin-RevId: 423786422
2022-01-25 19:14:13 +00:00
bachinger
a1424c834f 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:05:01 +00:00
huangdarwin
65adbbb745 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-25 18:17:15 +00:00
ibaker
78c07b56a7 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-25 18:13:17 +00:00
hschlueter
725b861f54 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-25 17:52:29 +00:00
tonihei
3b1b25068c Add Gradle constraints to common module to enforce matching versions
The common module now defines all other released targets as constraints,
which ensures they must have matching versions. As all other libraries
indirectly depend on the common module, this declaration is only needed
in here.

PiperOrigin-RevId: 419776578
2022-01-05 12:15:35 +00:00
ibaker
58db50699f Support simple ad serving with the stable API
This involves stabilising AdsLoader and ImaAdsLoader, as well
as (Default)MediaSourceFactory and the following methods on
ExoPlayer.Builder:
* setMediaSourceFactory
* setAdsLoaderProvider
* setAdViewProvider

Most of ImaAdsLoader.Builder and (Default)MediaSourceFactory remain
unstable for now.

PiperOrigin-RevId: 417814106
2022-01-05 10:49:42 +00:00
ibaker
89271eb722 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
2022-01-05 10:42:19 +00:00
tonihei
40d9838315 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
2022-01-05 10:41:06 +00:00
ibaker
d0041d4666 Add AdOverlayInfo.Builder and tweak @Purpose IntDef definition
PiperOrigin-RevId: 417378468
2022-01-05 10:37:50 +00:00
andrewlewis
d159634b5e Fix location of common module doc-files
For the media3 codebase the timeline images need to be under the common module.

Verified results in an empty commit for ExoPlayer GitHub.

PiperOrigin-RevId: 416850853
2022-01-05 10:35:40 +00:00
ibaker
075ee7fb3d Bump Guava version to 31.0.1
The version in the android tree was updated in
8337762fe0

PiperOrigin-RevId: 416011494
2022-01-05 09:59:41 +00:00
huangdarwin
edbfdd0d6c 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 16:02:20 +00:00
krocard
63935887b6 Rollback of 34108c6c92
*** 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 11:25:46 +00:00
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