15023 Commits

Author SHA1 Message Date
christosts
db2ab52f4f 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 1b24e6fd14774d5c8b3e7b8084b30204581d13ce)
2022-11-17 10:03:11 +00:00
tonihei
88804ddf41 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

#minor-release

PiperOrigin-RevId: 488645089
(cherry picked from commit 3e5103a3e55e2dc545b4a2442beaa49f307ecfdc)
2022-11-17 10:03:11 +00:00
tonihei
5def6e497d 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 20151b9930f1b54d7894ec41465a2e85df92462d)
2022-11-17 10:03:11 +00:00
ibaker
54d3dbf014 Reformat demo build.gradle file
PiperOrigin-RevId: 488376715
(cherry picked from commit 30b73c85c53cce0d21e8df21ee680406aa0ad1d7)
2022-11-17 10:03:11 +00:00
ibaker
704e84f62d Add @ForOverride to DecoderAudioRenderer protected methods
PiperOrigin-RevId: 487779266
(cherry picked from commit a34fdcf168a3704babdb6b7d96c60344ab89c17c)
2022-11-17 10:03:11 +00:00
ibaker
dd49f2455f Reformat demo build.gradle file
PiperOrigin-RevId: 487539107
(cherry picked from commit 0383b723b7c26da107a719a16a05da459ae971ee)
2022-11-17 10:03:11 +00:00
ibaker
d97604138e 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 4949fbe5edc9dbbf1a713b152907cc3a175956d5)
2022-11-10 12:24:56 +00:00
ibaker
23518e2b62 Configure Dackka to generate javadoc for protected methods
#minor-release

PiperOrigin-RevId: 487497923
(cherry picked from commit 7cb2e1130326a3a802b439185210004268d96b31)
2022-11-10 12:21:47 +00:00
ibaker
ab501dd096 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 13ee34faccaf98ff90850601f40c95622b1e878b)
2022-11-10 12:21:14 +00:00
christosts
386e2aff3a Set targetSdkVersion of main demo app to 29
#minor-release

PiperOrigin-RevId: 487479366
(cherry picked from commit 09bee98b8f94a608fc994f96f2f538458a96b8d9)
2022-11-10 10:33:41 +00:00
ibaker
77c8875be6 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 14e23d34e17afa076cd912264bb60685961c58e3)
2022-11-10 10:19:01 +00:00
ibaker
7f706c8a0a 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 ca8de0e49b03339b03a6e048e7e7a27df86e5ff5)
2022-11-10 10:00:48 +00:00
ibaker
925e733010 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 1cd488ac9a1e838139495f55aa32eb951f1e8d8f)
2022-11-10 10:00:14 +00:00
ibaker
2540dee1bd 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 9041d7b979f3b998758d74279f5d281088d879a8)
2022-11-10 09:59:35 +00:00
ibaker
01f30f0b96 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 10c4a4dfc172cfac77528c7cb746fe827ca6f78c)
2022-11-10 09:58:57 +00:00
huangdarwin
39d9aef04d HDR: Implement ForceInterpretHdrVideoAsSdr
Also, document that we tone map when no HDR features are explicitly set

PiperOrigin-RevId: 487310971
(cherry picked from commit 8bdd2784d330c0c9f493f092825d08f8a5cc4305)
2022-11-09 20:05:24 +00:00
claincly
98c981f6f2 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 d6c8e3a8aff07be5c184473826753047bf4b2387)
2022-11-09 18:05:24 +00:00
sheenachhabra
70f74fde15 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 4598cc92485c149f5c613d3c926ae4493a457668)
2022-11-09 17:00:14 +00:00
kimvde
1ffe6a73da Add ExoPlayerAssetLoader
Just move some code around for now, to start setting up the overall
structure.

PiperOrigin-RevId: 487229329
(cherry picked from commit 5d1cab0cf50e31e5886310dd55e6de7c4b3523ba)
2022-11-09 14:45:12 +00:00
Tolriq
95d9e4926d 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 6d2e7a1b5760a05eade18b1a028b3d27f714715c)
2022-11-09 10:53:52 +00:00
kimvde
881838ba52 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 b59fdf5e98bf5ec3cd0800edb5fb2e6ebd9da5c3)
2022-11-09 08:25:53 +00:00
bachinger
f5acc9e783 Set targetSdkVersion of main demo app back to 29
#minor-release

