18607 Commits

Author SHA1 Message Date
jbibik
1c6b894e88 Allow ExoPlayer to opt into volume device control, forbidden by default
PiperOrigin-RevId: 532136692
2023-05-16 09:54:37 +01:00
tonihei
79657692e4 Remove unnecessary warning suppression
PiperOrigin-RevId: 532114601
2023-05-16 09:53:35 +01:00
ibaker
8a5cebb54d Remove deprecated DefaultDrmSessionManager constructors
Use `DefaultDrmSessionManager.Builder` instead.

#minor-release

PiperOrigin-RevId: 532102375
2023-05-16 09:52:21 +01:00
huangdarwin
07ec1eaa48 Effect: Multiple Texture output
Allow the VideoFrameProcessor to output multiple textures at a time, so that
lifetime of textures is up to the consumer calling VFP.releaseOutputFrame.

The FinalShaderProgramWrapper also has a new maxCapacity limit added, to ensure
the a reasonable amount of textures is used and avoid using up memory.

PiperOrigin-RevId: 532094256
2023-05-16 09:49:52 +01:00
tonihei
96dd0ae583 Add consistency check to sending and receiving position updates
The periodic updates are only meant to happen while we are in the
same period or ad. This was already guaranteed except for two cases:
1. The Player in a session has updated its state without yet calling
   its listeners
2. The session scheduled a PlayerInfo update that hasn't been sent yet

... and in both cases, the following happened:
 - The change updated the mediaItemIndex to an index that didn't exist
   in a previous Timeline known to the Controller
 - One of the period position updates happened to be sent at exactly
   this time

This problem can be avoided by only scheduling the update if we are
still in the same period/ad and haven't scheduled a normal PlayerInfo
update already.

Since new MediaControllers may still connect to old sessons with this
bug, we need an equivalent change on the controller side to ignore such
buggy updates.

PiperOrigin-RevId: 532089328
2023-05-16 09:48:50 +01:00
andrewlewis
6850391e45 Fix lost shader input capacity after end-of-stream
When exporting compositions with multiple images in a row, transformation could
get stuck if a shader was ready to accept input when end-of-stream was already
signaled and queued from upstream. Fix accounting for the downstream capacity.

Manually tested on concatenations with several images and several videos in a
row, by adding logging and verifying the capacity updates as expected across
edited media item transitions.

PiperOrigin-RevId: 532088793
2023-05-16 09:47:45 +01:00
ibaker
8f29a5eba9 Delete deprecated zero-arg DefaultBandwidthMeter constructor
Use `DefaultBandwidthMeter.Builder` instead.

#minor-release

PiperOrigin-RevId: 532069549
2023-05-16 09:46:43 +01:00
kimvde
6dfb387117 Refactor SequenceAssetLoader release
In the past, the SequenceAssetLoader was released in TransformerInternal
when the export ended.

fc539da061 was made to release the SequenceAssetLoader earlier, when
loading ended. This was causing player release timeouts because the last
AssetLoader in the sequence was released before the SamplePipelines (see
0b40bc37ab for more information).

The code that was releasing the SequenceAssetLoader was first commented
out because we didn't have an understanding of what was happening.

This change removes the early SequenceAssetLoader release all together.
It doesn't have any effect as this code was already commented out.

PiperOrigin-RevId: 532065673
2023-05-16 09:43:36 +01:00
andrewlewis
857e6ebee8 Signal end-of-stream after creating latch
The output end-of-stream notification from the last shader could theoretically
arrive before the latch for detecting it is created, which might cause waiting
on the latch indefinitely. Create the latch before signaling end of stream so
that it's guaranteed to be set before the end-of-stream signal arrives.

PiperOrigin-RevId: 532056472
2023-05-16 09:42:25 +01:00
ibaker
0a86790be2 Remove two deprecated SimpleCache constructors
Use a non-deprecated constructor that takes a `DatabaseProvider`
instead for better performance.

#minor-release

PiperOrigin-RevId: 532046598
2023-05-16 09:41:12 +01:00
ibaker
0888dfbd05 Update the root project name check in publish.gradle
The name was changed in 25581384e9
and this check wasn't updated, meaning publishing no longer worked
(it didn't publish anything, just printed lots of warnings like
`Skipping task ':test-utils-robolectric:publish' as it has no
actions.`). This change means the check is now using the same
source-of-truth as the root project name, so it shouldn't go out of
sync again.

PiperOrigin-RevId: 531457952
(cherry picked from commit 4c1eb8aec7258324134913db521cd0a005ece31b)
2023-05-15 16:33:18 +01:00
ibaker
f71370af75 Remove a copybara stripping tag
#minor-release

