2356 Commits

Author SHA1 Message Date
tofunmi
9622411b50 Add support for ultra HDR overlays
PiperOrigin-RevId: 637863706
2024-05-28 05:28:03 -07:00
ibaker
c87b7d86cc Remove deprecated format changed methods
Use the overloads with an additional `@Nullable DecoderReuseEvaluation`
parameter instead.

PiperOrigin-RevId: 637851937
2024-05-28 04:31:14 -07:00
Copybara-Service
67b799c714 Merge pull request #1389 from DolbyLaboratories:dlb/dovi-profile10/dev
PiperOrigin-RevId: 637827802
2024-05-28 02:39:42 -07:00
ibaker
763a5f0272 Remove deprecated DrmSessionManager.DUMMY and getter method
Use `DRM_UNSUPPORTED` constant instead.

PiperOrigin-RevId: 636937592
2024-05-24 09:07:35 -07:00
ibaker
7fd8a06e08 Remove deprecated MediaCodecInfo.isSeamlessAdaptationSupported(...)
Use `MediaCodecInfo.canReuseCodec(...)` instead.

PiperOrigin-RevId: 636918479
2024-05-24 07:59:45 -07:00
ibaker
2ab1c75ca7 Remove deprecated DashMediaSource.DEFAULT_LIVE_PRESENTATION_DELAY_MS
Use `DashMediaSource.DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS` instead.

PiperOrigin-RevId: 636906922
2024-05-24 07:11:39 -07:00
ibaker
0f1f6bfa41 Remove deprecated DefaultHttpDataSource constructors
Use `DefaultHttpDataSource.Factory` instead.

PiperOrigin-RevId: 636875524
2024-05-24 05:03:05 -07:00
ibaker
4a16212fb3 Remove deprecated Timeline.Window.isLive field
PiperOrigin-RevId: 636870982
2024-05-24 04:37:04 -07:00
tofunmi
db6144e7dd Maintain a consistent luminance range across HDR content in effects
PQ and HLG have different luminance ranges (max 10k nits and max 1k nits resp). In GL, colors work in a normalised 0 to 1 scale, so for PQ content, 1=10k nits and and for HLG content, 1=1k nits.

This cl scales and normalises PQ content appropriately so that all HDR content works in the HLG luminance range. This fixes two things

1. Conversions between HLG and PQ are "fixed" (before the output colors looked too bright or too dark depending on which way you are converting)
2. color-altering effects will be able to work consistently across HLG and PQ content

1 is tested in this cl. 2 will be tested when ultra HDR overlays are implemented, both cases have been manually tested to ensure the output looks correct on a screen.

PiperOrigin-RevId: 636851701
2024-05-24 03:05:34 -07:00
ibaker
cfd29e04f3 Remove PlayerMessage.setHandler(Handler)
Use `setLooper(Looper)` instead.

PiperOrigin-RevId: 636840566
2024-05-24 02:13:43 -07:00
Copybara-Service
0a58832d85 Merge pull request #1315 from datdoantelus:ClosedCaption_708Decoder_bugfix
PiperOrigin-RevId: 636591170
2024-05-23 10:18:02 -07:00
ibaker
e150e0d39f Remove OkHttpDataSource constructors & OkHttDataSourceFactory
Use `OkHttpDataSource.Factory` instead.

PiperOrigin-RevId: 636585523
2024-05-23 10:03:12 -07:00
ibaker
4986fdd1a6 Remove deprecated setContentTypePredicate() methods
Use the suggested alternative on the respective
`XXXDataSource.Factory` instead.

PiperOrigin-RevId: 636560182
2024-05-23 08:32:26 -07:00
Ian Baker
e87b820626 Add release note 2024-05-23 15:27:25 +01:00
tonihei
9ccc4b27ef Add test and formatting changes 2024-05-22 15:08:52 +01:00
ibaker
5b3066f380 MP3: Derive duration and bitrate from frame count in Info header
`Info` header is used for CBR files, but in some cases not **every**
frame in these files is the same size. This change stops using the
single frame after the `Info` frame as the 'template' (and assuming all
subsequent frames are the same size/bitrate), and instead derives the
bitrate from fields in the `Info` header. This works for files which are
'almost' constant bitrate, like the one in Issue: androidx/media#1376 where every
frame is either 1044 or 1045 bytes except the one immediately after the
`Info` frame which is 104 bytes (32kbps), resulting in a wildly
incorrect duration calculation.

