14935 Commits

Author SHA1 Message Date
Googler
c11b5cf91c Fix NPE when listener is not set
PiperOrigin-RevId: 488970696
(cherry picked from commit f3ed9e359dfdff2a99bf8766ffceb59a93d1bc93)
2023-01-25 17:37:31 +00:00
bachinger
73d40e1cfc Add bundling exclusions with unit tests
The exclusion will be used in a follow-up CL when sending PlayerInfo updates.

#minor-release

PiperOrigin-RevId: 488939258
(cherry picked from commit bae509009bd62554876ecb7485708e50af4eaa2a)
2023-01-25 17:37:31 +00:00
tianyifeng
bbf7324494 Update targetSdkVersion of demo session app to appTargetSdkVersion
PiperOrigin-RevId: 488884403
(cherry picked from commit cfe36af8478e78dd6e334298bcee425c61a9ba2a)
2023-01-25 17:37:31 +00:00
michaelkatz
537f8b2665 Changed decoder list sort to order by functional support of format
Added new method to check if codec just functionally supports a format.
Changed getDecoderInfosSortedByFormatSupport to use new function to
order by functional support. This allows decoders that only support
functionally and are more preferred by the MediaCodecSelector to keep
their preferred position in the sorted list.

Unit tests included
-Two MediaCodecVideoRenderer tests that verify hw vs sw does not have an
effect on sort of the decoder list, it is only based on functional
support.

Issue: google/ExoPlayer#10604
PiperOrigin-RevId: 487779284
(cherry picked from commit fab66d972ef84599cdaa2b498b91f21d104fbf26)
2023-01-25 17:35:11 +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
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
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
bachinger
4adfb5f50f Add pending sequence before sending the remote session task
#minor-release

PiperOrigin-RevId: 488885069
(cherry picked from commit e1eb8b6dd89fac48d62e80e95c0e959815720b35)
2022-11-17 10:06:29 +00:00
tonihei
8cc37db8e5 Rename getVideoSurfaceSize to getSurfaceSize
This better matches the callback name (onSurfaceSizeChanged) and
probably cause less confusion with getVideoSize.

PiperOrigin-RevId: 488669786
(cherry picked from commit 1143edc59ac96ec8524e8203d9445dbb0f006630)
2022-11-17 10:06:29 +00:00
christosts
c22c2bf0c0 Set valid channel masks for 8 and 12 channels on all Android versions
Util.getAudioTrackChannelConfig() maps a channel count to a
channel mask that is passed to AudioTrack. The method expected that
playback of 8-channel audio is possible from Android 5.1 and playback of
12-channel audio is only possible from Android 12L. However, there is no
restriction on the upper number of channels that can be passed to the
AudioTrack. google/ExoPlayer#10701 is an example where the audio decoder
outputs 12 channels on an Android 10.

This change removes the restrictions for 8 and 12 channels. Note, we still
do not support playback of arbitrary number of channels as it would require
further changes to DefaultAudioSink.

#minor-release

Issue: google/ExoPlayer#10701
PiperOrigin-RevId: 488659831
(cherry picked from commit 491b13622e79f5c2ef84771b1a29e40f47aca653)
2022-11-17 10:06:29 +00:00
tonihei
dab5b3c152 Mark iterationFinished when triggering release event.
When we currently trigger the iteration finished event during the
release, we don't mark the event as triggered. This means that
someone can trigger another release from within the callback,
which then tries to resend the event.

Issue: google/ExoPlayer#10758

PiperOrigin-RevId: 488645089
(cherry picked from commit 1def68bf3c00035aad0821d3997187317ce099dc)
2022-11-17 10:06:25 +00:00
tonihei
bf67d1cc11 Calculate SSAI window duration for live periods with unset duration.
We currently skip this calculation entirely, but it can be added by
calculating the window duration using the wrapped window's duration
and the provided AdPlaybackState.

