21692 Commits

Author SHA1 Message Date
ivanbuper
7e7764de5e Implement getExpectedFrameCountAfterProcessorApplied() in Sonic
This method allows `Sonic` to statically and accurately report the
expected number of output frames for any given parameter configuration.

This change is required prework for `SpeedChangingAudioProcessor` to
implement a similar static method and allow precise, non-blocking
timestamp adjustments for the experimental speed changing effect.

PiperOrigin-RevId: 690669627
2024-10-28 10:43:03 -07:00
shahddaghash
772bd20f7d Remove deprecated Transformer.Listener methods
Methods were deprecated between Media3 1.0.0 and Media3 1.1.0.

PiperOrigin-RevId: 690656410
2024-10-28 10:09:20 -07:00
dancho
4601a42aee Use PSNR for comparing equality in one HDR10 test
Also, fix incorrectly stretched golden file that was not detected with previous, less sensitive, average pixel error comparison.

PiperOrigin-RevId: 690643520
2024-10-28 09:38:34 -07:00
dancho
e67660f326 Consistently use highp for HDR colors
GLSL 3.00 mediump doesn't require enough precision near zero
to correctly represent PQ colors where the [0, 1] GL range
represents [0, 10_000] nits.
This caused `noEffects_hlg10InputAndHdr10Output_matchesGoldenFile`
to fail on some devices.

PiperOrigin-RevId: 690627069
2024-10-28 08:50:19 -07:00
dancho
fe14525a97 Use ExoPlayer in DecodeOneFrameUtil
The old code that uses MediaCodec directly has a race condition
that causes the decoder to incorrectly crop the decoded picture.

PiperOrigin-RevId: 690620868
2024-10-28 08:32:23 -07:00
shahddaghash
9e088ac2b8 Remove 7 deprecated Transformer.Builder methods
PiperOrigin-RevId: 690617093
2024-10-28 08:19:41 -07:00
dancho
5bb9e1a932 UltraHDR Ovelays: remove texture unit clash
Do not use the same texture unit for two different textures.
This was causing tests to fail on multiple devices.

PiperOrigin-RevId: 690610094
2024-10-28 07:59:09 -07:00
ivanbuper
9653fa64fe Move calculateAccumulatedTruncationErrorForResampling() to Sonic
This is prework for `Sonic` to provide a precise calculation of output
sample counts, and thus allow `SpeedChangingAudioProcessor` to replace
`getSpeedAdjustedTimeAsync()` with an accurate synchronous calculation.

This is a non functional change.

PiperOrigin-RevId: 690608520
2024-10-28 07:53:44 -07:00
rohks
a913a16db4 Add ignore exclusions for IAMF and MPEG-H decoder extensions
PiperOrigin-RevId: 690537114
2024-10-28 03:12:51 -07:00
rohks
84ab67cca3 Fix .gitignore paths for extensions
#cherrypick

