17426 Commits

Author SHA1 Message Date
tonihei
5e9c9ed234 Extend command GET_CURRENT_MEDIA_ITEM to more methods.
We currently only document it for the getCurrentMediaItem(), but
the command was always meant to cover all information about the
current media item and the position therein.

To correctly hide information for controllers, we need to filter
the Timeline when bundling the PlayerInfo class if only this
command is available.

PiperOrigin-RevId: 503098124
2023-01-23 13:17:13 +00:00
kimvde
45596fcd1e Make startTransformation methods take an EditedMediaItem
Usages of the deprecated methods in Transformer.Builder will be removed
in a follow-up CL.

PiperOrigin-RevId: 502889423
2023-01-23 13:12:54 +00:00
kimvde
a043c8c204 Avoid re-encoding if video effects are no-op
This is to avoid regressions introduced by removing the convenience
methods from TransformationRequest.

PiperOrigin-RevId: 502864512
2023-01-23 13:08:38 +00:00
tonihei
50f066d634 Correctly filter PlayerInfo by available getter commands.
When bundling PlayerInfo, we need to remove information if the
controller is not allowed to access it. This was only partially
done at the moment.

PiperOrigin-RevId: 502852798
2023-01-23 13:04:16 +00:00
samrobinson
a44032c59b Add ColorInfo to TransformationResult.
TESTED: Manually verified the ColorInfo is propagated when VSP is used.
PiperOrigin-RevId: 502843773
2023-01-23 12:59:59 +00:00
samrobinson
d4ce4480ed Move AudioMixer classes from transformer.audio to transformer package.
Transformer convention has been to avoid splitting into packages unless
necessary.

See https://jlbp.dev/JLBP-2: "Prefer fewer packages over more packages
to avoid unnecessarily publicizing internal details, since any
dependency across package boundaries needs to be public.

PiperOrigin-RevId: 503463294
2023-01-23 12:36:57 +00:00
samrobinson
eda7cd2405 Rename FloatResamplingAudioProcessor to ToFloatPcmAudioProcessor.
Resampling as a term is overloaded, however it was raised as a
confusing term in a meeting recently, as the 1P team initially thought
this would change the sample rate. The naming of this `AudioProcessor`
now matches `ToInt16PcmAudioProcessor`.

PiperOrigin-RevId: 503441019
2023-01-23 12:35:47 +00:00
michaelkatz
bb11e0286e Add onSetMediaItems listener with access to start index and position
Added onSetMediaItems callback listener to allow the session to modify/set MediaItem list, starting index and position before call to Player.setMediaItem(s).

Added conditional check in MediaSessionStub.setMediaItem methods to only call player.setMediaItem rather than setMediaItems if player does not support COMMAND_CHANGE_MEDIA_ITEMS

PiperOrigin-RevId: 503427927
2023-01-23 12:34:44 +00:00
bachinger
e690802e9e Add the MediaSession as an argument to getMediaButtons()
Issue: androidx/media#216
#minor-release
PiperOrigin-RevId: 503406474
2023-01-23 12:33:37 +00:00
huangdarwin
4b4904899c HDR: Clarify media3.effect hdrStaticInfo / colorRange support.
Clarify that we always output on full range colors, and don't handle
hdrStaticInfo input yet.

PiperOrigin-RevId: 503224687
2023-01-23 12:32:31 +00:00
samrobinson
306ce6e3a1 Don't use transformationResult with timeout/unexpected exceptions.
PiperOrigin-RevId: 503187291
2023-01-23 12:31:21 +00:00
ibaker
280889bc4a Explicitly document most Player.Listener methods in terms of getters
This makes it implicitly clear that if the value of a getter changes due
to a change in command availability then the listener will be invoked,
without needing to explicitly document every command on every listener
method.

#minor-release