Issue: google/ExoPlayer#10764
PiperOrigin-RevId: 488614767
(cherry picked from commit 7a7d08343af13a969744df2a70eb67adae3254b8)
2022-11-17 10:04:35 +00:00
ibaker
e4ff4a3b04 Reformat demo build.gradle file
PiperOrigin-RevId: 488376715
(cherry picked from commit adc993dc5713b92f40ada6683bfa0a532bfb75ed)
2022-11-17 10:04:35 +00:00
ibaker
50112671c0 Add @ForOverride to DecoderAudioRenderer protected methods
PiperOrigin-RevId: 487779266
(cherry picked from commit 9d6d30d81ddb7b34e8a54a7fa0f0f6a98655817a)
2022-11-17 10:04:35 +00:00
ibaker
dafbbf25e6 Reformat demo build.gradle file
PiperOrigin-RevId: 487539107
(cherry picked from commit 62d6c303c1a9fd56e27ffc7ad7cc39f92f957bd7)
2022-11-17 10:04:35 +00:00
tonihei
4296a8af88 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
(cherry picked from commit 33bea391d42cb5669e6d2c97c0553f3c0c63467b)
2022-11-17 10:04:25 +00:00
tonihei
7f17ff6d00 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
(cherry picked from commit 33bea391d42cb5669e6d2c97c0553f3c0c63467b)
2022-11-10 12:56:11 +00:00
tonihei
a9eb121169 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
(cherry picked from commit c6a0ba25f996b77adf6bf0dd9921f429d5950437)
2022-11-10 12:47:12 +00:00
tonihei
58d670d941 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
(cherry picked from commit c5e071e556931331cc780fda5177d556d51ff3da)
2022-11-10 12:40:37 +00:00
ibaker
e05e319d3b 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
(cherry picked from commit 4f04a284ed888768b14388daf8530c47df704994)
2022-11-10 12:24:56 +00:00
ibaker
d0d6cbd583 Configure Dackka to generate javadoc for protected methods
#minor-release

PiperOrigin-RevId: 487497923
(cherry picked from commit a402955125b1df3943ff2f7c0bcbf963bb1c8a20)
2022-11-10 12:21:47 +00:00
ibaker
2826a55355 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
(cherry picked from commit 4fcc019bbf1981703cb302cc796b3a9a6845ea89)
2022-11-10 12:21:14 +00:00
tonihei
824cbf405c 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
(cherry picked from commit b24161a6f6af184840d9eae7a63276b73a4a4d80)
2022-11-10 11:10:11 +00:00
christosts
afb0f12fa4 Set targetSdkVersion of main demo app to 29
#minor-release

PiperOrigin-RevId: 487479366
(cherry picked from commit 40c6c431972cf5e378d46fef0d68fabce7e26caf)
2022-11-10 10:33:41 +00:00
ibaker
cfbcf2c86c 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
(cherry picked from commit 742da7f49a5b0cebc2fe6927e820666c8372f0b6)
2022-11-10 10:19:01 +00:00
ibaker
ba0466b198 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
(cherry picked from commit 3ab881351e04bcf921f946c8e74e4a0cf5989768)
2022-11-10 10:00:48 +00:00
ibaker
65d923c08e 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
(cherry picked from commit e9ddfa5336efe007c272c6e65f60c67029b0eddb)
2022-11-10 10:00:14 +00:00
ibaker
937c463972 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
(cherry picked from commit dbfc0cc7706d56a7d1ca86401cae6683ab9d9991)
2022-11-10 09:59:35 +00:00
ibaker
c2c9febd93 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
(cherry picked from commit 7905744a832a71aa9f30e8744742a6abd8468488)
2022-11-10 09:58:57 +00:00
huangdarwin
45f6c24bf2 HDR: Implement ForceInterpretHdrVideoAsSdr
Also, document that we tone map when no HDR features are explicitly set

