20166 Commits

Author SHA1 Message Date
kimvde
e40ce150bf Implement AudioGraph.flush()
When flushing the AudioGraph, the AudioMixer will be preserved but the
sources will be recreated. This is probably a bit less efficient but
makes the logic simpler. Indeed, if we had to keep the sources alive,
we would need to add a way to reconfigure them with a new timestamp for
seeking. We would also need to change the way sources are ended because
they are currently removed when they are ended. Also, it is acceptable
to have a small delay when seeking, which means that performance is less
critical than for playback.

PiperOrigin-RevId: 615775501
2024-03-14 07:49:07 -07:00
andrewlewis
9da878956a Add short form content demo to project
#minor-release

PiperOrigin-RevId: 615756117
2024-03-14 06:29:01 -07:00
sheenachhabra
80247bc32c Remove deprecated methods from Mp4Muxer class
PiperOrigin-RevId: 615736494
2024-03-14 04:59:02 -07:00
kimvde
3248b7962a Add clipFloatOutput parameter to AudioMixer
PiperOrigin-RevId: 615720340
2024-03-14 03:44:37 -07:00
huangdarwin
ca6031deab Update old method name.
getSupportedEncoderNamesForHdrEditing became getSupportedEncodersForHdrEditing at some point, but this comment wasn't updated before...

PiperOrigin-RevId: 615712707
2024-03-14 03:11:03 -07:00
christosts
5f6e5bcda2 Composition preview: image renderer does not forward VideoSink events
PiperOrigin-RevId: 615479550
2024-03-13 11:10:02 -07:00
sheenachhabra
668a172683 Rename MuxerWrapper.release() method
PiperOrigin-RevId: 615399319
2024-03-13 06:54:19 -07:00
sheenachhabra
644d9a3461 Remove usage of deprecated methdods from Mp4Muxer tests
PiperOrigin-RevId: 615392633
2024-03-13 06:31:00 -07:00
sheenachhabra
dfe9fba17d Remove non actionable TODOs from Mp4Muxer code
PiperOrigin-RevId: 615372415
2024-03-13 05:07:34 -07:00
ibaker
12aa637fa1 Add section comments to settings.gradle
PiperOrigin-RevId: 615005773
2024-03-12 05:38:53 -07:00
ibaker
c41213c273 Move test-session-xxx modules from core_settings to settings
This ensures these modules are only configured when directly working
on the library, rather than when depending on it locally. These modules
only contain tests, they shouldn't be depended on by any apps (and are
not published via Maven).

PiperOrigin-RevId: 615004801
2024-03-12 05:35:31 -07:00
michaelkatz
8b219b0ae6 Start playing period-enabled renderers when setting playWhenReady true
Renderers may be enabled for subsequent media items as soon as the current media item's renderer's isEnded() returns true. Currently, when a player is set to pause, it stops all renderers that are `STATE_STARTED`. When a player is set to play, it starts all renderers that are enabled. This would include renderers that were enabled early for the subsequent media item. The solution is to only start renderers that are enabled by the current playing period.

Issue: androidx/media#1017
PiperOrigin-RevId: 614734437
2024-03-11 11:31:12 -07:00
tonihei
cbed80ecf3 Always set PARAMETER_KEY_TUNNEL_PEEK when tunneling
This should already be the default, but some devices seem
to not adhere to this contract and assume the default is unset.

Issue: androidx/media#1169
PiperOrigin-RevId: 614697283
2024-03-11 09:49:09 -07:00
christosts
6f109ffa6a Composition preview: play multiple images
PiperOrigin-RevId: 614690669
2024-03-11 09:28:40 -07:00
christosts
e399ea19bb Composition preview: move audio and video components
PiperOrigin-RevId: 614673253
2024-03-11 08:29:38 -07:00
sheenachhabra
aba395ca8b Add Mp4OrientationData class
Mp4Muxer now has a single method to accept different
types of metadata.

PiperOrigin-RevId: 614646331
2024-03-11 06:45:15 -07:00
tonihei
e4a55844d0 Add device-specific opt-ins for async MediaCodecAdapter
Some devices just don't work very well with the synchronous
model, but are currently still excluded from our approximate
API 31 check. This change allows to include additional devices
or device groups by passing in the Context to the default
adapter.

It also adopts the workaround added in ebceee08c6
for Fire TV Smart devices that exhibit this issue.

PiperOrigin-RevId: 614642545
2024-03-11 06:29:46 -07:00
tonihei
410c0492cc Force external surround sound flag if requested by device
Some FireOS6 devices ask to force the external surround global
flag and ignore any signals from the HDMI connection.

This is the equivalent change of e341944d1e

