16324 Commits

Author SHA1 Message Date
kimvde
e12dd1ac5d Surface player release timeouts
Also make sure the demo app doesn't crash when it happens.

PiperOrigin-RevId: 490725959
2022-11-24 15:00:34 +00:00
rohks
82711630ed Rollback of 427329175e
*** Original commit ***

Rollback of 76df06a7a3

*** Original commit ***

Parse and set `peakBitrate` for Dolby TrueHD(AC-3) and (E-)AC-3

#minor-release

***

***

PiperOrigin-RevId: 490707234
2022-11-24 14:55:08 +00:00
rohks
427329175e Rollback of 76df06a7a3
*** Original commit ***

Parse and set `peakBitrate` for Dolby TrueHD(AC-3) and (E-)AC-3

#minor-release

***

PiperOrigin-RevId: 490570517
2022-11-24 14:53:04 +00:00
huangdarwin
7d45b9d83a Tests: Set SSIM decoder KEY_PRIORITY to 1.
This reduces the priority to best effort (from the default that seems to be best effort), and allows us to run SSIM even on 8k24fps video. Without this CL,
start()'ing a second codec may result in a MediaCodec.CodecException.

Tested to confirm that transformation8k24():
* fails deterministically without this CL, or with KEY_PRIORITY set to 0.
* succeeds deterministically after this CL (~18s on Samsung Z Fold 4)

PiperOrigin-RevId: 490570416
2022-11-24 14:52:09 +00:00
huangdarwin
d74eb7500f Transformer: Document when OMX video codecs will no longer exist.
We cannot check this in code, due to DEVICE_INITIAL_SDK_INT being a @SystemApi, and
reflection being a bit risky/unstable.

PiperOrigin-RevId: 490537916
2022-11-24 14:51:06 +00:00
rohks
76df06a7a3 Parse and set peakBitrate for Dolby TrueHD(AC-3) and (E-)AC-3
#minor-release

PiperOrigin-RevId: 490527831
2022-11-24 14:49:50 +00:00
tianyifeng
80927260fd Handle the bitmap loading result with applicationHandler
Before this change, the bitmap loading result with mainHandler, in which we set the metadata to `MediaSessionCompat`. However, the `MediaSessionCompat` is not thread safe, all calls should be made from the same thread. In the other calls to `MediaSessionCompat`, we ensure that they are on the application thread (which may be or may not be main thread), so we should do the same for `setMetadata` when bitmap arrives.

Also removes a comment in `DefaultMediaNotificationProvider` as bitmap request caching is already moved to CacheBitmapLoader.

PiperOrigin-RevId: 490524209
2022-11-24 14:48:50 +00:00
huangdarwin
2693ca138d Transformer: Remove obsolete TODO from TransformationException.
The bug has since been fixed.

The values still could change, as the API is labelled as @UnstableApi, so it's
probably fine to leave the <p> tag mostly as is.

PiperOrigin-RevId: 490509205
2022-11-24 14:47:37 +00:00
christosts
2424ee7792 Misc fix in gradle build file
Issue: androidx/media#209

#minor-release

PiperOrigin-RevId: 490492223
2022-11-24 14:46:43 +00:00
bachinger
3d8c52f28d Exclude tracks from PlayerInfo if not changed
This change includes a change in the `IMediaController.aidl` file and needs
to provide backwards compatibility for when a client connects that is of an older or
newer version of the current service implementation.

This CL proposes to create a new AIDL method `onPlayerInfoChangedWithExtensions`
that is easier to extend in the future because it does use an `Bundle` rather than
primitives. A `Bundle` can be changed in a backward/forwards compatible way
in case we need further changes.

The compatibility handling is provided in `MediaSessionStub` and `MediaControllerStub`. The approach is not based on specific AIDL/Binder features but implemented fully in application code.

Issue: androidx/media#102
#minor-release
PiperOrigin-RevId: 490483068
2022-11-24 14:45:37 +00:00
samrobinson
10fac6847a Return output immediately if available from AudioProcessingPipeline.
If there is output data available (outputBuffer.hasRemaining()), then
there is no need to move other data between the underlying processors.
It will not change the buffer being returned by that call to getOutput.

If there is no output data readily available, it's necessary to go to
the AudioProcessors and pass buffers between them, as this may produce
data for output.