PiperOrigin-RevId: 530935437
(cherry picked from commit 17b183b11a3499ce0f86b53b9d60b66ba71f73cc)
2023-05-15 16:32:39 +01:00
ibaker
a098f8672e Add tests for MediaLibraryInfo version code consistency
`VERSION_INT` is quite long with several sections, and it's easy to make
a mistake when updating it - this should help since it checks it against
`VERSION`, which is more easily human readable/writable.

PiperOrigin-RevId: 529747023
(cherry picked from commit eb58d20067b258746f72127a601dd5ee40ce9c25)
2023-05-15 16:32:39 +01:00
bachinger
3064bc9b37 Fix value type when unbundling LibraryResult without expected type
Calling LibraryResult.toBundle() could have caused a CastClassException.
This was because when unbundled with UNKNOWN_TYPE_CREATOR.fromBundle(Bundle),
the valueType was set to VALUE_TYPE_ITEM_LIST for all types and the MediaItem
was attempted to be casted to a list.

PiperOrigin-RevId: 529717688
(cherry picked from commit f28a5888091c5caa685117d7a6653ae6c5a29f26)
2023-05-15 16:32:38 +01:00
ibaker
13191edd90 Javadoc tweaks for MediaSession.MediaItemsWithPosition
Also change some type parameter names in `MediaSession.BuilderBase`
because `C` now clashes with the import of `androidx.media3.common.C`.

#minor-release

PiperOrigin-RevId: 529665698
(cherry picked from commit 78f20257bd9b1cdebea3f2968cb946046b1e34d8)
2023-05-15 16:32:38 +01:00
ibaker
7a1d7bf5ea Temporarily suppress missing permission lint in session demo
#minor-release

PiperOrigin-RevId: 529370535
(cherry picked from commit 0f398d511dda9e89db64c841329a3938ea38bb62)
2023-05-15 16:32:38 +01:00
ibaker
375cdb2e22 Use a for-each loop instead of forEach in PlaybackService.kt
The current code flags a lint error:

```
Error: Call requires API level 24 (current min is 16): java.lang.Iterable#forEach [NewApi]
```