PiperOrigin-RevId: 503178383
2023-01-23 12:30:18 +00:00
tonihei
052c4b3c1a Add command check for metadata in DefaultMediaNotificationProvider
PiperOrigin-RevId: 503172986
2023-01-23 12:29:14 +00:00
tonihei
e961c1b5e9 Update media controller position before pausing.
We stop estimating new position when pausing until we
receive a new position from the player. However, this
means that we will continue to return a possible stale
previous position. Updating the current position before
pausing solves this issue.

PiperOrigin-RevId: 503153982
2023-01-23 12:28:09 +00:00
kimvde
2cb4e3d71e Remove usages of deprecated startTransformation
PiperOrigin-RevId: 503138745
2023-01-23 12:27:00 +00:00
tonihei
f15b752543 Extend command GET_CURRENT_MEDIA_ITEM to more methods.
We currently only document it for the getCurrentMediaItem(), but
the command was always meant to cover all information about the
current media item and the position therein.

To correctly hide information for controllers, we need to filter
the Timeline when bundling the PlayerInfo class if only this
command is available.

PiperOrigin-RevId: 503098124
2023-01-23 12:25:48 +00:00
kimvde
aa72b45cdf Make startTransformation methods take an EditedMediaItem
Usages of the deprecated methods in Transformer.Builder will be removed
in a follow-up CL.

PiperOrigin-RevId: 502889423
2023-01-23 12:24:44 +00:00
kimvde
d4db33a535 Avoid re-encoding if video effects are no-op
This is to avoid regressions introduced by removing the convenience
methods from TransformationRequest.

PiperOrigin-RevId: 502864512
2023-01-23 12:23:42 +00:00
tonihei
69cfba7c53 Correctly filter PlayerInfo by available getter commands.
When bundling PlayerInfo, we need to remove information if the
controller is not allowed to access it. This was only partially
done at the moment.

PiperOrigin-RevId: 502852798
2023-01-23 12:22:33 +00:00
samrobinson
6dc119a8ab Add ColorInfo to TransformationResult.
TESTED: Manually verified the ColorInfo is propagated when VSP is used.
PiperOrigin-RevId: 502843773
2023-01-23 12:21:20 +00:00
rohks
8fcd6bbffc Fix javadoc references to writeSampleData
PiperOrigin-RevId: 502821506
2023-01-18 13:26:52 +00:00
samrobinson
76af4270a9 Generate silent audio if no audio track is available.
To always generate silent audio, `removeAudio(true)` can be used in conjunction.

PiperOrigin-RevId: 502814315
2023-01-18 13:21:57 +00:00
kimvde
6b6e4993b9 Add EditedMediaItem class
This class will be used in a follow-up CL.

PiperOrigin-RevId: 502615323
2023-01-18 13:16:48 +00:00
tonihei
5461d5cbf1 Make availableCommands known when bundling PlayerInfo
When bundling PlayerInfo, we remove data when the controller is not
allowed to access this data via getters. We also remove data for
performance reasons. In the toBundle() method, it's currently hard to
make the connection between allowed commands and filtering, because
the values are checked at a different place. This can be made more
readable by forwarding the applicable Commands directly.

The only functional fix is to filter the Timeline when sending the
first PlayerInfo after a connecting a controller if the command to
get the Timeline is not available. This also allows us to remove a
path to filter MediaItems from Timelines as it isn't used.

PiperOrigin-RevId: 502607391
2023-01-18 13:11:49 +00:00
samrobinson
2cc64a037c Add resolution fallback for 25% of requested.
If a device only supports 1920x1080 as maximum resolution, then adding
the 25% case ensures 8k is reduced correctly.

PiperOrigin-RevId: 502588364
2023-01-18 13:06:39 +00:00
samrobinson
5da086fe01 Add a unit test to check 2/3 resolution supported.
PiperOrigin-RevId: 502573469
2023-01-18 13:01:35 +00:00
Googler
345f2345c7 Disables play/pause button when there's nothing to play
PiperOrigin-RevId: 502571320
2023-01-18 12:56:41 +00:00
kimvde
55aeb76e0c Add CompositeAssetLoader
This is an AssetLoader that wraps a sequence of AssetLoaders. It will
be used for constrained multi-asset.

