9339 Commits

Author SHA1 Message Date
ibaker
f5276323c6 Add DefaultExtractorsFactory.setTsSubtitleFormats
ExoPlayer is unable to detect the presence of subtitle tracks in some
MPEG-TS files that don't fully declare them. It's possible for a
developer to provide the list instead, but doing so is quite awkward
without this helper method. This is consistent for how
`DefaultExtractorsFactory` allows other aspects of the delegate
`Extractor` implementations to be customised.

* Issue: google/ExoPlayer#10175
* Issue: google/ExoPlayer#10505

#minor-release

PiperOrigin-RevId: 490214619
(cherry picked from commit 4853444f0dc90163c257d0e20962604510557df4)
2023-01-25 17:33:06 +00:00
michaelkatz
fbab7de15e Fixed Exoplayer imports for SimpleBasePlayerTest
PiperOrigin-RevId: 490181547
(cherry picked from commit 788f74740b2e560af255ab948a4bc64d116633ca)
2023-01-25 17:33:06 +00:00
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
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
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
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
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
704e84f62d Add @ForOverride to DecoderAudioRenderer protected methods
PiperOrigin-RevId: 487779266
(cherry picked from commit a34fdcf168a3704babdb6b7d96c60344ab89c17c)
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
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
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
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
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
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
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
rohks
721487a701 Disable failing tests of FlacExtractorSeekTest
PiperOrigin-RevId: 485061783
(cherry picked from commit 55b82ff8ae491f6bcc7f3901476d2b1571a10005)
2022-10-31 15:53:41 +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
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
claincly
053e14aaaa Add GL utility methods to get 4x4 identity and set identity
PiperOrigin-RevId: 483671580
(cherry picked from commit f5ad4e098dd71bd4f99b87350e042acab4f95746)
2022-10-25 14:47:52 +00:00
ibaker
0f5245f7b1 Use int for an unsigned byte value in Cea608Decoder
This is a no-op, but it's more 'correct' because it avoids any potential
sign mix-ups that come from storing an unsigned byte (with a
potentially set MSB) in a signed java byte variable.

PiperOrigin-RevId: 483409798
(cherry picked from commit 3d0f43a149c846670480c993e09def1a2d2eeeea)
2022-10-24 16:51:08 +00:00
samrobinson
154cd42437 Add CanIgnoreReturnValue to AudioProcessor#configure + implementations
Although it can be useful to check the output format, it's not required or needed.

For some AudioProcessor implementations, it is stated/obvious that
the output format will match the input, in which case there is no
a need to check the return value.

#cleanup

PiperOrigin-RevId: 483403679
(cherry picked from commit a7bfa12eecb42cbdd13bd7e612603a4d400ebda4)
2022-10-24 16:27:18 +00:00