15498 Commits

Author SHA1 Message Date
ibaker
62d6c303c1 Reformat demo build.gradle file
PiperOrigin-RevId: 487539107
2022-11-14 17:46:14 +00:00
kimvde
c9fe52bf67 Fix bug where streamOffsetUs is passed instead of streamPositionUs
Also make order of streamStartPositionUs and streamOffsetUs consistent

PiperOrigin-RevId: 487511633
2022-11-10 15:01:18 +00:00
tonihei
33bea391d4 Ensure listener invocations use final state variable.
The MediaControllerImplBase listener invocations currently use the
class member state that can change if one of the listener method
implementations changes the state recursively.

Updating the listener invocations to use a final local variable
ensures all listeners get consistent updates.

PiperOrigin-RevId: 487503373
2022-11-10 15:00:07 +00:00
tonihei
c6a0ba25f9 Split test methods more clearly in arrange, act, assert.
The tests in MediaControllerCompatCallbackWithMediaSessionTest
don't follow this pattern very consistently at the moment.

PiperOrigin-RevId: 487501913
2022-11-10 14:59:07 +00:00
tonihei
c5e071e556 Align PlaybackStateCompat states with logic in MediaSessionConnector
Creating the PlaybackStateCompat from a media3 Player state is done
already by the MediaSessionConnector (and used widely). The media3
session module should set the same states under the same circumstances
to ensure compatiblity and consistency.

PlaybackStateCompat changes made in media3 session:
 - Use STATE_STOPPED when player is ended instead of STATE_PAUSED
 - Use STATE_PLAYING when playback is suppressed temporarily.
 - Set the playback speed to 0 if the player is not playing.
 - Add extras for mediaId and user-set playback speed.

Part of the problem was that Player.isPlaying() was used to check
the state. Unfortunately, MockPlayer.isPlaying() is implemented in
a way that makes it hard to test these changes, because the value
is set independently of playbackState, playWhenReady and suppression
reason. To be able to write consistent, logical tests, this change
also removes the independent setting of isPlaying in MockPlayer to
align it better with a real player. This requires to update some
other tests to use alternative methods.

PiperOrigin-RevId: 487500859
2022-11-10 14:58:06 +00:00
ibaker
4f04a284ed Add missing IntDef on MediaSource.Factory.getSupportedTypes overrides
Without this the annotation isn't shown in javadoc (same in Dackka)

No annotation:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.html#getSupportedTypes()

Annotation present:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/source/MediaSource.Factory.html#getSupportedTypes()

#minor-release

PiperOrigin-RevId: 487498450
2022-11-10 14:56:54 +00:00
ibaker
a402955125 Configure Dackka to generate javadoc for protected methods
#minor-release

PiperOrigin-RevId: 487497923
2022-11-10 14:55:55 +00:00
ibaker
4fcc019bbf Fix parameter name mismatch in MappingTrackSelector.selectTracks
It's not clear to me why presubmit didn't catch this, I briefly
investigated but couldn't work it out - so I'm just going to fix
it and move on.

#minor-release

PiperOrigin-RevId: 487497827
2022-11-10 14:54:06 +00:00
tonihei
b24161a6f6 Avoid notifying connection twice from MediaControllerImplLegacy.
The connection to a legacy MediaSession may receive additional
onSessionReady callbacks that are treated as additional state updates.
We currently also set the "notifyConnected" flag for these updates
even though we are connected already, causing an IllegalStateException.

Fix the exception by not setting this flag.

We can also remove the wording about "locked" updates since this class
operates everything on a single application thread.

Issue: androidx/media#49
PiperOrigin-RevId: 487487286
2022-11-10 14:52:55 +00:00
kimvde
07f0589ce7 Remove dependency on muxer from ExoPlayerAssetLoader
PiperOrigin-RevId: 487487259
2022-11-10 14:51:53 +00:00
christosts
40c6c43197 Set targetSdkVersion of main demo app to 29
#minor-release

PiperOrigin-RevId: 487479366
2022-11-10 14:50:41 +00:00
kimvde
1d888d20dc Add TransformerInternal
The player is still driving the transformation at this point. The
transformer thread will be added in another CL.

PiperOrigin-RevId: 487479148
2022-11-10 14:49:40 +00:00
ibaker
742da7f49a Fix Dackka parameter name error in Gav1Decoder and VpxDecoder
These aren't caught by presubmit because the classes are annotated
`@VisibleForTesting` and are therefore stripped out by Metalava. However
Metalava doesn't run when we're generating javadoc for real.