PiperOrigin-RevId: 636151605
2024-05-22 06:59:10 -07:00
Copybara-Service
d175223cc6 Merge pull request #1339 from colinkho:set-play-when-ready-load-control-branch
PiperOrigin-RevId: 636095759
2024-05-22 02:57:15 -07:00
ibaker
e2847b3b80 Re-apply CEA-708 rowLock/columnLock fix
This change was originally made in 6f8249184b

It was then accidentally lost in when `Cea708Parser` was merged back
into `Cea708Decoder` in 51b4fa2cc8.

This is the only change made to the actual 'decoding' logic in
`Cea708Parser` between it being split from `Cea708Decoder` and merged
back in again, all the other changes in this period relate to the
implementation of the `SubtitleParser` interface, so don't need to be
preserved in `Cea708Decoder`:
51b4fa2cc8/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea708Parser.java

`Cea608Parser` was also merged back into `Cea608Decoder` in
25498b151b
and so is vulnerable to the same risk of accidental loss of changes. To
be sure, I also checked the history of this file:
25498b151b/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea608Parser.java

The only 'decoding logic' change there is 379cb3ba54,
which was also lost in 25498b151b.
I will send a separate change to resolve this.

PiperOrigin-RevId: 635796696
2024-05-21 07:16:04 -07:00
ibaker
c26042d7ca Fix issue links from google/ExoPlayer to androidx/media
PiperOrigin-RevId: 635469173
2024-05-20 08:53:42 -07:00
tonihei
c46bb24264 Move parameters inside LoadControl and use it for shouldStartPlayback
+additional formatting and Javadoc changes
2024-05-20 15:53:07 +01:00
tonihei
b645004902 Keep manifest in DashMediaSource after release
This is a fix for the fix in 319854d624. The original fix did
not reset the firstPeriodId to avoid any id clashes with future
updates. This however only works under the assumption that the
next manifest load at the next call to prepare() is exactly the
same as the current manifest. This is not true unless the call
happens very quickly (and may fail even then). Instead we should
keep the existing manifest directly as a reference so we can use
it to find the number of removed periods when we get a new manifest
at the next call to prepare().

Issue: androidx/media#1329
PiperOrigin-RevId: 634853524
2024-05-17 12:24:52 -07:00
tonihei
dd7fb8178a Handle timeline updates where all periods in window have been replaced
This case is most likely to happen when re-preparing a multi-period
live stream after an error. The live timeline can easily move on to
new periods in the meantime, creating this type of update.

The behavior before this change has two bugs:
 - The player resolves the new start position to a subsequent period
   that existed in the old timeline, or ends playback if that cannot
   be found. The more useful behavior is to restart playback in the
   same live item if it still exists.
-  MaskingMediaSource creates a pending MaskingMediaPeriod using the
   old timeline and then attempts to create the real period from the
   updated source. This fails because MediaSource.createPeriod is
   called with a periodUid that does no longer exist at this point.
   We already have logic to not override the start position and need
   to extend this to also not prepare the real source.

Issue: androidx/media#1329
PiperOrigin-RevId: 634833030
2024-05-17 11:16:12 -07:00
dancho
b9ec24a269 Fix AV sync for sequences with audio track shorter than video
For each item, AudioGraphInput now pads the input audio track with silence
to the duration given in onMediaItemChanged.

Possibly resolves Issue: androidx/media#921 .

PiperOrigin-RevId: 634753721
2024-05-17 06:54:39 -07:00
kimvde
7b2a1b4443 Fix image not ignored for non-images in setImageDurationMs
PiperOrigin-RevId: 634345071
2024-05-16 05:48:41 -07:00
Ian Baker
743e7942b6 Format with google-java-format and add release note 2024-05-16 10:04:49 +01:00
ibaker
0352db9a37 Default to parse subtitles while extracting, instead of while rendering
To override this change, and go back to parsing during rendering,
apps must make two method calls:

1. `MediaSource.Factory.experimentalParseSubtitlesDuringExtraction(false)`
2. `TextRenderer.experimentalSetLegacyDecodingEnabled(true)`

