9408 Commits

Author SHA1 Message Date
tonihei
2bfced9bbc Add support for most setters in SimpleBasePlayer
This adds the forwarding logic for most setters in SimpleExoPlayer
in the same style as the existing logic for setPlayWhenReady.

This change doesn't implement the setters for modifying media items,
seeking and releasing yet as they require additional handling that
goes beyond the repeated implementation pattern in this change.

PiperOrigin-RevId: 492124399
(cherry picked from commit e598a17b3628e1179fa4219ca3212407fb3fdeb1)
2023-01-25 17:39:48 +00:00
tonihei
8ec46cd4dc Add media type to MediaMetadata
This helps to denote what type of content or folder the metadata
describes.

PiperOrigin-RevId: 492123690
(cherry picked from commit 1ac72de551a07d37c3b80d96028463244407a5b4)
2023-01-25 17:39:48 +00:00
rohks
8246587b00 Parse and set bitrates in Ac3Reader
PiperOrigin-RevId: 492003800
(cherry picked from commit 5f73984823b943d750f41519d431ad3b12dada65)
2023-01-25 17:39:48 +00:00
tonihei
2921cb76c5 Rename SimpleBasePlayer.PlaylistItem to MediaItemData
This better matches the terminology we use elsewhere in the Player
interface, where items inside the playlist are referred to as
"media item" and only the entire list is called "playlist".

PiperOrigin-RevId: 491882849
(cherry picked from commit 6c467590d0fdc27dd5afeefe479c3d4414483de5)
2023-01-25 17:39:48 +00:00
christosts
d7923785a7 Use audio bitrate to calculate AudioTrack min buffer in passthrough
Use the bitrate of the audio format (when available) in
DefaultAudioSink.AudioTrackBufferSizeProvider.getBufferSizeInBytes() to
calculate accurate buffer sizes for direct (passthrough) playbacks.

#minor-release

PiperOrigin-RevId: 491628530
(cherry picked from commit e219ac21ae604f182769d69f6f590191a92100d0)
2023-01-25 17:39:48 +00:00
tonihei
b6477ddddd Add configuration to support OPUS offload
To support OPUS offload, we need to provide a few configuration values
that are currently not set due to the lack of devices supporting
OPUS offload.

PiperOrigin-RevId: 491613716
(cherry picked from commit 4cf877b81428021c4eb2dfa1a743178f280aceb5)
2023-01-25 17:39:48 +00:00
Rohit Singh
44d12a5070 Merge pull request #10776 from dongvanhung:feature/add_support_clear_download_manager_helpers
PiperOrigin-RevId: 491336828
(cherry picked from commit 3a7f940f41e278cde88c29201191229ed7d39e49)
2023-01-25 17:39:48 +00:00
ibaker
70a55ef7e9 Remove impossible UnsupportedEncodingException from Id3Decoder
The list of charsets is already hard-coded, and using `Charset` types
ensures they will all be present at run-time, hence we will never
encounter an 'unsupported' charset.

PiperOrigin-RevId: 491324466
(cherry picked from commit 043546a03475356764cf8b754bd0fff87a0c6e1a)
2023-01-25 17:39:48 +00:00
ibaker
50e686ea58 Split up Id3DecoderTest methods
It's clearer if each test method follows the Arrange/Act/Assert pattern

PiperOrigin-RevId: 491299379
(cherry picked from commit bf77290fbe78aa25698c1a7082b2a18cd7f1b06c)
2023-01-25 17:39:48 +00:00
Rohit Singh
cbc2547043 Merge pull request #10799 from OxygenCobalt:id3v2-multi-value
PiperOrigin-RevId: 491289028
(cherry picked from commit c827e46c3db2691b1b5fed57fa5b67890331aa85)
2023-01-25 17:39:48 +00:00
ibaker
a68ab5f334 Clean up javadoc on Metadata.Entry.populateMediaMetadata
Remove self-links, and remove section that is documenting internal
ordering behaviour of
[`SimpleBasePlayer.getCombinedMediaMetadata`](bb270c62cf/library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java (L1770))
rather than anything specifically about this method.

#minor-release