#minor-release

PiperOrigin-RevId: 487476260
2022-11-10 14:48:37 +00:00
ibaker
3ab881351e Fix Dackka/Metalava errors in test_utils module
This involves reducing the visibility of methods/constructors that
are already unusable outside the `androidx.media3.test.utils` package.

#minor-release

PiperOrigin-RevId: 487473005
2022-11-10 14:47:32 +00:00
ibaker
e9ddfa5336 Fix Dackka/Metalava errors in av1, flac, ffmpeg, midi, and opus modules
This uses `@hide` on `protected final` methods to hide them from Dackka
javadoc generation, since these methods are inaccessible to developers
anyway. These symbols will still (currently) be included in artefacts
distributed on Maven (because we don't run Metalava as part of
generating these artefacts).

In some cases I had to change the visibility/finality of methods to make
them `protected final` before adding the `@hide` annotation (but
the impact should be very low, since most of these methods were either
already unusable by app developers, or they shouldn't have been used).

#minor-release

PiperOrigin-RevId: 487472907
2022-11-10 14:44:16 +00:00
ibaker
dbfc0cc770 Fix Dackka/Metalava errors in the HLS and RTSP modules
This makes two fixes:
1. Remove `HlsSampleStreamWrapper.Callback` (package-private) from the
   list of interfaces implemented by `HlsMediaPeriod` (`public`) and
   move the implementation to a private inner class instead. This avoids
   Metalava complaining about a public class that inherits from a
   package-private type.
2. Reduce the visibility of
   `RtpPayloadFormat.isFormatSupported(MediaDescription)` from `public`
   to package-private. The `MediaDescription` type is already
   package-private, so this method was already unusable outside the
   package.

#minor-release

PiperOrigin-RevId: 487472781
2022-11-10 14:43:04 +00:00
ibaker
7905744a83 Fix Dackka/Metalava errors in the ExoPlayer module
This makes two types of fix:
1. Align parameter names on overridden methods where the superclass
   has `@param` javadoc.
2. Use `@hide` on `protected final` methods that refer to package-private
   types. This will hide these symbols from Dackka javadoc generation
   but not (currently) from the artefacts distributed on Maven. These
   methods are currently unusable outside their package anyway (e.g. by
   external developers) because of the dependency on a package-private
   type.

This also changes some HLS, SmoothStreaming, and IMA code where I've renamed
parameters of overridden methods to be consistent across the type
hierarchy.

#minor-release

PiperOrigin-RevId: 487472665
2022-11-10 14:42:00 +00:00
huangdarwin
2ff5dab003 HDR: Implement ForceInterpretHdrVideoAsSdr
Also, document that we tone map when no HDR features are explicitly set

PiperOrigin-RevId: 487310971
2022-11-10 14:41:05 +00:00
claincly
3c74e076fe Set HDR color info on FrameworkMuxer
Not setting the color info results in a missing "colr" box in the produced
container, under file/moov/trak/mdia/minf/stbl/stsd/hvc1. This means extractors
will not be able to find out the transcoded file is HDR.

In `Transformer`, this means it can't transcode this transcoded file, because
it currently relies on the container bearing HDR info to construct the
transcoding sample pipeline.

PiperOrigin-RevId: 487276712
2022-11-10 14:39:53 +00:00
tonihei
0b4ba3e3a6 Wait with PlayerInfo updates until all pending operations are done
Accepting a PlayerInfo while the MediaController is masking its state
means we are reverting all masking changes we've made earlier. This
only makes sense if the update already contains the masked operation.
If multiple operations are in flight (or are sent from the session
while they are in flight), we need to wait until all of them are
handled before accepting new updates.

In cases where a new update from the session excludes the Timeline
and the masked state is incompatible with the new update, we also
risk an exception if we accept the update too early.

PiperOrigin-RevId: 487266899
2022-11-10 14:38:56 +00:00
sheenachhabra
818bf4a20a Change UnsupportedEncodingException to IllegalArgumentException
In startTransformation method we were throwing UnsupportedEncodingException (IOException) when mediaItem with unsupported arguments is passed.
Changed this to IllegalArgumentException which seems more logical here.

PiperOrigin-RevId: 487259296
2022-11-10 14:37:52 +00:00
christosts
c403b4ce7c MediaController: Add missing event flags (2/2)
This is the follow-up commit where the onEvents callback
raised by MediaController contains the missing events, for the
case where MediaController is connected to a legacy MediaSession.

#minor-release

PiperOrigin-RevId: 487231996
2022-11-10 14:36:50 +00:00
kimvde
95f37b4df8 Add ExoPlayerAssetLoader
Just move some code around for now, to start setting up the overall
structure.

PiperOrigin-RevId: 487229329
2022-11-10 14:35:49 +00:00
Tolriq
a1c04cd473 Merge Issue: google/ExoPlayer#10762: Fix ffmpeg jni wrapper returning invalid result codes
Imported from GitHub PR Issue: google/ExoPlayer#10762

This ensure that ffmpeg error code are properly translated to values that the ExoPlayer decoder understand.
The main gain is that it allows the decoder to properly ignore more cases of invalid data and recover.
The second gain is that the other errors are now proper ExoPlayer errors and no more obscure buffer ones.

Fixes: Issue: google/ExoPlayer#10760
Merge 82ceeb77d6df71f5ffb0474db66a36fd6eb8e51a into 972e169bd85b14848dcae75e34f9e95fe87e1f4b
COPYBARA_INTEGRATE_REVIEW=go/exoghi/10762 from Tolriq:ffmpeg_error_code 82ceeb77d6df71f5ffb0474db66a36fd6eb8e51a
PiperOrigin-RevId: 487189910
2022-11-10 14:34:46 +00:00
kimvde
714e556505 Move slow mo logic to sample pipelines
This is to avoid having this logic in TransformerInternal once it is
added.

PiperOrigin-RevId: 487159941
2022-11-10 14:33:47 +00:00
bachinger
c40cee67da Set targetSdkVersion of main demo app back to 29
#minor-release

PiperOrigin-RevId: 486969194
2022-11-10 14:32:38 +00:00
kimvde
61471474c7 Move muxing inside sample pipelines
This logic is currently in the player renderers. With multi-asset, the
renderers will go into the AssetLoader, which shouldn't be responsible
for muxing.

PiperOrigin-RevId: 486860502
2022-11-08 11:37:31 +00:00
sheenachhabra
eb357654bb Move muxer initialization off application thread
Problem: We are initialising muxer as soon as we start the transformation. Now the startTransformation() method can be called from main thread, but muxer creation is an I/O operation and should be not be done on main thread.

Solution: Added lazy initialisation of muxer object. The actual transformation happens on background thread so the muxer will be initialised lazily from background thread only.

Another way was to provide an initialize() method on MuxerWrapper which will explicitly initialise muxer object but with this approach the caller need to call the initialise method before calling anything else. With current implementation the renderers are calling MuxerWrapper methods on various callbacks (Not sequentially) and also we are sharing same muxer with multiple renderers so It might become confusing for the caller on when to call the initialise() method. Also there are few methods on MuxerWrapper which dont really need muxer object. So in short it might make MuxerWrapper APIs more confusing.

Validation: Verified the transformation from demo app.
PiperOrigin-RevId: 486735787
2022-11-08 11:36:30 +00:00
huangdarwin
e510d9903f HDR: Set decoder codec profile and level if available.
This should be necessary to ensure decoders see fewer errors.

Setting this resulted in removing native_dequeueOutputBuffer errors on OMX.MTK decoders for in-app tone mapping prototyping.

PiperOrigin-RevId: 486715941
2022-11-08 11:34:35 +00:00
huangdarwin
23e724a00b HDR: Update test FileUtil to handle null ColorInfo.
PiperOrigin-RevId: 486706595
2022-11-08 11:33:27 +00:00
tonihei
ab9f0608cd Set matching folder type in Session demo app.
The folder type is useful metadata to understand programmatically
what criterion was used to create the folder.

PiperOrigin-RevId: 486653317
2022-11-08 11:32:18 +00:00
christosts
09651ed2e3 MediaControllerListenerWithMediaSessionCompatTest: clean imports
Remove static imports to Player constants to make the code more readable.

#minor-release

PiperOrigin-RevId: 486619911
2022-11-08 11:31:04 +00:00
michaelkatz
9336b95bf4 Changed MediaController to return last estimated position while paused
The method getCurrentPosition() may return a lesser position during pause than the previous retrieved value due to ipc call delay in playerInfo update. Users see track position jump backwards at pause. Fixed to return last estimated position while paused if have not received updated playerInfo. Code is deduped to point getContentPosition() to getCurrentPosition() when !isPlayingAd.

PiperOrigin-RevId: 486617341
2022-11-08 11:30:01 +00:00
Googler
45f21a2fb7 Add @SuppressWarnings to unblock T SDK for <unknown commit>
LSC: https://docs.google.com/document/d/16tpK6aXqN68PvTyvt4siM-m7f0NXi_8xEeitLDzr8xY/edit?usp=sharing

TESTED=NA
BEGIN_PUBLIC/END_PUBLIC
PiperOrigin-RevId: 486180995
2022-11-08 11:29:00 +00:00
yschimke
48aac9ba90 Disable publishing block when media3 included in another build.
From https://github.com/androidx/media/pull/127/files

PiperOrigin-RevId: 485921271
2022-11-08 11:27:48 +00:00
huangdarwin
58b32b6129 HDR Test: Add link to tested method.
PiperOrigin-RevId: 485890141
2022-11-08 11:26:45 +00:00
Googler
4271056545 Add 'Player.getVideoSurfaceSize' that returns the size of the surface
on which the video is rendered.

Design Doc: go/aaos-mu-media-dd

PiperOrigin-RevId: 485884772
2022-11-08 11:25:43 +00:00
rohks
2633f37a2f Update notification when timeline changes
Notification buttons for next/previous should change based on the new index of the currently played media item after another media item is added or removed from a playlist.

Issue: androidx/media#130
PiperOrigin-RevId: 485869144
2022-11-08 11:24:36 +00:00
ibaker
be7dd95692 Fix Dackka javadoc errors in protected methods
If there's an @param javadoc tag in a supertype then all overrides
of this method that don't also override the javadoc must use the same
parameter name.

PiperOrigin-RevId: 485857711
2022-11-08 11:23:25 +00:00
christosts
8db6b71805 Clean imports in MediaControllerImplLegacy
Remove static imports to constants and imports to intdefs, to make the
code more readable.

PiperOrigin-RevId: 485592288
2022-11-08 11:22:19 +00:00
ibaker
40b5cba3c8 Fix Dackka/Metalava errors in the effects module
Public methods may only refer to public types in their signature. This
change ensures that by switching to a public supertype everywhere.

PiperOrigin-RevId: 485568625
2022-11-08 11:21:11 +00:00
huangdarwin
91b286c4f8 Apply tone mapping workaround to Pixel Watch as well.
Not sure what BUILD.ID the fix will first be applied on though.

PiperOrigin-RevId: 485389618
2022-11-08 11:20:09 +00:00
tianyifeng
77fedd8d7d Load bitmaps for MediaMetadataCompat and handle the metadata updates.
* Add `Listener` in `MediaSession` with method `onNotificationRefreshRequired(MediaSession)`.
* Add `MediaSessionService` as the listener of the `MediaSession` when `MediaSession` is added to `MediaSessionService`
* Load bitmap when update metadata in `MediaSessionLegacyStub` and call `onNotificationRefreshRequired` when bitmap asynchronously arrives.

PiperOrigin-RevId: 485376145
2022-11-08 11:19:04 +00:00
huangdarwin
a65ff85a98 HDR: Generalize Pixel 6 workaround to TP
PiperOrigin-RevId: 485366659
2022-11-08 11:17:58 +00:00
tonihei
136b8c57d9 Enfore minCompileSdk version when depending on ExoPlayer/Media3 libs
If an app sets a compileSdkVersion that is lower than the one used to
create AARs of its dependencies, the build process may produce invalid
outputs, for example by stripping methods from the APK that are only
called when the app is running on a new API version.

To avoid this issue, we can enforce that the compileSdk of apps or
libraries depending on ExoPlayer/Media3 is at least the same as the
one we used for compilation when creating the AAR.

Issue: google/ExoPlayer#10684
PiperOrigin-RevId: 485100067
2022-11-08 11:15:37 +00:00
rohks
6ff980d43e Disable failing tests of FlacExtractorSeekTest
PiperOrigin-RevId: 485061783
2022-11-08 11:14:26 +00:00
rohks
95d81fcc3b Tighten the wording for sending a pull request.
PiperOrigin-RevId: 485036120
2022-11-08 11:13:00 +00:00
bachinger
79e67dea2c Bump appTargetSDKVersion to 33
#minor-release

PiperOrigin-RevId: 484514123
2022-10-31 11:48:57 +00:00
samrobinson
bcc2fe4007 Disable the muxer watchdog if all tracks have ended.
PiperOrigin-RevId: 484512661
2022-10-31 11:47:54 +00:00
andrewlewis
3069d8130b Upgrade dackka and fix some generation errors
#minor-release

PiperOrigin-RevId: 484483080
2022-10-31 11:46:58 +00:00