I think this is a bit confusing because this is calling the Java
[`Iterable.forEach`](https://developer.android.com/reference/java/lang/Iterable#forEach(java.util.function.Consumer%3C?%20super%20T%3E))
method which was added in Java 8 (and therefore is only available on
API 24 and up), but there is **also** a Kotlin
[`List.forEach`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/for-each.html)
method which is available in all versions of Kotlin (and therefore all
Android versions). Since this is a Kotlin file, at first glance you
would assume this is the Kotlin method - but it's not.

This also doesn't seem to be flagged by Android Studio, but is caught
by Gradle lint on the command line.

#minor-release

PiperOrigin-RevId: 529112610
(cherry picked from commit 09b474a51936c9c83df32dfcaf816e37a72552ce)
2023-05-15 16:32:38 +01:00
ibaker
b0b34def3d Fix demo app UnsafeOptInUsageError lint errors
This change:
* Adds missing `@OptIn` annotation to demo app's `ErrorMessageProvider`
* Switches from `Util.SDK_INT` to `Build.VERSION.SDK_INT` in
  `SampleChooserActivity` (`PlayerActivity` is already using this).

This code hasn't changed recently, and it doesn't fail on the `release`
branch, but it failed when I checked the `main` branch just now - so I
assume lint has updated to detect more cases where unstable APIs are
being used without opt-in. I suspect the difference is due to different
Android Gradle Plugin versions between the branches.

#minor-release

PiperOrigin-RevId: 529111669
(cherry picked from commit ebcdd983e2c5a9819d8a66873351bccbf93124c6)
2023-05-15 16:32:38 +01:00
tofunmi
feb83c2d59 Update translations
PiperOrigin-RevId: 529069808
(cherry picked from commit bba760f6e5ae8ba6db2cd2e45163698223335c2a)
2023-05-15 16:32:38 +01:00
michaelkatz
841bdc6efe Add UTF-16 encoded subtitle support to SsaDecoder
Issue: androidx/media#319
PiperOrigin-RevId: 527891646
(cherry picked from commit 06ac2f7990f0cdf691365cc304fade522c983761)
2023-05-15 16:32:36 +01:00
bachinger
179e35b3d1 Add JavaDoc to some undocumented methods and move them
PiperOrigin-RevId: 527870443
(cherry picked from commit 336d4b386f9691fff419728d901d0d6ee7a2ebf8)
2023-05-15 16:29:03 +01:00
tonihei
40ef64ac3a Fix leaks of media session service.
References to the service are kept from MediaSessionStub
and from a long-delayed Handler messages in ConnectionTimeoutHandler.

Remove strong references from these places by making the timeout
handler static and ensuring ConnectedControllersManager only keeps
a weak reference to the service (as it's part of MediaSessionStub).

Issue: androidx/media#346
PiperOrigin-RevId: 527543396
(cherry picked from commit 8c262d6c072304ed9f16feca64b70a18645cc908)
2023-05-15 16:28:57 +01:00
bachinger
3406334ee8 Allow MediaLibraryService to reject the resumption notification
To reliably reject the System UI playback resumption notification on
all API levels (specifically API 30), the backward compatibility layer
needs to return `null` for the library root.

This is not possible in the Media3 implementation. This change allows
an app to return a `LibraryResult.ofError(RESULT_ERROR_NOT_SUPPORTED)`
that then is translated to return null by the backwards compatibility
layer.

Issue: androidx/media#355
Issue: androidx/media#167
Issue: androidx/media#27

See https://developer.android.com/guide/topics/media/media-controls#mediabrowserservice_implementation

PiperOrigin-RevId: 527276529
(cherry picked from commit 7938978b5165a9cbb63a6ee1fe5209934e996c6e)
2023-05-15 16:27:46 +01:00
Ian Baker
31492031c1 Merge pull request #313 from pengbins:fix_ts_h265reader_parse_sps
PiperOrigin-RevId: 527259619
(cherry picked from commit fab134f0b3194349aaac702f4c582ee20356b1dc)
2023-05-15 16:26:20 +01:00
ibaker
20924724fc Ensure DrmSessionManager.setPlayer() is called before prepare()
`prepare()` now logs a warning if it's called before `setPlayer()`
because it's not possible to tell if it's being called on the wrong
thread (since 3480a27994).

This change finds all the places one is called immediately after the
other and flips the order to be more correct.

Issue: androidx/media#350

#minor-release

PiperOrigin-RevId: 526582294
(cherry picked from commit 6aacbc6bbb11a5a55ec812cc93e0bb1b6810749e)
2023-05-15 16:14:45 +01:00
tonihei
3f5d777f38 Clarify threading requirement for MediaController.releaseFuture
And remove unnecessary check for isDone.

Issue: androidx/media#345
PiperOrigin-RevId: 525999615
(cherry picked from commit 186f3d5c7767e65cc823846b045282c05ed30da5)
2023-05-15 16:14:45 +01:00
tonihei
0f6a1eb6b8 Update available commands when MediaSessionCompat actions change
This is a bug currently, where commands are created once but never
updated again if the actions in MediaSessionCompat are changed.

PiperOrigin-RevId: 525999084
(cherry picked from commit 79fab6783e07ea594410be347c8a3d6e1124707d)
2023-05-15 16:14:40 +01:00
tonihei
58cf3a7ba2 Remove unnecessary Activity method overrides in session demo app
The PlayerView methods are documented to only be needed for sphrerical
playbacks, which we are not using in the session demo app.

PiperOrigin-RevId: 525986709
(cherry picked from commit 2de89ca2ce4c06bcbf9cb80dcc903f2cdd3ff733)
2023-05-15 16:11:02 +01:00
michaelkatz
eee226ea40 Render last frame even if have not read BUFFER_FLAG_END_OF_STREAM
If the limited number of input buffers causes reading of all samples except the last one conveying end of stream, then the last frame will not be rendered.

PiperOrigin-RevId: 525974445
(cherry picked from commit affbb7c57e73eb4f4f654f224c477fdd2e3ac9f2)
2023-05-15 16:10:51 +01:00
ibaker
9366b4e50a Rollback of 509830f38f
*** Original commit ***

Rollback of 221a56da38

*** Original commit ***

Rollback of 749d77b1d9

*** Original commit ***

PiperOrigin-RevId: 531530885
2023-05-15 10:41:58 +01:00
huangdarwin
2736b11845 Transformer: Add latest input format to DebugTraceUtil
This can provide more information to help debug muxer errors

PiperOrigin-RevId: 531521974
2023-05-15 10:39:57 +01:00
bachinger
9bf6b7ea20 Implement SystemUI contract for media resumption
When a `MediaButtonReceiver` is found in the manifest, the library
can implement the contract of SystemUI to signal that the app wants
a playback resumption notification to be displayed.

And, vice versa, if no `MediaButtonReceiver` is in the manifest, the
library will signal to not show the notification after the app has been
terminated.

#minor-release

PiperOrigin-RevId: 531516023
2023-05-15 10:38:44 +01:00
sheenachhabra
eb8ec87a5c Add container module
This module will contain functionalities common to extractor and muxer.

PiperOrigin-RevId: 531501602
2023-05-15 10:37:30 +01:00
sheenachhabra
b3fd202e11 Add test file with metadata track
Mp4Muxer supports adding Metadata track.
Added test file to cover this scenario.

PiperOrigin-RevId: 531496409
2023-05-15 10:36:17 +01:00
sheenachhabra
867355fdc5 Rollback of 925aa34e13
*** Original commit ***

Rollback of 65d5132f76

*** Original commit ***

Create InAppMuxer in transformer

To use the InAppMuxer, the client needs to pass InAppMuxer Factory.

***

***

PiperOrigin-RevId: 531470081
2023-05-12 13:20:31 +00:00
ibaker
4c1eb8aec7 Update the root project name check in publish.gradle
The name was changed in 25581384e9
and this check wasn't updated, meaning publishing no longer worked
(it didn't publish anything, just printed lots of warnings like
`Skipping task ':test-utils-robolectric:publish' as it has no
actions.`). This change means the check is now using the same
source-of-truth as the root project name, so it shouldn't go out of
sync again.

#minor-release

PiperOrigin-RevId: 531457952
2023-05-12 13:19:17 +00:00
huangdarwin
5b683721f9 Test: Relax constraints on selected Sony devices.
Until the linked bug is fixed, relax constraints to allow this one device to
pass, to suppress failures and avoid triage toil.

PiperOrigin-RevId: 531259233
2023-05-12 10:12:37 +01:00
huangdarwin
5313763eb3 Test: Filter test more precisely, with model instead of manufacturer
PiperOrigin-RevId: 531233480
2023-05-12 10:10:15 +01:00
bachinger
1ca9e0024b Remove static MediaSessionImpl.serviceComponentName
An app must only have a single service in the manifest that is either
exposing `MediaLibraryService.SERVICE_INTERFACE` or
`MediaSessionService.SERVICE_INTERFACE`. Hence the component name found by
querying the package manager for a service never returns a different result
when queried again.

The static `MediaSessionImpl.serviceComponentName` can hence be removed
and the package manager queried again when a second session instance
is created.

#minor-release

PiperOrigin-RevId: 531210456
2023-05-12 10:08:50 +01:00
huangdarwin
674885cfa5 Test: Suppress failing 8k24 SSIM bug.
PiperOrigin-RevId: 531193242
2023-05-12 10:07:55 +01:00
christosts
dae7abbfa6 End-to-end Robolectric playback test for audio capabilities
This change adds end-to-end Robolectric playback tests which handle
the scenario the player is playing audio via passthrough and
AudioTrack raises the ERROR_DEAD_OBJECT error upon which the player
attempts to recover by switching to another audio format.

PiperOrigin-RevId: 531180183
2023-05-12 10:06:47 +01:00
tofunmi
565a013d8d Refactor ChainingGlShaderProgramListener to use FrameConsumptionManager
PiperOrigin-RevId: 531180020
2023-05-12 10:05:48 +01:00
kimvde
203450d244 Small fixes in TextureAssetLoader
The texture input tests in TransformerEndToEndTest were not passing on
Pixel 7. Implemented a fix and fixed other minor threading issues I
spotted while looking at the code.

PiperOrigin-RevId: 531141659
2023-05-11 10:07:43 +00:00
kimvde
e8072ca2c7 Move VideoFrameProcessorFactory setter to Transformer
PiperOrigin-RevId: 531123743
2023-05-11 10:06:21 +00:00
huangdarwin
82ede47398 media3: Capitalize "MIME" for MIME types.
Find and replace "mime" to "MIME", where appropriate, throughout media3.

PiperOrigin-RevId: 531122121
2023-05-11 10:05:01 +00:00
Googler
925aa34e13 Rollback of 65d5132f76
*** Original commit ***

Create InAppMuxer in transformer

To use the InAppMuxer, the client needs to pass InAppMuxer Factory.

***

PiperOrigin-RevId: 531056436
2023-05-11 10:03:35 +00:00
ibaker
17b183b11a Remove a copybara stripping tag
#minor-release

PiperOrigin-RevId: 530935437
2023-05-11 10:02:15 +00:00
tofunmi
7fea435b7e Transformer: Support Texture asset loading
PiperOrigin-RevId: 530888319
2023-05-11 10:01:00 +00:00
sheenachhabra
97b65bcf67 Refactor track specific logic in Mp4MoovStructure
PiperOrigin-RevId: 530878135
2023-05-11 09:59:35 +00:00
Googler
ecaf219d74 Adding mime type checking to Transformer to identify images.
PiperOrigin-RevId: 530711523
2023-05-11 09:58:15 +00:00