18567 Commits

Author SHA1 Message Date
huangdarwin
a6897aedaa Effect: Add GlTextureInfo release() and accessor methods.
This allows us to disallow access after release.

PiperOrigin-RevId: 534046475
2023-05-24 15:42:47 +01:00
huangdarwin
438ae0ed6a ExoPlayer: Add setVideoFrameProcessorFactory().
This allows apps to use a custom VideoFrameProcessor implementation for video
playback. This may be useful, for example, when outputting to a texture.

PiperOrigin-RevId: 534044831
2023-05-24 15:41:46 +01:00
tonihei
33af245465 Improve handling of adding items to empty playlist in MediaController
This is a follow-up to 99dac0be0f where we made the same change in
ExoPlayerImpl and SimpleBasePlayer, but for consistency it makes
sense to also update the masking code in MediaControllerImplBase to
assume the same logic.

Note: MediaControllerImplLegacy already handles this case via
setMediaItems and doesn't need to be updated further.

#minor-release

PiperOrigin-RevId: 534038759
2023-05-24 15:40:42 +01:00
tonihei
1fa790348e Untangle PlayerInfo/PlaybackInfo updates
The methods in ExoPlayerImpl and MediaControllerImplBase that determine
the new PlayerInfo/PlaybackInfo currently have a hard-to-reason-about
setup where the method generating the new info accesses other methods
that rely on the existing class field instead of working with the
passed in PlayerInfo/PlaybackInfo. This prevents reuse of the util
methods (e.g. for replaceMediaItems) because they access potentially
stale state.

This change untangles these methods a bit by making the util methods
either static or at least ensure that they don't rely on existing
class fields of PlayerInfo/PlaybackInfo. Overall, the change is a
complete no-op.

#minor-release

PiperOrigin-RevId: 534036633
2023-05-24 15:39:31 +01:00
tonihei
caf1c77af1 Keep pending initial position when setting empty playlist
MediaControllerImplBase currently drops the pending initial seek
position when a user sets an empty playlist.

When seeking in empty playlists and setting new empty playlists,
the class also drops the the period index (and wrongly assigns zero
instead of the windowIndex).

#minor-release

PiperOrigin-RevId: 534035046
2023-05-24 15:38:17 +01:00
tonihei
6de6bd9c4f Extend main Player Javadoc
The main interface documentation hasn't been updated substantially
since 2017 and is missing notes for many of its current features and
requirements.

Also change the recommendation for implementors from BasePlayer to
SimpleBasePlayer to ensure new classes are more likely to cover all
of the interface requirements.

#minor-release

PiperOrigin-RevId: 534027117
2023-05-24 15:36:55 +01:00
andrewlewis
ea0b94c0eb Remove unnecessary volatile
This field is always accessed with the mutex held.

PiperOrigin-RevId: 534027096
2023-05-24 15:35:40 +01:00
andrewlewis
b0418f1a2a Use Ascii for conversion to lower case
PiperOrigin-RevId: 534016337
2023-05-24 15:34:40 +01:00
andrewlewis
2cbc2c6176 Run clang-format on GLSL
PiperOrigin-RevId: 534015933
2023-05-24 15:33:25 +01:00
ibaker
2b409da881 Remove deprecated zero-arg DefaultTrackSelector constructor
Use `DefaultTrackSelector(Context)` instead.

#minor-release

PiperOrigin-RevId: 533985937
2023-05-24 15:31:41 +01:00
jbibik
5008417c8c Make DrmConfiguration Bundleable
PiperOrigin-RevId: 533721679
2023-05-24 15:30:35 +01:00
sheenachhabra
b382a7c2da Move MdtaMetadataEntry class into container module
This class is to be shared between extractor, transformer
and muxer module.

PiperOrigin-RevId: 533490888
2023-05-24 15:29:23 +01:00
bachinger
2a6f893fba Set video size to 0/0 when video render is disabled
In terms of MCVR with a `VideoRendererEventListener`, the video size is set to
0/0 right after `onVideoDisabled()` is called and is set to the actual size as
soon as the video size is known after 'onVideoEnabled()`.

For ExoPlayer and in terms of the `Player` interface, `Player.getVideoSize()`
returns a video size of 0/0 when `Player.getCurrentTracks()` does not support
`C.TRACK_TYPE_VIDEO`. This is ensured by the masking behavior of
`ExoPlayerImpl` that sets an empty track selection result when the playing
period changes due to a seek or timeline removal.