PiperOrigin-RevId: 490923719
(cherry picked from commit ed8c196e2eb36eefef9952d255cb6355807b9e9f)
2023-01-25 17:39:47 +00:00
tonihei
0fb501ed6d Remove flakiness from DefaultAnalyticsCollectorTest
Our FakeClock generally makes sure that playback tests are fully
deterministic. However, this fails if the test uses blocking waits
with clock.onThreadBlocked and where relevant Handlers are created
without using the clock.

To fix the flakiness, we can make the following adjustments:
 - Use TestExoPlayerBuilder instead of legacy ExoPlayerTestRunner
   to avoid onThreadBlocked calls. This also makes the tests more
   readable.
 - Use clock to create Handler for FakeVideoRenderer and
   FakeAudioRenderer. Ideally, this should be passed through
   RenderersFactory, but it's too disruptive given this is a
   public API.
 - Use clock for MediaSourceList and MediaPeriodQueue update
   handler.

PiperOrigin-RevId: 490907495
(cherry picked from commit 7d62943bcd149eecce77cb44e4f867128ca374d3)
2023-01-25 17:39:47 +00:00
rohks
7e733aa2df Convert bitrates to bps before setting it
Format expects the values of `averageBitrate` and `peakBitrate` in bps and the value fetched from AC3SpecificBox and EC3SpecificBox is in kbps.

PiperOrigin-RevId: 490756581
(cherry picked from commit 67955e0ce331481bcb3fd94c9ffb9632f27eae6e)
2023-01-25 17:39:47 +00:00
rohks
062f0e3dcb Use ParsableBitArray instead of ParsableByteArray
To avoid complicated bit shifting and masking. Also makes the code more readable.

PiperOrigin-RevId: 490749482
(cherry picked from commit 89e4b8d049507efeb610f437429f25cf18df8f8b)
2023-01-25 17:39:47 +00:00
rohks
b4a88d63b7 Rollback of ea3552c1a0
*** Original commit ***

Rollback of 01eddb34f5

*** Original commit ***

Parse and set `peakBitrate` for Dolby TrueHD(AC-3) and (E-)AC-3

#minor-release

***

***

PiperOrigin-RevId: 490707234
(cherry picked from commit 8c91a31ced401ce14911fbfdf58dda3c7ee8e643)
2023-01-25 17:39:47 +00:00
rohks
2910117ec1 Rollback of 01eddb34f5
*** Original commit ***

Parse and set `peakBitrate` for Dolby TrueHD(AC-3) and (E-)AC-3

#minor-release

***

PiperOrigin-RevId: 490570517
(cherry picked from commit ea3552c1a030d8b14c0cd0093f7eaa6242f969eb)
2023-01-25 17:39:47 +00:00
rohks
35a900a6e6 Parse and set peakBitrate for Dolby TrueHD(AC-3) and (E-)AC-3
#minor-release

PiperOrigin-RevId: 490527831
(cherry picked from commit 01eddb34f555903c576c79b02a7b34a53e0272cb)
2023-01-25 17:39:47 +00:00
bachinger
20e54a829d Exclude tracks from PlayerInfo if not changed
This change includes a change in the `IMediaController.aidl` file and needs
to provide backwards compatibility for when a client connects that is of an older or
newer version of the current service implementation.

This CL proposes to create a new AIDL method `onPlayerInfoChangedWithExtensions`
that is easier to extend in the future because it does use an `Bundle` rather than
primitives. A `Bundle` can be changed in a backward/forwards compatible way
in case we need further changes.

The compatibility handling is provided in `MediaSessionStub` and `MediaControllerStub`. The approach is not based on specific AIDL/Binder features but implemented fully in application code.

Issue: androidx/media#102
#minor-release
PiperOrigin-RevId: 490483068
(cherry picked from commit f262e9132b32ad89f65853086f30389925b61422)
2023-01-25 17:39:47 +00:00
Ian Baker
989e2f71d3 Merge pull request #10786 from TiVo:p-aacutil-test-impl
PiperOrigin-RevId: 490465182
(cherry picked from commit 8a9a66c288d5ee2749a29de133e598f326e518dd)
2023-01-25 17:39:47 +00:00
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