PiperOrigin-RevId: 490482653
2022-11-24 14:44:40 +00:00
bachinger
68908be18d Call future listener on the same handler that created the controller
The direct executor is not the proper way to determine on what thread to run the
`Future.Listener` and the `MediaControllerCreationListener` because the listener
may call the controller passed as argument which must happen on the same thread
that built the controller. This change makes sure this is the case.

PiperOrigin-RevId: 490478587
2022-11-24 14:43:44 +00:00
Ian Baker
a32b82f7bd Merge pull request #10786 from TiVo:p-aacutil-test-impl
PiperOrigin-RevId: 490465182
2022-11-24 14:41:58 +00:00
huangdarwin
0a176d1f05 Tests: Move codec configure() out of VideoDecodingWrapper constructor.
This allows us to release both codecs used in SSIM when one fails to
configure() or start().

Tested and confirmed that on Samsung Galaxy Z Flip 4, running all
TransformationTest.java tests, tests after transform8k24() fails to start the
2nd codec:
* Before this CL, all fail.
* After this CL, all pass.

PiperOrigin-RevId: 490461560
2022-11-24 14:40:47 +00:00
tonihei
03f0b53cf8 Add helper method to convert platform session token to Media3 token
This avoids that apps have to depend on the legacy compat support
library when they want to make this conversion.

Also add a version to both helper methods that takes a Looper to
give apps the option to use an existing Looper, which should be
much faster than spinning up a new thread for every method call.

Issue: androidx/media#171
PiperOrigin-RevId: 490441913
2022-11-24 14:39:54 +00:00
bachinger
1803d1cdb8 Migrate BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_SUPPORTED_FLAGS to Media3
PiperOrigin-RevId: 490376734
2022-11-24 14:38:41 +00:00
tianyifeng
8ce1213ddd Load bitmaps for MediaSessionCompat.QueueItem.
When receiving the `onTimelineChanged` callback, we convert the timeline to the list of `QueueItem`s, where decoding a bitmap is needed for building each of the `QueueItem`s. The strategy is similar to what we did in <unknown commit> for list of `MediaBrowserCompat.MediaItem` - set the queue item list until the bitmaps decoding for all the `MediaItem`s are completed.