When transitioning playback from a video media item to the next, or when
seeking within the same video media item, the renderer is not disabled.

#minor-release

PiperOrigin-RevId: 533479600
2023-05-24 15:28:20 +01:00
ibaker
485517f34d Upgrade to Gradle 8.0 and Android Gradle Plugin 8.0.1
This change was auto-generated by the Android Studio Upgrade Assistant.

Issue: androidx/media#409
PiperOrigin-RevId: 533467455
2023-05-19 17:24:28 +01:00
bachinger
3fa666c687 Return full media item when SystemUI calls service on device boot time
#minor-release

PiperOrigin-RevId: 533465595
2023-05-19 17:23:22 +01:00
ibaker
d5f9cf4f19 Add singleVariant publishing config to all published gradle files
Docs:
* https://developer.android.com/build/publish-library/configure-pub-variants#single-pub-var
* https://developer.android.com/reference/tools/gradle-api/8.0/com/android/build/api/dsl/PublishingOptions

This resolves the following warning from Android Gradle Plugin 7.2.2 and
helps unblock the upgrade to AGP 8.0.1:

> Software Components will not be created automatically for Maven
> publishing from Android Gradle Plugin 8.0. To opt-in to the future
> behavior, set the Gradle property
> `android.disableAutomaticComponentCreation=true` in the
> `gradle.properties` file or use the new publishing DSL.
>
> Affected Modules: `lib-cast`, `lib-common`, `lib-container`,
> `lib-database`, `lib-datasource`, `lib-datasource-cronet`,
> `lib-datasource-okhttp`, `lib-datasource-rtmp`, `lib-decoder`,
> `lib-effect`, `lib-exoplayer`, `lib-exoplayer-all (legacy)`,
> `lib-exoplayer-dash`, `lib-exoplayer-hls`, `lib-exoplayer-ima`,
> `lib-exoplayer-rtsp`, `lib-exoplayer-smoothstreaming`,
> `lib-exoplayer-workmanager`, `lib-extractor`, `lib-media2 (legacy)`,
> `lib-mediasession (legacy)`, `lib-muxer`, `lib-session`,
> `lib-transformer`, `lib-ui`, `lib-ui-leanback`, `test-utils`,
> `test-utils-robolectric`

Issue: androidx/media#409
PiperOrigin-RevId: 533464133
2023-05-19 17:22:21 +01:00
ibaker
50112c685b Remove deprecated ExoPlayer.retry(), use prepare() instead.
#minor-release

PiperOrigin-RevId: 533463348
2023-05-19 17:21:17 +01:00
ibaker
b3db85133a Add android.namespace to all build.gradle files
This is a pre-requisite for the Android Studio upgrade assistant to
upgrade from AGP 7.2.2 to 8.0.1, otherwise it fails and complains
this is missing.

Issue: androidx/media#409
PiperOrigin-RevId: 533463246
2023-05-19 17:19:15 +01:00
ibaker
0f8ddd5d1a Suffix package in test AndroidManifest.xml files with .test
This is blocking the upgrade to AGP 8.0.1. The Android Studio Upgrade
Assistant refuses to run with the error:
> Modules have the same package for their `main` and `androidTest`
> artifacts
>
> The package specifications in `AndroidManifest.xml` files define the
> same package for the `main` and `androidTest` artifacts, in the
> following modules: `effect`, `muxer`, `transformer`,
`test_exoplayer_abr`, `test_exoplayer_performance`, and `container`.

This change also adds the `.test` suffix to `test/AndroidManifest.xml`
files where it's missing, because although it's not mentioned in the
Upgrade Assistant error it does cause problems later.

```
> Incorrect package="androidx.media3.database" found in source AndroidManifest.xml: libraries/database/src/test/AndroidManifest.xml.
  Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
  Recommendation: remove package="androidx.media3.database" from the source AndroidManifest.xml: libraries/database/src/test/AndroidManifest.xml.
```

Issue: androidx/media#409
PiperOrigin-RevId: 533460180
2023-05-19 17:18:22 +01:00
ibaker
fe19dc421d Add logging where we were swallowing failed futures in media3.session
This may not be completely exhaustive, but it's better than before!

