14893 Commits

Author SHA1 Message Date
michaelkatz
dda5f9526f Fixed missing imports for Metadata and AdPlaybackState for Exoplayer
PiperOrigin-RevId: 490012573
(cherry picked from commit 1551bea3983196272d1a8e836103a77fd9090568)
2023-01-25 17:33:06 +00:00
ibaker
87b1c30d75 Add set -eu to all shell scripts
These flags ensure that any errors cause the script to exit (instead of
just carrying on) (`-e`) and that any unrecognised substitution variables
cause an error instead of silently resolving to an empty string (`-u`).

Issues like Issue: google/ExoPlayer#10791 should be more quickly resolved with
`set -e` because the script will clearly fail with an error like
`make: command not found` which would give the user a clear pointer
towards the cause of the problem.

#minor-release

PiperOrigin-RevId: 490001419
(cherry picked from commit f83441974411dca5673a34548b11bc6e6cb809ff)
2023-01-25 17:33:06 +00:00
tonihei
f1a9a6b549 Add remaining state and getters to SimpleBasePlayer
This adds the full Builders and State representation needed to
implement all Player getter methods and listener invocations.

PiperOrigin-RevId: 489503319
(cherry picked from commit b81cd08271cd94f244ca5d7c995cd29523057a60)
2023-01-25 17:33:06 +00:00
christosts
fcf5452f19 Pass correct frame size for passthrough playback
When estimating the AudioTrack min buffer size, we must use a PCM
frame of 1 when doing direct playback (passthrough). The code was
passing -1 (C.LENGTH_UNSET).

PiperOrigin-RevId: 489238392
(cherry picked from commit d9d716869b7df2cd95704e9ac24a5f9a376afa2c)
2023-01-25 17:33:06 +00:00
tonihei
be2bdbd05b Add additional codecs to the eosPropagationWorkaround list.
Issue: google/ExoPlayer#10756
PiperOrigin-RevId: 489236336
(cherry picked from commit cbcdbfe021d9ffb453ed0e67a9ca1ea5f8691f51)
2023-01-25 17:33:06 +00:00
ibaker
d99a66774f Throw exception if a released player is passed to TestPlayerRunHelper
I considered moving this enforcement inside the ExoPlayerImpl
implementation, but it might lead to app crashes in cases that apps
(incorrectly) call a released player, but it wasn't actually causing a
problem.

PiperOrigin-RevId: 489233917
(cherry picked from commit d4c9199a6175a6c89f7a3d3900af1b9dfcb075f0)
2023-01-25 17:33:06 +00:00
tonihei
0d11d55111 Mark broadcast receivers as not exported
They are called from the system only and don't need to be exported
to be visible to other apps.

PiperOrigin-RevId: 489210264
(cherry picked from commit c1fd03df7403019143f503bbe208d73cabc11243)
2023-01-25 17:33:05 +00:00
Googler
e42c65bc3e Add setPlaybackLooper ExoPlayer builder method
The method allows clients to specify a pre-existing thread
to use for playback. This can be used to run multiple ExoPlayer
instances on the same playback thread.

PiperOrigin-RevId: 488980749
(cherry picked from commit 79b809b5563260cd20541afe607e36ae351fbbed)
2023-01-25 17:33:05 +00:00
Googler
e2e7c43ca0 Fix NPE when listener is not set
PiperOrigin-RevId: 488970696
(cherry picked from commit f52bb274b8b54df2404ab485c7d277150005b679)
2023-01-25 17:33:05 +00:00
michaelkatz
97d7ed7dce 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.

UnitTests 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 1eb8a6b36ed98bd66a5bad5273526a918511a39f)
2023-01-25 17:33:05 +00:00
bachinger
3a654c1f54 Update migration script
Issue: google/ExoPlayer#10854
PiperOrigin-RevId: 496922055
(cherry picked from commit 8e9f83867b5c9536488cf74f06c4cf2535ef848f)
2023-01-05 16:51:24 +00:00
ibaker
0c74758f0e Remove two media3-only release notes from the ExoPlayer release notes
Issue: google/ExoPlayer#10811
PiperOrigin-RevId: 490726544
(cherry picked from commit bb270c62cf2f7a1570fe22f87bb348a2d5e94dcf)
2022-11-24 17:35:07 +00:00
Michael Katz
a9444c8802
Merge pull request #10806 from google/release-v2-r2.18.2
r2.18.2
2022-11-23 11:38:07 +00:00
christosts
a114b0e01f Fix compilation error in ffmpeg JNI layer
PiperOrigin-RevId: 490263003
(cherry picked from commit 202e03fc64dac568955ce00684368cbea9b244f7)
2022-11-23 09:51:59 +00:00
tonihei
9b0790e418 Reorder some release notes in other sections.
#minor-release

PiperOrigin-RevId: 490224795
(cherry picked from commit e567594cf7640bd96ec13d071c4523f7898b55be)
2022-11-22 15:04:38 +00:00
michaelkatz
aef5330960 Update JavaDoc for exoplayer:2.18.2
#minor-release

PiperOrigin-RevId: 490202192
(cherry picked from commit 6f1cf6dab4dd7e37e5d2ea15ad0cc34eafba601c)
2022-11-22 12:44:28 +00:00
michaelkatz
66995dbdfc Version bump to exoplayer:2.18.2 and media3:1.0.0-beta03
#minor-release

PiperOrigin-RevId: 489959918
(cherry picked from commit ca190c084bd9ef8c281fac7655344d48f265042c)
2022-11-22 11:04:51 +00:00
ibaker
bd6570f6c7 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 058cba95d40db83c77f4dd0aa8cb561221463b3a)
2022-11-22 11:04:51 +00:00
michaelkatz
f4259f3633 Filter bogus AndroidX core jar file when creating javadoc
#minor-release

PiperOrigin-RevId: 489202167
(cherry picked from commit 7e82d4ec44b88a54ac022acf1cccdcd383457e1a)
2022-11-22 11:04:51 +00:00
tonihei
6108c053ce 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 8438daca1f8cbea24aa414ee500044baf1a28367)
2022-11-17 10:03:11 +00:00
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