PiperOrigin-RevId: 490283587
2022-11-24 14:37:23 +00:00
samrobinson
af1d7b9b1b Fix SpeedChangingAudioProcessor handling of EMPTY_BUFFER.
PiperOrigin-RevId: 490265564
2022-11-24 14:36:14 +00:00
microkatz
9d84666c8f Merge branch 'release' 2022-11-23 12:06:03 +00:00
Michael Katz
c2cbb6370a
Merge pull request #210 from androidx/release-1.0.0-beta03
1.0.0-beta03
1.0.0-beta03
2022-11-23 11:38:16 +00:00
christosts
6661b757fd Fix compilation error in ffmpeg JNI layer
PiperOrigin-RevId: 490263003
(cherry picked from commit a9be38a339161c9a286c496ba48cdde1d1db5fdc)
2022-11-23 09:52:20 +00:00
christosts
a9be38a339 Fix compilation error in ffmpeg JNI layer
PiperOrigin-RevId: 490263003
2022-11-22 17:46:02 +00:00
tofunmi
779b042845 Update effect test results bitmaps following emulator update.
Ran all the [effects instrumentation tests](https://source.corp.google.com/piper///depot/google3/third_party/java_src/android_libs/media/libraries/effect/src/androidTest/java/androidx/media3/effect/;bpv=1;bpt=0) and replaced the [bitmaps](https://source.corp.google.com/piper///depot/google3/third_party/java_src/android_libs/media/libraries/test_data/src/test/assets/media/bitmap/;bpv=0;bpt=0) for the tests that were failing due to a small difference over the targeted 0.1 [threshold](https://source.corp.google.com/piper///depot/google3/third_party/java_src/android_libs/media/libraries/effect/src/androidTest/java/androidx/media3/effect/BitmapTestUtil.java;rcl=477974779;l=64) whose new bitmaps could be generated from the` crow --device generic_phone --api_level 31 --arch=arm64
` emulator.

PiperOrigin-RevId: 490261228
2022-11-22 17:44:53 +00:00
huangdarwin
4d50e0221e Tests: Throw exception when network is needed but not available.
This exception is a bit shorter and more clear (and is more clear that this is a
test issue, as opposed to the prior issue that was thrown as an ExoPlayer
DataSourceException, which may seem like a legitimate Transformer failure)

PiperOrigin-RevId: 490252772
2022-11-22 17:43:08 +00:00
huangdarwin
d0c5168902 HDR Tests: Rename remote URIs to REMOTE instead of ASSET.
Following naming conventions throughout AndroidTestUtil, REMOTE files should have REMOTE instead of ASSET. Update the URI and FORMAT names accordingly.

PiperOrigin-RevId: 490237673
2022-11-22 17:42:01 +00:00
tonihei
103b7cde30 Reorder some release notes in other sections.
#minor-release

PiperOrigin-RevId: 490224795
(cherry picked from commit fa531b79249e5435af719bfbe168b999b5032b47)
2022-11-22 15:05:41 +00:00
tonihei
fa531b7924 Reorder some release notes in other sections.
#minor-release

PiperOrigin-RevId: 490224795
2022-11-22 14:20:56 +00:00
ibaker
ff48faec5f Add DefaultExtractorsFactory.setTsSubtitleFormats
ExoPlayer is unable to detect the presence of subtitle tracks in some
MPEG-TS files that don't fully declare them. It's possible for a
developer to provide the list instead, but doing so is quite awkward
without this helper method. This is consistent for how
`DefaultExtractorsFactory` allows other aspects of the delegate
`Extractor` implementations to be customised.

* Issue: google/ExoPlayer#10175
* Issue: google/ExoPlayer#10505

#minor-release

PiperOrigin-RevId: 490214619
2022-11-22 14:19:45 +00:00
tonihei
c41a5c8420 Do not require package visibility when obtaining SessionTokens
The only reason this is required at the moment is to set the
process UID field in the token, that is supposed to make it easier
for controller apps to identify the session. However, if this
visibility is not provided, it shouldn't stop us from creating
the controller for this session.

Also docuement more clearly what UID means in this context.

PiperOrigin-RevId: 490184508
2022-11-22 12:05:03 +00:00
michaelkatz
fc505384c9 Version bump to exoplayer:2.18.2 and media3:1.0.0-beta03
PiperOrigin-RevId: 489959918
(cherry picked from commit 4ea72f0c739f4478cc99b73c5c3550eadaad32ab)
2022-11-22 11:08:15 +00:00
ibaker
ca5a0d7dad Remove @hide javadoc annotation from ExoPlayer GitHub
This tag is only understood by Dackka, which is used to generate the media3 javadoc.

PiperOrigin-RevId: 489233200
(cherry picked from commit 0388631ee22dd9ce0e8903653f8c1f3bf84030ea)
2022-11-22 11:05:15 +00:00
michaelkatz
5eddd9689f Filter bogus AndroidX core jar file when creating javadoc
#minor-release

PiperOrigin-RevId: 489202167
(cherry picked from commit 6e73fc545d7b38a0b89150c98a4c567d132551fb)
2022-11-22 11:05:15 +00:00
ibaker
45b8fb0ae1 Add set -eu to all shell scripts
These flags ensure that any errors cause the script to exit (instead of
just carrying on) (`-e`) and that any unrecognised substitution variables
cause an error instead of silently resolving to an empty string (`-u`).

Issues like Issue: google/ExoPlayer#10791 should be more quickly resolved with
`set -e` because the script will clearly fail with an error like
`make: command not found` which would give the user a clear pointer
towards the cause of the problem.

#minor-release

PiperOrigin-RevId: 490001419
2022-11-22 10:11:32 +00:00
kimvde
d8eec16369 Refactor progress logic to be thread safe
PiperOrigin-RevId: 489984147
2022-11-22 10:10:21 +00:00
michaelkatz
4ea72f0c73 Version bump to exoplayer:2.18.2 and media3:1.0.0-beta03
#minor-release

PiperOrigin-RevId: 489959918
2022-11-22 10:09:12 +00:00
tonihei
2fd4aac310 Do not require package visibility when connecting to a Media3 session
When we currently call SessionToken.createSessionToken with a legacy
token, we call the package manager to get the process UID. This
requires visiblity to the target package, which may not be available
unless the target runs a service known to the controller app.

However, when connecting to a Media3, this UID doesn't have to be
known, so we can move the call closer to where it's needed to
avoid the unncessary visibility check.

In addition, a legacy session may reply with unknown result code
to the session token request, which we should handle as well.

One of the constructor can be removed since it was only used from
a test.

PiperOrigin-RevId: 489917706
2022-11-22 10:08:08 +00:00
claincly
dba9d81640 Destroy eglSurface in FrameProcessor
Previously, FrameProcessor never had the usecase in which the output surface
is replaced, while previewing introduced this usecase.

When switching output surfaces, we need to destroy the EGL Surface linked to the
surface that is being swapped out, because an EGL surface is linked to the EGL
display (which is not destroyed even when releasing FrameProcessor).

A GL exception will be thrown in the following scenario if we don't destroy the
EGL surface:

1. Creates a Surface, the surface is identified by address 0x11
2. Sets Surface(0x11) on FrameProcessor. Eventually an EGL surface is created
  to wrap Surface(0x11)
3. Release FrameProcess, this releases the EGL context
4. Instantiate a new FrameProcessor, sets Surface(0x11) as the output
5. When FrameProcessor creates an EGL surface to wrap Surface(0x11), GL throws
  an exception, becasue Surface(0x11) has previouly been connected to an EGL
  surface.

PiperOrigin-RevId: 489590072
2022-11-22 10:06:58 +00:00
tonihei
81918d8da7 Add remaining state and getters to SimpleBasePlayer
This adds the full Builders and State representation needed to
implement all Player getter methods and listener invocations.

PiperOrigin-RevId: 489503319
2022-11-22 10:05:57 +00:00
kimvde
56cf5e0774 Build TransformationResult only when transformation succeeded
PiperOrigin-RevId: 489442518
2022-11-22 10:04:56 +00:00
christosts
07d25bf41d Pass correct frame size for passthrough playback
When estimating the AudioTrack min buffer size, we must use a PCM
frame of 1 when doing direct playback (passthrough). The code was
passing -1 (C.LENGTH_UNSET).

PiperOrigin-RevId: 489238392
2022-11-22 10:01:43 +00:00
tonihei
d1b470e4cc Add additional codecs to the eosPropagationWorkaround list.
Issue: google/ExoPlayer#10756
PiperOrigin-RevId: 489236336
2022-11-22 10:00:08 +00:00
ibaker
cba65c8c61 Throw exception if a released player is passed to TestPlayerRunHelper
I considered moving this enforcement inside the ExoPlayerImpl
implementation, but it might lead to app crashes in cases that apps
(incorrectly) call a released player, but it wasn't actually causing a
problem.

PiperOrigin-RevId: 489233917
2022-11-22 09:59:05 +00:00
ibaker
0388631ee2 Remove @hide javadoc annotation from ExoPlayer GitHub
This tag is only understood by Dackka, which is used to generate the media3 javadoc.

PiperOrigin-RevId: 489233200
2022-11-22 09:58:02 +00:00
tofunmi
dd9741399b Reordering views for consistency in transformer demo app
PiperOrigin-RevId: 489216085
2022-11-22 09:56:55 +00:00
tofunmi
8cec71b3e8 Fix video disappearing when the app is brought out of the background
PiperOrigin-RevId: 489212224
2022-11-22 09:55:49 +00:00
tonihei
22ccc1a128 Mark broadcast receivers as not exported
They are called from the system only and don't need to be exported
to be visible to other apps.

PiperOrigin-RevId: 489210264
2022-11-22 09:54:45 +00:00
tianyifeng
4ce171a3cf Load bitmaps for MediaBrowserCompat.
* Transforms the `ListenableFuture<LibraryResult<MediaItem>>` and `ListenableFuture<LibraryResult<List<MediaItem>>>` to `ListenableFuture<MediaBrowserCompat.MediaItem>` and `ListenableFuture<List<MediaBrowserCompat.MediaItem>>`, and the result will be sent out when `ListenableFuture` the `MediaBrowserCompat.MediaItem` (or the list of it) is fulfilled.
* Add `artworkData` to the tests in `MediaBrowserCompatWithMediaLibraryServiceTest`.

PiperOrigin-RevId: 489205547
2022-11-22 09:53:40 +00:00
michaelkatz
6e73fc545d Filter bogus AndroidX core jar file when creating javadoc
#minor-release

PiperOrigin-RevId: 489202167
2022-11-22 09:52:27 +00:00
kimvde
8a4f72b959 Make sure the AudioProcessors do not receive AP.EMPTY_BUFFER
PiperOrigin-RevId: 489174645
2022-11-22 09:51:22 +00:00
kimvde
f658fe79b1 Make sure Muxer is always accessed from playback thread
This thread will become the Transformer internal thread.

PiperOrigin-RevId: 489168435
2022-11-22 09:50:13 +00:00