This class can currently only concatenate media items with the exact
same format.

PiperOrigin-RevId: 502525796
2023-01-18 12:51:50 +00:00
rohks
6c14ffc1ec Fix javadoc references to writeSampleData
PiperOrigin-RevId: 502821506
2023-01-18 12:05:08 +00:00
samrobinson
dfa98ae791 Generate silent audio if no audio track is available.
To always generate silent audio, `removeAudio(true)` can be used in conjunction.

PiperOrigin-RevId: 502814315
2023-01-18 12:03:59 +00:00
kimvde
b0f82767aa Add EditedMediaItem class
This class will be used in a follow-up CL.

PiperOrigin-RevId: 502615323
2023-01-18 12:03:12 +00:00
tonihei
c90ca7ba5f Make availableCommands known when bundling PlayerInfo
When bundling PlayerInfo, we remove data when the controller is not
allowed to access this data via getters. We also remove data for
performance reasons. In the toBundle() method, it's currently hard to
make the connection between allowed commands and filtering, because
the values are checked at a different place. This can be made more
readable by forwarding the applicable Commands directly.

The only functional fix is to filter the Timeline when sending the
first PlayerInfo after a connecting a controller if the command to
get the Timeline is not available. This also allows us to remove a
path to filter MediaItems from Timelines as it isn't used.

PiperOrigin-RevId: 502607391
2023-01-18 12:02:09 +00:00
samrobinson
a3b0708d31 Add resolution fallback for 25% of requested.
If a device only supports 1920x1080 as maximum resolution, then adding
the 25% case ensures 8k is reduced correctly.

PiperOrigin-RevId: 502588364
2023-01-18 12:01:02 +00:00
samrobinson
d092b5261e Add a unit test to check 2/3 resolution supported.
PiperOrigin-RevId: 502573469
2023-01-18 12:00:08 +00:00
Googler
d49a16e094 Disables play/pause button when there's nothing to play
PiperOrigin-RevId: 502571320
2023-01-18 11:59:03 +00:00
christosts
39f4a17ad4 Filter what PlaybackStateCompat actions are advertised
PlayerWrapper advertises PlaybackStateCompat actions to the legacy
MediaSession based on the player's available commands.

PiperOrigin-RevId: 502559162
2023-01-18 11:58:10 +00:00
kimvde
574fea39b6 Add CompositeAssetLoader
This is an AssetLoader that wraps a sequence of AssetLoaders. It will
be used for constrained multi-asset.

This class can currently only concatenate media items with the exact
same format.

PiperOrigin-RevId: 502525796
2023-01-18 11:57:03 +00:00
Görkem Güclü
40d8f004cf Merge branch 'dev-v2' into dash-thumbnail-support
# Conflicts:
#	library/common/src/main/java/com/google/android/exoplayer2/Format.java
2023-01-17 09:47:26 +01:00
kimvde
89e14989b3 Remove setScale and setRotationDegrees from TransformationRequest
Also remove usages of TransformationRequest convenience methods
(setScale, setRotationDegrees and setResolution).

Some usages of setResolution can't be removed yet because they are used
for fallback.

PiperOrigin-RevId: 502415748
2023-01-17 03:38:19 +00:00
sheenachhabra
2656284e63 Align muxer code with media3 coding conventions.
This CL includes following changes:
1. Remove GCA related terms/links from java docs and comments.
2. Make class final where ever possible.
3. Append /* package */ for default classes.
4. Change java docs to recommended format.
5. Replace term "packet" with "sample" to avoid confusion.
6. Correct TODO format.
7. Delete MediaFormatUtil.java from muxer module and add its methods into MediaFormatUtil.java in common module.