PiperOrigin-RevId: 486969194
(cherry picked from commit 21724665283a29133f5d77f5321bcdf182e6aafd)
2022-11-08 17:13:56 +00:00
kimvde
f3f2f93720 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 d8754b6642d0a99e2705f3e21ff8b83d50472bbd)
2022-11-08 07:25:42 +00:00
sheenachhabra
194a32c0fb 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 b10b4e6d4694c7240073b81c3a09227042b58c21)
2022-11-07 20:38:44 +00:00
huangdarwin
096981920f 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 0b7e5bbad287053d56720ad682c1a5015eedb9cf)
2022-11-07 19:21:21 +00:00
huangdarwin
9ad5650876 HDR: Update test FileUtil to handle null ColorInfo.
PiperOrigin-RevId: 486706595
(cherry picked from commit 0b53c934d8f391000c72a0a9d6ced9c2bdb77a95)
2022-11-07 18:49:14 +00:00
Googler
fe47393618 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 88445d213a3ebfd30b32994dbdacc9488923041e)
2022-11-04 17:57:11 +00:00
yschimke
cc9823d96b 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 36a51ac9163fdea5e85e1308a7acd0b945918992)
2022-11-03 18:08:03 +00:00
huangdarwin
b949b6b5f3 HDR Test: Add link to tested method.
PiperOrigin-RevId: 485890141
(cherry picked from commit bd4e58d68bd219154e3d90b0a1031236f8608e96)
2022-11-03 16:13:17 +00:00
Googler
dadf2812ec 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-03 15:50:19 +00:00
ibaker
b25e1e2f24 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
(cherry picked from commit b8e5d708fc77a06e831abd7f2c2e57f68bb3720f)
2022-11-03 13:35:39 +00:00
ibaker
10d06dd12f 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
(cherry picked from commit 3fdfe585ffe927c90f412b892101dbe01119b8df)
2022-11-02 12:21:56 +00:00
huangdarwin
e48fe57cc7 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
(cherry picked from commit 2ddd645a3484aed4b9e519f99f4ab1bc989b6a0e)
2022-11-01 19:36:40 +00:00
tianyifeng
61b1cfc05d 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
(cherry picked from commit 624238c6b6e621deed585cb19b63f117ae3f7e76)
2022-11-01 18:43:26 +00:00
huangdarwin
69112df555 HDR: Generalize Pixel 6 workaround to TP
PiperOrigin-RevId: 485366659
(cherry picked from commit 6de5d9336db68cab7ffa886869fe882af6299223)
2022-11-01 18:09:01 +00:00
michaelkatz
7bfc6457fb Removed move transformation for exoplayer2 audio package-info.java
dda17db261 creation of audio/package-info.java introduced a copybara conflict with the exoplayer2/audio/package-info.java move transformation in copy.bara.sky. Solution was to remove original package-info-common-audio.java and the move transformation as dda17db261 now covers it.

Tested with a copybara push to exoplayer github

PiperOrigin-RevId: 485329674
(cherry picked from commit 972e169bd85b14848dcae75e34f9e95fe87e1f4b)
2022-11-01 15:53:03 +00:00
tonihei
e4d77f7a7c 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
(cherry picked from commit 23d39caea0bee0143705191fd97ac7f0cf9a76f9)
2022-10-31 18:13:59 +00:00
rohks
721487a701 Disable failing tests of FlacExtractorSeekTest
PiperOrigin-RevId: 485061783
(cherry picked from commit 55b82ff8ae491f6bcc7f3901476d2b1571a10005)
2022-10-31 15:53:41 +00:00
rohks
375978babd Tighten the wording for sending a pull request.
PiperOrigin-RevId: 485036120
(cherry picked from commit 8030a492ff676fa32dc25fe48829c9a066529cd5)
2022-10-31 13:55:24 +00:00
bachinger
86ac8f539d Bump appTargetSDKVersion to 33
#minor-release

PiperOrigin-RevId: 484514123
(cherry picked from commit 1bbe7c11f8ad7dfbbf3fe30796414bd196f0df5a)
2022-10-28 13:22:07 +00:00
samrobinson
a3de075b3d Disable the muxer watchdog if all tracks have ended.
PiperOrigin-RevId: 484512661
(cherry picked from commit 2390322a00a9e71f16dfe28088ae7cd3e462129f)
2022-10-28 13:13:05 +00:00
andrewlewis
c02d477cc2 Upgrade dackka and fix some generation errors
#minor-release