PiperOrigin-RevId: 634262798
2024-05-16 01:42:56 -07:00
tofunmi
7b357337d2 Support AVIF in exoplayer
https://developer.android.com/media/platform/supported-formats#image-formats was updated to include AVIF support in API 34+, so <unknown commit> updated our associated Util's to reflect this. After that change, ExoPlayer's BitmapFactoryImageDecoder will be able to decode AVIF, but the player won't be able to detect or extract it. Add this support for completeness, so that ExoPlayer can continue to say it supports all formats in https://developer.android.com/media/platform/supported-formats#image-formats.

PiperOrigin-RevId: 633956245
2024-05-15 08:04:41 -07:00
tonihei
d27c36ac9e Use MaskingMediaSource for AdsMediaSource content source
This means the content source is 'prepared' instantly with a
placeholder, enabling all further preparation steps (e.g. loading
preroll ads) while the actual content is still preparing. This
improvement can speed up the start time for prerolls in  manifest-based
content that doesn't have a zero-time preparation step like progressive
media.

Issue: androidx/media#1358
PiperOrigin-RevId: 633640746
2024-05-14 11:02:00 -07:00
tofunmi
f7390faeb0 Update supported image formats in line with platform standards
This treats heic as a separate mimetype to heif (even though heic files are a subset of heif files). This is in line with other platform classes like android.content.ContentResolver

https://developer.android.com/media/platform/supported-formats#image-formats was updated to include avif support or API level 34, so added this MimeType as well and updated our associated util.

solves Issue: androidx/media#1373

PiperOrigin-RevId: 633616214
2024-05-14 09:50:38 -07:00
bachinger
84c0b6bcb1 Add MediaSession.sendError to send non-fatal error data to controllers
This allows to set custom error message for instance on Android
Auto/Automotive OS.

Issue: androidx/media#543
PiperOrigin-RevId: 633610089
2024-05-14 09:30:18 -07:00
tonihei
2175c432d7 Add error code for codec reclaim
This allows apps to better detect when the platform
reclaims a codec. This requires adding the error code
to MediaCodecDecoderException.

PiperOrigin-RevId: 633588914
2024-05-14 08:12:51 -07:00
tonihei
1a5cf6718b Use BaseAudioProcessor format tracking in SilenceSkippingAudioProcessor
The class currently tracks the input format itself, updating it too
early in onConfigure() instead of onFlush(). This causes issues when
the format changes and the new values are applied to the silence
skipping logic of the old format. The fix is to use the base class
input format handling instead.

Issue: androidx/media#1352
PiperOrigin-RevId: 633232368
2024-05-13 09:17:28 -07:00
sheenachhabra
3a3145521b Replace Transformer.Muxer interface with Muxer.Muxer
PiperOrigin-RevId: 633193701
2024-05-13 06:54:19 -07:00
tianyifeng
0db23ae904 Add PreloadMediaSource.clear to discard the preloading period
PiperOrigin-RevId: 633167081
2024-05-13 04:47:58 -07:00
tonihei
daa8750382 Ensure silence skipping doesn't interfere with other discontinuities
The same doSomeWork iteration that triggers the silence skipping
discontinuity may already have another discontinuities (like
AUTO_TRANSITION), which should take precedence over the silence
skipping.

PiperOrigin-RevId: 632432851
2024-05-10 02:51:58 -07:00
ibaker
861e8218c0 Bump IMA dependency to 3.33.0 to fix NPE with data:// URIs
Issue: androidx/media#700
PiperOrigin-RevId: 632135478
2024-05-09 06:59:53 -07:00
tianyifeng
1a5f57e9eb Complete preloading when the period has loaded to the end of the source
When the period has loaded to the end of the source, the `period.getBufferedPositionUs` will be set to `C.TIME_END_OF_SOURCE`, which is a negative value. Thus, the original `continueLoadingPredicate` will never turn to `false`, as the `bufferedPositionUs` is definitely less than the target preload position that is expected to be positive.

In this change, we added `PreloadMediaSource.PreloadControl.onLoadedToTheEndOfSource(PreloadMediaSource)` to indicate that the source has loaded to the end. This allows the `DefaultPreloadManager` and the custom `PreloadMediaSource.PreloadControl` implementations to preload the next source or take other actions.