Note: The java doc on various boxes has the limited description which was already present. In future I am planning to add proper small description for each box (from MP4 spec).

Not included in this CL:
1. Order of element correction as it will show lot of changes and might create confusion with other minor changes.
2. Correction in test cases (Only some renaming).

PiperOrigin-RevId: 502414139
2023-01-17 03:34:21 +00:00
kimvde
a4f9f9487b Add the possility to shift frame timestamps in SampleConsumer
This is needed for constrained multi-asset to shift the timestamps of
the media items that are not the first in the sequence.

PiperOrigin-RevId: 502409923
2023-01-17 03:30:32 +00:00
bachinger
26e1a28176 Clarify what default settings are being used for SSAI AdsLoader
PiperOrigin-RevId: 502388865
2023-01-17 03:26:30 +00:00
huangdarwin
e28d434c9e Effect: Automatically save bitmaps in pixel test.
Also, omit the "actual" label from output files, as this boilerplate isn't necessary
(it doesn't disambiguate between any other saved filename like "expected").

PiperOrigin-RevId: 502378188
2023-01-17 03:22:36 +00:00
huangdarwin
9789b39c78 HDR: Use human-readable values for ColorInfo.toString().
This should make debugging much easier as values will be more human-readable.
Before this CL, one needed to reference MediaFormatUtil to check the
colorSpace/colorTransfer/colorRange values and make sure values were as
expected.

PiperOrigin-RevId: 502367147
2023-01-17 03:18:35 +00:00
huangdarwin
27d44e86fe Effect: Create GlEffectsFrameProcessorTestRunner.
Makes GlEffectsFrameProcessorPixelTest slightly more modular in preparation for
copying this into transformer/mh.

Refactoring change. No functional change intended.

PiperOrigin-RevId: 501902223
2023-01-17 03:14:24 +00:00
samrobinson
eb49666049 Move SonicAudioProcessor to media3.common module.
PiperOrigin-RevId: 501881646
2023-01-17 03:10:32 +00:00
claincly
42aecce353 Add a frame cache
Frame cache compensates for the fluctuation in frame processing times.

Imagine a frame takes 10ms to process, and the interval between two frames is
33ms. The third frame took 40ms to process.

If we don't have frame cache:
- Process frame 1, ready after 10ms, starts playback, now t=0 ms
- Start processing frame 2, ready at t=10ms,
- Release frame 2 at t=33ms
- We start processing the third frame at t=33ms
- The third frame is due presentation at t=66ms
- But frame 3 is available at t=73ms, late

If we have a frame cache of say 3 frams,
- Process frame 1, ready after 10ms, starts playback, now t=0 ms
- Start processing frame 2, ready at t=10ms
- Start processing frame 3, ready at t=50ms
- Release frame 2 at t=33ms
- Start frame 4, ready at t=60ms
- Frame 3 is due presentation at t=66ms
- Frame 3 isn't late

PiperOrigin-RevId: 501869948
2023-01-17 03:06:36 +00:00
claincly
c86d70a98b Allow forcing duration in FrameworkMuxer.
PiperOrigin-RevId: 501865706
2023-01-17 03:02:43 +00:00
claincly
07fe60710c Fix not able to set a null output surface.
Previously, after calling MCVR.setOutput() with null, `frameProcessorManager`'s output surface is cleared. What was unexpected is `ExoPlayerInternal` notifies a zero output resolution after clearing the output surface. This zero resolution causes FrameProcessor to fail.

PiperOrigin-RevId: 501861993
2023-01-17 02:58:45 +00:00
huangdarwin
e773031927 Effect: Move BitmapTestUtil to common test util class.
Move BitmapTestUtil from media3.effect to media3.test.utils.

This allows this class to be accessed from both transformer and effect tests.

Refactoring change. No functional change intended.

PiperOrigin-RevId: 501837130
2023-01-17 02:54:54 +00:00