PiperOrigin-RevId: 614634499
2024-03-11 05:55:43 -07:00
tonihei
0e42c8945f Automatically add icon drawables for icon constants
Having a default icon available allows apps to only specify the
icon constant without having to define an icon drawable themselves
as Media3 can fill in the icon resource for backwards compatibility.

The switch util method allows R8 to easily remove unused icons, so
having default icons won't affect APK size unless the constants are
used to set up the CommandButtons.

PiperOrigin-RevId: 614623909
2024-03-11 05:06:21 -07:00
tonihei
18cbbf3850 Reorder audio capability checks
Using the more accurate check available on later API versions
first is likely better than falling back to a fallback solution
from older API versions.

PiperOrigin-RevId: 614612628
2024-03-11 04:17:35 -07:00
tonihei
eb6f607717 Document MergingMediaSource tag contract
Issue: androidx/media#883

#minor-release

PiperOrigin-RevId: 613970048
2024-03-08 10:16:23 -08:00
tofunmi
a975c75748 SpeedChangingAudioProcessor: fix outputTime calculation
minor fix for arithmetic error in calculated added in f4c60c52b9 (speed is outputTime (change in y) divided by inputTime (change in x), this calculation is inverted in code).

Changed test to cover the case.

PiperOrigin-RevId: 613966027
2024-03-08 10:01:55 -08:00
ibaker
4bca1ac47b Add opt-in flag for the MIDI module for apps with a local dependency
PiperOrigin-RevId: 613938538
2024-03-08 08:17:02 -08:00
claincly
16ef146482 Allow playing mixed input types.
These input types include images, video without audio, and video with audio.
While playing these inputs, the video frame presentation is always synced with
audio.

PiperOrigin-RevId: 613921719
2024-03-08 07:02:51 -08:00
ibaker
f9032a5893 Add checkNotNull(uri) to DataSpec constructor
This check is already present in `DataSpec.Builder.build()` but there
are many public constructors which bypass the builder (only some of
which are deprecated), so this adds an additional check.

PiperOrigin-RevId: 613908358
2024-03-08 05:59:10 -08:00
tofunmi
f4c60c52b9 Calculate outputTime based on inputTime and audio speed change
PiperOrigin-RevId: 613894863
2024-03-08 04:47:12 -08:00
ibaker
7f5b1a98e9 Use Guava's toByteArray & fromByteArray methods where possible
Also remove intermediate object allocations in
`Util.toByteArray(int...)`.

`Util.toByteArray(InputStream)` is kept (but deprecated) because it's
been part of the library for a while and might be in use by some apps.
The others are much newer, so the chance of usages outside the library
is very low, so we just remove them directly.

PiperOrigin-RevId: 613878453
2024-03-08 03:27:29 -08:00
christosts
9f9d955f0d Preview clipped media in composition preview
PiperOrigin-RevId: 613609878
2024-03-07 09:32:11 -08:00
ibaker
5b48ef4e53 Add tests for Util.toByteArray
The implementation of these methods is changed in a follow-up CL, and
these tests help to ensure nothing breaks.

This doesn't include tests for `toByteArray(InputStream)` or
`toByteArray(int)` because these implementations are fully replaced by
Guava equivalents in a follow-up CL.

PiperOrigin-RevId: 613581845
2024-03-07 07:51:04 -08:00
ibaker
ab8b77a6d3 Use try-with-resources for input and output streams in TestUtil
Many of these streams were previously never closed.

PiperOrigin-RevId: 613580471
2024-03-07 07:47:59 -08:00
claincly
0f72126c20 Add getLastTimestampUs() method
PiperOrigin-RevId: 613579674
2024-03-07 07:44:58 -08:00
ibaker
914874566e Remove unused TestUtil.getBitmap method
PiperOrigin-RevId: 613579444
2024-03-07 07:41:14 -08:00
ibaker
0ff80d7da0 Statically import Assertions methods in FakeExoMediaDrm
PiperOrigin-RevId: 613578959
2024-03-07 07:37:50 -08:00
ibaker
a604600126 Add workarounds for NoSuchMethodError from DRM framework exceptions
Issue: androidx/media#1145

#minor-release

PiperOrigin-RevId: 613573868
2024-03-07 07:16:28 -08:00
kimvde
f02dc8e528 Implement AudioGraphInput.flush
PiperOrigin-RevId: 613563855
2024-03-07 06:33:02 -08:00
ibaker
7cffae9cd0 Apply common_library_config in test_session_current/build.gradle
This is the only `build.gradle` file that currently doesn't apply this
config, and it seems to lead to desugaring errors when apps depend on
the library locally.