PiperOrigin-RevId: 487310971
(cherry picked from commit 2ff5dab0039c44d767dc831fec92724254e5e0aa)
2022-11-09 20:05:24 +00:00
claincly
e57838d7f5 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
(cherry picked from commit 3c74e076fef6ef9ae892dcfda9026ae1be83c1b0)
2022-11-09 18:05:24 +00:00
tonihei
dddc6026e9 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
(cherry picked from commit 0b4ba3e3a6130253b801ddc231501168efce8901)
2022-11-09 17:29:31 +00:00
sheenachhabra
bc3aef081e 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
(cherry picked from commit 818bf4a20a4bb55d57e26b6c200c9857d4caf659)
2022-11-09 17:00:14 +00:00
christosts
707c2d894d 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
(cherry picked from commit c403b4ce7ce9a2964ff754bb394782cc36fb882d)
2022-11-09 14:58:49 +00:00
kimvde
c89ceb878d Add ExoPlayerAssetLoader
Just move some code around for now, to start setting up the overall
structure.

PiperOrigin-RevId: 487229329
(cherry picked from commit 95f37b4df8475e5eaf09da0a5d4dee04a81646a0)
2022-11-09 14:45:12 +00:00
Tolriq
d262f76047 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

(cherry picked from commit a1c04cd47330bc4104b0b8dea1aa977f35bb9ed9)
2022-11-09 10:53:52 +00:00
kimvde
5976955241 Move slow mo logic to sample pipelines
This is to avoid having this logic in TransformerInternal once it is
added.

PiperOrigin-RevId: 487159941
(cherry picked from commit 714e5565053ad48ec23b1f1640851a1e784a6726)
2022-11-09 08:25:53 +00:00
bachinger
54d724cf26 Set targetSdkVersion of main demo app back to 29
#minor-release

PiperOrigin-RevId: 486969194
(cherry picked from commit c40cee67da2723849add8444bd67fc5e2a3a61e2)
2022-11-08 17:13:56 +00:00
kimvde
9dfa32fe84 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
(cherry picked from commit 61471474c7441d60a5d452d9acd8a1a2a1c88ca6)
2022-11-08 07:25:42 +00:00
sheenachhabra
64c87a5fa1 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
(cherry picked from commit eb357654bbd11f6304a6f5495bb209e59307dfcb)
2022-11-07 20:38:44 +00:00
huangdarwin
a42050f441 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
(cherry picked from commit e510d9903ff30c4ec308bdcfba114e8889aad20c)
2022-11-07 19:21:21 +00:00
huangdarwin
b770eb86b2 HDR: Update test FileUtil to handle null ColorInfo.
PiperOrigin-RevId: 486706595
(cherry picked from commit 23e724a00be4e286505a9a4bed8f291787b579a6)
2022-11-07 18:49:14 +00:00
tonihei
13a4089eaf 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
(cherry picked from commit ab9f0608cd3d779b71623e4fa8ff2df149affb64)
2022-11-07 15:16:16 +00:00
christosts
3bad1f326d MediaControllerListenerWithMediaSessionCompatTest: clean imports
Remove static imports to Player constants to make the code more readable.

#minor-release

PiperOrigin-RevId: 486619911
(cherry picked from commit 09651ed2e3134b87ea832ba05f7bdd2d11289bd6)
2022-11-07 11:55:08 +00:00
michaelkatz
8270dd4536 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
(cherry picked from commit 9336b95bf4355c4b1e43f95879d9af45cf90cd19)
2022-11-07 11:36:36 +00:00
Googler
57e3e0ce8e 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

(cherry picked from commit 45f21a2fb748dff2d2819d368293ea1f47c64b5e)
2022-11-04 17:57:11 +00:00
yschimke
1c18eae18e Disable publishing block when media3 included in another build.
From https://github.com/androidx/media/pull/127/files

PiperOrigin-RevId: 485921271
(cherry picked from commit 48aac9ba90344d960214c2d0364a68c0d74e109e)
2022-11-03 18:08:03 +00:00