This bug was not revealed by the the `DefaultPreloadManagerTest` because the related tests were all using the `FakeMediaSource` and only setting the preload target to `STAGE_TIMELINE_REFRESHED`. Thus, the tests for testing the `invalidate()` behaviors were modified to use the real progressive media whenever possible, unless we have to use `FakeMediaSource` to squeeze a chance to do more operations between the preloading of sources to test some special scenarios.

PiperOrigin-RevId: 631776442
2024-05-08 06:16:44 -07:00
michaelkatz
ab64ca809a Reset tracker for offload track completion prior to stopping AudioTrack
For offloaded playback, reset the tracking field for stream completion in `DefaultAudioSink` prior to calling `AudioTrack.stop()` so that `AudioTrack.StreamEventCallback#onPresentationEnded` correctly identifies when all pending data has been played.

#minor-release

PiperOrigin-RevId: 631744805
2024-05-08 04:02:26 -07:00
Copybara-Service
c5964d197c Merge pull request #1055 from AradiPatrik:z-order-fix
PiperOrigin-RevId: 631616905
2024-05-07 18:45:09 -07:00
tonihei
6ac60c6dff Disable enhanced Java 8 desugaring
This avoids that apps have to depend on this additional config

Issue: androidx/media#1312
PiperOrigin-RevId: 631447767
2024-05-07 09:26:36 -07:00
microkatz
6363017e88 Fix DTS:X Profile 2 encoding attributes for passthrough playback 2024-05-07 12:05:37 +00:00
michaelkatz
75733e294e Fix GitHub ref url typo in 'non-square Dash Thumbnail' release note
PiperOrigin-RevId: 631368681
2024-05-07 04:02:40 -07:00
bachinger
2c912aa697 Handle displayTitle and title in legacy conversions
When converting `MediaMetadata` to the legacy `MediaDescriptionCompat`
the selection and order of properties to use has been aligned with the
behavior of media1. This selection is relevant for users that use a
platform or legacy controller or browser. Before and up to the current
API version 34, this includes System UI, Android Auto/Automotive and
AVRCP (Bluetooth).

PiperOrigin-RevId: 630999535
2024-05-06 04:21:19 -07:00
tofunmi
cb4b2ea55c remove degammaing: change setSdrWorkingColorSpace default
The second stage of the changes remove the conversion to linear colors in the SDR effects pipeline by default.

also resolves Issue: androidx/media#1050

PiperOrigin-RevId: 630108296
2024-05-02 10:35:48 -07:00
tonihei
7cf2fd9486 Postpone AdTagLoader listener deregistration to receive final error
When the AdTagLoader is deactivated because of a player error, the
error callback is already pending on the app's main thread, but not
yet executed. This means the VideoAdPlayerCallback instances
registered in AdTagLoader won't receive this error event if the
Player.Listener is immediately removed from AdTagLoader.

This can be fixed by postponing the deregistration until after
already pending messages have been handled. As this means other
callbacks can be triggered now with player==null, this check needs
to be added to other callbacks to avoid handling stale events.

Issue: androidx/media#1334
PiperOrigin-RevId: 630068222
2024-05-02 08:19:04 -07:00
microkatz
690bb1ace3 Add release note for DASH non-square thumbnail grid fix 2024-05-01 16:26:58 +00:00
rohks
feb512544a Fix issue with updating the last rebuffer time
The last rebuffer time was being updated erroneously, even in the absence of rebuffering events, resulting in incorrect `bs` (buffer starvation) key in CMCD.

Issue: androidx/media#1124
PiperOrigin-RevId: 629731796
2024-05-01 08:35:02 -07:00
tonihei
1af86d4c4d Fix issue where subtitles starting before a seek position are skipped
These subtitles were skipped because they are marked as shouldBeSkipped
based on their timestamps. The fix removes this flag entirely in
SimpleSubtitleDecoder because TextRenderer handles potential skipping
if needed.

PiperOrigin-RevId: 629717970
2024-05-01 07:34:40 -07:00
Copybara-Service
6e8f3a8f97 Merge pull request #1189 from v-novaltd:dsparano-exo245
PiperOrigin-RevId: 629476777
2024-04-30 11:31:53 -07:00
tonihei
703b9368c3 Add ExoPlayer.setPriority
This lets apps update the task manager priority and send the
priority message to all renderers so that they can adjust their
resources if needed.

PiperOrigin-RevId: 629426058
2024-04-30 08:49:16 -07:00