PiperOrigin-RevId: 690534708
2024-10-28 03:03:42 -07:00
ibaker
39c734963f H264Reader: Add missing propagation of max_num_reorder_frames
This method is already called below in the
`else if (sps.isCompleted())` block which applies when
`hasOutputFormat == true`, but this is only ever entered if we are
parsing SPS and PPS NAL units **after** we've emitted a format, which
is only the case if
`DefaultTsPayloadReaderFactory.FLAG_DETECT_ACCESS_UNITS` is set (which
it isn't by default).

The equivalent call in `H265Reader` is already inside the
`if (!hasOutputFormat)` block, so doesn't need a similar fix.

#cherrypick

PiperOrigin-RevId: 689809529
2024-10-25 09:13:53 -07:00
tonihei
a15571c8ee Add logic to convert button preferences to custom layout in sessions
This ensures that media button preferences with slots for BACK,
FORWARD and OVERFLOW are converted to the legacy custom layout
according to the implicit placement rules. This has to happen
when populating the MediaSessionCompat and when generating the
notification for older APIs. Sending these preferences to older
Media3 controllers can filter them down to the custom layout the
session would have used previously, but there is no need to adjust
the reservation extras because the older Media3 custom layout has
no concept of these extras.

PiperOrigin-RevId: 689761637
2024-10-25 06:09:21 -07:00
tonihei
8811b454bb Use slots to fill in default compact view indices
This is equivalent to the current logic, but also allows to easily pick
up other buttons that use the BACK, CENTRAL or FORWARD slots for the
compact view by default.

Also fix the test to actually assert the output order.

PiperOrigin-RevId: 689747844
2024-10-25 05:12:07 -07:00
tonihei
0fdc930444 Use media button preferences in session demo app
PiperOrigin-RevId: 689738802
2024-10-25 04:34:21 -07:00
tonihei
aeb9d12a16 Add logic to convert custom layout to button preferences in controller
This ensures that the slots are set according to the implicit placement
rules for the legacy custom layouts. This has to be done when receiving
custom actions from a MediaControllerCompat and for Media3 sessions
setting the custom layout field.

PiperOrigin-RevId: 689737951
2024-10-25 04:29:05 -07:00
Copybara-Service
d051b4b993 Merge pull request #1768 from colinkho:onloadstarted-retry
PiperOrigin-RevId: 689728139
2024-10-25 03:51:35 -07:00
rohks
e25bc2c1a5 Populate track duration(s) in Avi, Flac and Wav extractors
PiperOrigin-RevId: 689716977
2024-10-25 03:03:08 -07:00
Ian Baker
683a5b8403 Fix review comments 2024-10-25 10:58:48 +01:00
Ian Baker
7d3e6b0f27 Add release note 2024-10-25 10:58:29 +01:00
Ian Baker
37f795ea82 Try removing duplicate calls 2024-10-25 10:58:29 +01:00
Ian Baker
7cf500bc2d Fix compilation of MergingMediaSourceTest 2024-10-25 10:58:29 +01:00
Ian Baker
473a4a7680 Call both old and new onLoadStarted methods in DefaultAnalyticsCollector 2024-10-25 10:58:29 +01:00
Ian Baker
d3298391b2 Fix onLoadStarted event accumulation in DefaultAnalyticsCollectorTest 2024-10-25 10:58:29 +01:00
Ian Baker
b565f47d18 Reformat with google-java-format 2024-10-25 10:58:29 +01:00
Ian Baker
e7f5d4d441 Remove backwards-compat onLoadStarted from MediaSourceEventListener 2024-10-25 10:58:29 +01:00
Colin Kho
5581529bfb Use long as test constant for DefaultAnalyticsCollectorTest 2024-10-25 10:58:28 +01:00
Colin Kho
16f65cee58 Deprecate onLoadStarted w/o retry count on AnalyticsListener 2024-10-25 10:58:28 +01:00
Colin Kho
5dbe1efa9e Treat onLoadStarted with retryCount to be a new method rather than redirect calls 2024-10-25 10:58:28 +01:00
Colin Kho
8adcd35c75 Incorporate MediaSourceEventListener.onLoadStarted with retryCount parameter with backward compatibility 2024-10-25 10:58:25 +01:00
Colin Kho
2d05744333 Add DownloadExecutor to SingleSampleMediaSource 2024-10-24 11:59:35 -07:00
samrobinson
45317394da Implement constant power matrices for channel mixing to mono & stereo.
Calculations are derived from the android platform channel mixing.

PiperOrigin-RevId: 689427658
2024-10-24 10:23:07 -07:00
dancho
d2fb779929 Ignore flaky preview tests
Tests are flaky because shader program creation is slow

PiperOrigin-RevId: 689420905
2024-10-24 10:04:57 -07:00
Rohit Kumar Singh
af1b5b5102 Merge Issue: androidx/media#1826: add extension for MPEG-H decoding
Imported from GitHub PR https://github.com/androidx/media/pull/1826

Merge 6b59a1602b022ebc44411ae3440e274c51c223a7 into b5615d5e919b297def6450b45320a3165c34548c

COPYBARA_INTEGRATE_REVIEW=https://github.com/androidx/media/pull/1826 from androidx:mpegh_extension 6b59a1602b022ebc44411ae3440e274c51c223a7
PiperOrigin-RevId: 689417378
2024-10-24 09:53:45 -07:00
ibaker
757f223d8a Remove // Do nothing overrides from EventLogger
These methods are marked `default` on the `AnalyticsListener` interface
with an empty implementation, so there's no need to override them just
to re-define the empty implementation.

PiperOrigin-RevId: 689416584
2024-10-24 09:50:54 -07:00
dancho
94e37ca7d2 Fix flaky test
* Use asset without audio for independent video time progress
* Use longer item duration to avoid ExoPlayer STATE_READY workaround
  (see https://github.com/google/ExoPlayer/issues/1874)

PiperOrigin-RevId: 689409427
2024-10-24 09:29:35 -07:00
michaelkatz
2f198c4c06 Implement getDurationToProgressUs for DecoderAudioRenderer
Add `DecoderAudioRenderer.getDurationToProgressUs()` so that `ExoPlayer`, if set with `experimentalSetDynamicSchedulingEnabled()`, will dynamically schedule its main work loop to when the `DecoderAudioRenderer` can make progress.

PiperOrigin-RevId: 689377247
2024-10-24 07:46:42 -07:00
sheenachhabra
f181855c5e Add an API to disable sample batching in Mp4Muxer
Mp4Muxer caches the samples and then writes them in batches.
The new API allows disabling the batching and writing sample
immediately.

PiperOrigin-RevId: 689352771
2024-10-24 06:15:25 -07:00
ibaker
b36de302f7 Remove some un-needed proguard-rules.txt symlinks
PiperOrigin-RevId: 689344803
2024-10-24 05:43:59 -07:00
rohks
5f99955f31 Make minor improvements for IAMF decoder module
- Create `LibiamfAudioRenderer` with `DefaultRenderersFactory` in `ExoPlayerModuleProguard`.
- Remove redundant library availability check from `IamfModuleProguard`.
- Move `proguard-rules.txt` to the root folder.
- Removed unused `cryptoType` parameter from `setLibraries()` method in `IamfLibrary`.
- Added log when `LibiamfAudioRenderer` is loaded in `DefaultRenderersFactory`.
- Annotated missing classes with `@UnstableApi`.
- Check for library availability and throw exception in `IamfDecoder` constructor.

#cherrypick

PiperOrigin-RevId: 689330016
2024-10-24 04:46:13 -07:00
ibaker
4a406be1bf DataSourceContractTest: Tighten assertions around 'not found' URIs
This change:
1. Updates `DataSourceContractTest` to allow multiple "not found"
   resources, and to include additional info (e.g. headers) on them.
2. Updates the contract test to assert that `DataSource.getUri()`
   returns the expected (non-null) value for "not found" resources
   between the failed `open()` call and a subsequent `close()` call.
   The `DataSource` is 'open' at this point (since it needs to be
   'closed' later), so `getUri()` must return non-null.
    * This change also fixes some implementations to comply with this
      contract. It also renames some imprecisely named `opened`
      booleans that **don't** track whether the `DataSource` is open
      or not.
3. Updates the contract test assertions to enforce that
   `DataSource.getResponseHeaders()` returns any headers associated
   with the 'not found' resource.
4. Configures `HttpDataSourceTestEnv` to provide both 404 and "server
   not found" resources, with the former having expected headers
   associated with it.

PiperOrigin-RevId: 689316121
2024-10-24 03:49:27 -07:00
kimvde
d25a423888 Remove unused parameter from VideoFrameRenderControl.FrameRenderer
PiperOrigin-RevId: 689281689
2024-10-24 01:27:20 -07:00
Copybara-Service
b5615d5e91 Merge pull request #1794 from stevemayhew:p-fix-ntp-time-update-main
PiperOrigin-RevId: 689121191
2024-10-23 15:22:22 -07:00
jbibik
7da71f792b Move PlayerSurface from demo-compose to media3-ui-compose
The new `media3-ui-compose` module does not have any Material library dependencies, but will rely on androidx.compose + foundation/runtime/ui and other non-theming/opinionated libraries. Surface handling is one such usecase.

PiperOrigin-RevId: 689004504
2024-10-23 10:00:07 -07:00
tonihei
21526588be Removed unused constructor
PiperOrigin-RevId: 688960856
2024-10-23 07:50:31 -07:00
michaelkatz
f11130d59e Move setVideoOutput message handling to playback thread
PiperOrigin-RevId: 688951964
2024-10-23 07:16:50 -07:00
tonihei
dfb7636138 Suppress not-applicable lint warning
PiperOrigin-RevId: 688948857
2024-10-23 07:11:58 -07:00
ibaker
7b66209bca Add missing overrides in DefaultTrackSelector.Parameters.Builder
Also add a test for this to avoid missing any others in future. Also
flesh out the existing test for the deprecated builder, to assert the
return type is correctly updated.

PiperOrigin-RevId: 688948768
2024-10-23 07:08:03 -07:00
kimvde
75f29b6997 Implement DefaultVideoSink.render()
PiperOrigin-RevId: 688948682
2024-10-23 07:05:53 -07:00
michaelkatz
e5133e78f5 Abstract EPII renderer logic into holder class
Move EPII calls to renderers to a separate managing class.

PiperOrigin-RevId: 688932712
2024-10-23 06:04:21 -07:00
rohks
e677c8dccd Fix duration calculation for AVI files
The duration is now correctly calculated as the maximum of all track durations, instead of being overwritten by the last track's value. This aligns with how other Extractor implementations handle durations for multiple tracks.

PiperOrigin-RevId: 688896743
2024-10-23 03:34:04 -07:00