PiperOrigin-RevId: 613559535
2024-03-07 06:14:25 -08:00
tofunmi
5b7774fcaf Composition: clarify javadoc to setTransmuxAudio\Video
Document that assoicated effects are ignored if these setters are set

PiperOrigin-RevId: 613518167
2024-03-07 02:58:30 -08:00
ibaker
afacf2cdb7 Set Format.frameRate for single-frame MP4 tracks
Issue: androidx/media#1051
PiperOrigin-RevId: 613516802
2024-03-07 02:53:05 -08:00
michaelkatz
638b2a3c86 Start early-enabled renderers only after advancing the playing period
Renderers may be enabled for subsequent media items as soon as the current media item's renderer's isEnded() returns true. When a renderer is being enabled and the player is 'playing', that renderer is also started. When playing a mixed playlist of images and content with audio & video, the player may skip some image items because the early-starting of the audio renderer causes a clock update.

A solution is to only start the "early-enabled" renderers at the point of media transition and add a condition on DefaultMediaClock to use the standalone clock when reading-ahead and the renderer clock source is not in a started state.

Issue: androidx/media#1017
PiperOrigin-RevId: 613231227
2024-03-06 08:50:42 -08:00
bachinger
a0a40871b5 Pass player ID to methods of LoadControl
The old methods are deprecated and are called from the new
method for backwards compatibility of custom implementations.

'DefaultLoadControl' is unchanged, but `ExoPlayerImplInternal`
already calls the new methods passing in the `PlayerId`,

PiperOrigin-RevId: 613197190
2024-03-06 06:48:02 -08:00
andrewlewis
a90a7049e8 Fix typo
PiperOrigin-RevId: 613156951
2024-03-06 03:51:11 -08:00
Googler
4d0af794df Internal changes only
Internal changes

PiperOrigin-RevId: 613155879
2024-03-06 03:44:42 -08:00
ibaker
b1b8b2e6f9 Remove some deprecated DataSpec constructors
PiperOrigin-RevId: 613137809
2024-03-06 02:26:11 -08:00
tofunmi
f8c407cfb6 TransformerInternal: pass outputformat to sampleExporter in image input
Pass firstAssetLoaderOutputFormat to videoSampleExporter for non-video use cases, so that the downstream components like the videoFrameProcessor can be set up with the right output color. Surface creation is still in the VSP so can't do this for all use cases currently.

also moves getDecoderOutputColor() to TransformerUtil, since it is used in multiple places and doesn't make sense for once to have reference to the other.

PiperOrigin-RevId: 613113958
2024-03-06 00:45:28 -08:00
andrewlewis
11b14d7594 Set profile for DV profile 10 AV1
PiperOrigin-RevId: 612918953
2024-03-05 11:53:44 -08:00
tonihei
9abe9e2a97 Refine auto-update logic of CommandButton.isEnabled
We currently update this value for controllers to match the
availability of the associated command. This however makes it
impossible to mark a button as unavailable if the command is
available. This can be refined by only setting the 'enabled'
field to false if the command is not available, not the other
way round. And we should also enable the button by default as
disabling is the unusual case not many apps will use.

In addition, this change fixes missing update logic when the
player commands changed and it adds some additional test coverage
for all these cases.

PiperOrigin-RevId: 612881016
2024-03-05 10:08:17 -08:00
tonihei
8b59888766 Add missing icon constants for repeat/shuffle off
PiperOrigin-RevId: 612858065
2024-03-05 08:56:57 -08:00
tianyifeng
5e31cd9df3 Add BasePreloadManager and DefaultPreloadManager
`BasePreloadManager` coordinates the preloading for multiple sources based on the priorities defined by their `rankingData`. Customization is possible by extending this class. Apps will implement `TargetPreloadStatusControl` to return preload manager the target preload status for a given `rankingData` of the source.

`DefaultPreloadManager` extends from the above base class and uses `PreloadMediaSource` to preload media samples of the sources into memory. It also uses an integer `rankingData` that indicates the index of an item on the UI, and the priority of the items is determined by their adjacency to the current playing item. Apps can set the index of current playing item via `DefaultPreloadManager.setCurrentPlayingIndex` when the user swiping is detected.

PiperOrigin-RevId: 612829642
2024-03-05 07:14:18 -08:00
ibaker
3a43bd7687 Fix some invalid javadoc references caught by a new JDK version
PiperOrigin-RevId: 612808322
2024-03-05 05:48:34 -08:00
Googler
e175a772db Move AudioGraph effects to configure method
Move old configure behavior to private configureMixer.
registerInput() is now required after reset().

PiperOrigin-RevId: 612795418
2024-03-05 04:46:36 -08:00