#minor-release

PiperOrigin-RevId: 533457167
2023-05-19 17:17:23 +01:00
ibaker
0e09c0041f Add empty headings to the 'unreleased changes' section of release notes
PiperOrigin-RevId: 533403520
2023-05-19 17:15:22 +01:00
claincly
d7ad431cfc Add a getter method for texture manager
PiperOrigin-RevId: 533402277
2023-05-19 17:14:12 +01:00
tonihei
c44b3828ca Add FilteringMediaSource that only provides tracks of given types
This is useful for cases where only certain types (e.g. only video)
from a source are needed and other tracks should be filtered out
completely to avoid later track selection issues.

#minor-release

PiperOrigin-RevId: 533394658
2023-05-19 17:12:52 +01:00
huangdarwin
25fa2df2de Effect: Use callback to release texture
This allows us to avoid needing a reference to the VideoFrameProcessor, which
can be especially difficult if an App only has a reference to the
VideoFrameProcessor.Factory it passes into Transformer/ExoPlayer.

PiperOrigin-RevId: 533205983
2023-05-19 17:10:53 +01:00
ibaker
04106da932 Allow mock(Random.class) to work with Java 17
https://stackoverflow.com/questions/70993863/mockito-can-not-mock-random-in-java-17

#minor-release

PiperOrigin-RevId: 533161221
2023-05-19 17:09:35 +01:00
jbibik
620b9e1540 Use TestUtil.getPublicMethods instead of getDeclaredMethods
JaCoCo introduces private synthetic methods (even on interfaces) which
have to be skipped when checking that a 'forwarding' implementation does
forward everything. Instead we can use the existing `getPublicMethods()`
method which implicitly skips these (since they're private).

PiperOrigin-RevId: 533130932
2023-05-19 17:08:26 +01:00
sheenachhabra
209783bdf2 Add argument validation in Mp4LocationData
PiperOrigin-RevId: 533121451
2023-05-19 17:06:27 +01:00
claincly
24a4396990 Always use sRGB/BT.709 for bitmap inputs
PiperOrigin-RevId: 533117700
2023-05-19 17:05:16 +01:00
ibaker
fe667560d0 Upgrade to Robolectric 4.10.3
We originally upgraded to 4.10 in 889f435a49

However I saw `ShadowActivityThread.reset: ActivityThread not set`
errors when running any Robolectric test, so I downgraded to 4.8.1:
85e449cd87

Nobody else on the team was seeing the same error with 4.10, so it was
something different about my local setup.

The error was actually masking a different problem (see discussion:
https://github.com/robolectric/robolectric/issues/8160). Upgrading to
4.10.1 made the underlying error clear:

```
java.lang.UnsatisfiedLinkError: /tmp/libconscrypt_openjdk_jni-linux-x86_6416831044223480000.so: libstdc++.so.6: cannot open shared object file: No such file or directory
```
This was then fixed by changing my 'Gradle JDK' value in Android Studio
from a JDK 11-based value to a 17-based one. If others see the same
`UnsatisfiedLinkError` when running the tests locally they should check
their Gradle JDK setting in Android Studio.

However there was **another** problem with 4.10 that **did** affect
everyone: some tests in `ExoPlayerTest` would fail with time outs or
assertion failures related to clock advancement.

After some investigation in https://github.com/robolectric/robolectric/issues/8187
it turns out this is because there's lots of unrelease `Player`
instances in `ExoPlayerTest`, which keep lots of active `HandlerThreads`
that then have to all be woken up by Robolectric. 4.10.3 has a fix that
mitigates this, so we can upgrade immediately - but we should also
release all the `Player` instances in `ExoPlayerTest` (it might speed
up test execution too).

PiperOrigin-RevId: 533068395
2023-05-18 12:23:03 +00:00
tofunmi
5fe10d7652 HDR texture asset loading
PiperOrigin-RevId: 532846248
2023-05-18 12:21:38 +00:00
rohks
538524e579 Remove deprecated methods Format.copyWithXXX
Use `Format.buildUpon()` and `setXXX` instead.

#minor-release

PiperOrigin-RevId: 532840625
2023-05-18 12:20:08 +00:00
sheenachhabra
410840c9e1 Add default constructor for InAppMuxer.Factory
PiperOrigin-RevId: 532838813
2023-05-18 12:18:43 +00:00
rohks
18aa664cb8 Remove deprecated methods that create an instance of Format
Use `Format.Builder` instead.

#minor-release

PiperOrigin-RevId: 532808478
2023-05-18 12:17:15 +00:00
huangdarwin
83190a0fe9 HDR: Blocklist Galaxy Z Fold 4 for HLG tone mapping.
This device failed on HdrEditingTest's exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows
before this CL, and succeeds on that test after this CL.

PiperOrigin-RevId: 532796897
2023-05-18 12:15:47 +00:00
Ian Baker
749c03ab76 Merge branch 'release' 2023-05-17 17:33:21 +01:00
Ian Baker
2fc189d6a4
Merge pull request #408 from androidx/release-1.0.2
1.0.2
1.0.2
2023-05-17 17:26:12 +01:00
ibaker
d77e79af49 Add main/dev-v2 branch options to bug.yml template
#minor-release

PiperOrigin-RevId: 532766676
(cherry picked from commit 84d0206c767526802aa3798dad7742ea807d5bc6)
2023-05-17 17:06:34 +01:00
ibaker
69879cd57f Add Media3 1.0.2 and ExoPlayer 2.18.7 to bug.yml template
PiperOrigin-RevId: 532765549
(cherry picked from commit 4ede3d600718969e6c62e855fcdf73805352a323)
2023-05-17 17:06:28 +01:00
sheenachhabra
7b62b33127 Move Mp4LocationData from extractor module to container module
This class will be shared between extractor and muxer module.

PiperOrigin-RevId: 532784415
2023-05-17 16:37:57 +01:00
ibaker
84d0206c76 Add main/dev-v2 branch options to bug.yml template
#minor-release

PiperOrigin-RevId: 532766676
2023-05-17 16:36:43 +01:00
ibaker
4ede3d6007 Add Media3 1.0.2 and ExoPlayer 2.18.7 to bug.yml template
#minor-release

PiperOrigin-RevId: 532765549
2023-05-17 16:35:14 +01:00
huangdarwin
94efcd7917 Effect: Make TexturePool and use in FinalWrapper.
Have the FinalShaderProgramWrapper / VideoFrameProcessor texture
output access textures provided through a texture pool, that
recycles used textures.

Also, add the TexturePool interface to generally re-use textures.

PiperOrigin-RevId: 532754377
2023-05-17 16:33:57 +01:00
sheenachhabra
e0d6f67dd9 Move NAL unit related methods from common to container module
PiperOrigin-RevId: 532750099
2023-05-17 16:32:46 +01:00
christosts
64215418f8 Add General MIDI support using Sonivox architecture
PiperOrigin-RevId: 532747428
2023-05-17 16:31:36 +01:00
kimvde
028b3a7312 Simplify FrameConsumptionManager onReadyToAcceptInputFrame logic
Propagate the "end of current stream" signal directly after queueing the
last frame, instead of waiting for the next onReadyToAcceptInputFrame()
call.

PiperOrigin-RevId: 532739462
2023-05-17 16:30:29 +01:00
Ian Baker
c48471109e Update media3 version number to 1.0.2 2023-05-17 10:15:34 +01:00
ibaker
6a7a3763f4 Update release notes for Media3 1.0.2
PiperOrigin-RevId: 532404001
(cherry picked from commit 1a38a0c41ebad512e9baab14d562f06de934177f)
2023-05-17 10:12:45 +01:00
tianyifeng
5d4c73eee5 Avoid using @see in the summary fragment in C.java
PiperOrigin-RevId: 532536037
2023-05-17 08:51:06 +01:00
rohks
df52864420 Remove deprecated WorkManagerScheduler constructor
Use a non deprecated constructor that includes the option to provide a `Context` parameter instead.

#minor-release

PiperOrigin-RevId: 532535770
2023-05-17 08:49:45 +01:00
rohks
1061135cfd Remove deprecated String constants for Charsets
Use Kotlin Charsets from the `kotlin.text` package, the `java.nio.charset.StandardCharsets` or the `com.google.common.base.Charsets` instead.

#minor-release

PiperOrigin-RevId: 532469103
2023-05-17 08:48:35 +01:00