PiperOrigin-RevId: 484483080
(cherry picked from commit fc1eca10f4934fd92c84db222815fc1e77ddd5f6)
2022-10-28 10:03:56 +00:00
kimvde
d652020229 Add test for muxer watchdog timer
PiperOrigin-RevId: 484298261
(cherry picked from commit 42057cc9f8f81e24c64c629d2e11e7102afd0f30)
2022-10-27 18:01:11 +00:00
bachinger
f06e8ee736 Make adding ad live breaks more robust
This change makes adding ad events in live streams more robust by allowing ad
groups to grow in number of ads if more ad events are received than initially
announced by the SDK.

With the IMA prefetch feature, an AdPod can grow in size in certain conditions
like from initially 2 ads to 4 ads being part of the ad group. With this change,
if an additional ad event arrives while the ad group is still being played,
the ad group is expanded. If the event arrives late and the ad group is already
completed, a new group is created for the remaining ads.

This also covers the case where we join the live stream while an ad is being
played and we missed at least one LOADED event from the SDK. Ads of the group
before the first LOADED event are ignored in such a case.

PiperOrigin-RevId: 484214760
(cherry picked from commit 136addf640e451602163be9e4272d1e27b8ed5b8)
2022-10-27 11:10:10 +00:00
kimvde
94f3b1bf53 Add muxer timer to detect when generating an output sample is too slow
This allows to throw when the Transformer is stuck or is too slow.

PiperOrigin-RevId: 484179037
(cherry picked from commit 376ee77f52bed47de54c6478b4006f1b25a543d0)
2022-10-27 07:58:56 +00:00
samrobinson
861cd9a00e Add AudioProcessor.AudioFormat equals method.
PiperOrigin-RevId: 483983486
(cherry picked from commit c9585d0154980c576710d035be51eb472fbd6665)
2022-10-26 16:02:24 +00:00
Googler
81b3e4040d Mute input video player in transformer demo
PiperOrigin-RevId: 483969411
(cherry picked from commit 8181b3c6a1aba32459d4a5975cc708cbf224b397)
2022-10-26 15:01:30 +00:00
ibaker
6b3bec8618 Fix Cea608Decoder handling of service switch commands in field 2
From ANSI-CTA-608-E R-2014 section 8.4:
> When closed captioning is used on line 21, field 2, it shall conform
> to all of the applicable specifications and recommended practices as
> defined for field 1 services with the following differences:
> 1. The non-printing character of the miscellaneous control-character
>    pairs that fall in the range of 0x14, 0x20 to 0x14, 0x2F in field 1,
>    shall be replaced with 0x15, 0x20 to 0x15, 0x2F when used in field
>    2.
> 2. The non-printing character of the miscellaneous control-character
>    pairs that fall in the range of 0x1C, 0x20 to 0x1C, 0x2F in field
>    1, shall be replaced with 0x1D, 0x20 to 0x1D, 0x2F when used in
>    field 2.

This basically means that `cc1=0x15` in field 2 should be interpreted as
`cc1=0x14` in field 1, and same for `0x1D -> 0x1C`.

The `isMiscCode`  method above already handles this by ignoring the LSB
(the only difference between `0x14` and `0x15`, and `0x1C` and `0x1D`)
by AND-ing with `0xF6` instead of `0xF7`. This change uses the same
trick in `isServiceSwitchCommand`.

Issue: google/ExoPlayer#10666
#minor-release
PiperOrigin-RevId: 483927506
(cherry picked from commit 7c6d492ff19b6aead4cc6f1f9a426145fc1faa0d)
2022-10-26 11:09:04 +00:00
samrobinson
fe9bad1119 Move DefaultAudioSink.AudioProcessorChain to AudioProcessorChain
Split inner interface into separate file, which will go in common
module. The old interface will be deprecated and extends the new.

#cleanup

PiperOrigin-RevId: 483732226
(cherry picked from commit ad52b68c738e8321b966b904d3cd2139f7a560ef)
2022-10-25 18:31:22 +00:00
samrobinson
8debe79333 Move AudioProcessor to common.
PiperOrigin-RevId: 483699606
(cherry picked from commit dda17db261758f7211ffa793ee9cc6fea842addb)
2022-10-25 16:40:38 +00:00