21525 Commits

Author SHA1 Message Date
sheenachhabra
d3b7f7e114 Add VP9 test to Mp4MuxerEndToEndNonParameterizedAndroidTest
The test is currently disabled because the produced dump file
is different on different SDK versions.

PiperOrigin-RevId: 686518799
2024-10-16 08:37:41 -07:00
kimvde
363f71357b Handle output size changes inside DefaultVideoSink
PiperOrigin-RevId: 686507112
2024-10-16 07:59:35 -07:00
ibaker
6afebf4c7d Fix typo in release notes
#cherrypick

PiperOrigin-RevId: 686477355
2024-10-16 05:59:00 -07:00
ibaker
e3f813cf0b Attach a Surface in HlsPlaybackTest.cmcdEnabled_withInitSegment
This ensures that the buffers are correctly marked as `rendered = true`
(and therefore `renderered = false` is meaningful when it's present).

This was accidentally missed in 387153fcf2

PiperOrigin-RevId: 686474869
2024-10-16 05:46:22 -07:00
rohks
692f1c78b3 Add ForwardingTrackOutput implementation
This allows users to extend and customize specific methods of the `TrackOutput` implementation while inheriting default behaviors for others.

PiperOrigin-RevId: 686454360
2024-10-16 04:20:33 -07:00
bachinger
075f311200 Cache children when subscribing
Childrens returned by the legacy service when a Media3
browser connects are cached and returned with the first
`getChildren` call in case the same `paranetid` is
requested.

In any other case the cache is immediately cleared.

#cherrypick

PiperOrigin-RevId: 686157511
2024-10-15 10:40:29 -07:00
rohks
91c56335ef Handle out-of-order frames in endIndices for MP4 with edit list
Updated logic to walk forward in the timestamps array to include all frames within the valid edit duration, accounting for out-of-order frames. This ensures that no frames with timestamps less than `editMediaTime` + `editDuration` are incorrectly excluded.

Issue: androidx/media#1797
PiperOrigin-RevId: 686075680
2024-10-15 06:09:15 -07:00
kimvde
9adb3aaf41 Transformer: add an entry point to disable automatic rotation
PiperOrigin-RevId: 686067527
2024-10-15 05:40:41 -07:00
sheenachhabra
643e16ca8f Handle invalid language codes in Boxes.java
When an invalid language code is give, write default value
instead of throwing.

This behaviour aligns with `MediaMuxer`.

PiperOrigin-RevId: 686066088
2024-10-15 05:36:04 -07:00
bachinger
5a827829b0 Call onChildrenChanged to close the legacy subscription error path
When receiving an error from a legacy `MediaBrowserService` after
having successfully subscribed to a given `parentId`, the callback
needs to be asked to load the children again to receive an error
from the service.

Before this change such an error was dropped as a no-op by Media3
without the `MediaBrowser` giving a chance to react on such an error
being sent by the legacy service.

#cherrypick

PiperOrigin-RevId: 686052969
2024-10-15 04:38:34 -07:00
sheenachhabra
407bd49ed5 Skip audio encoding bitrate setting test on API <= 23
The encoder output format on API 23 does not seem to contain bitrate,
hence the test fails.

PiperOrigin-RevId: 686047480
2024-10-15 04:15:38 -07:00
ibaker
cb90bb38ee Remove unused CapturingRenderersFactory from DASH playback test
The `CapturingRenderersFactory` is only needed if the output is
asserted on, e.g. by using `PlaybackOutput` and
`DumpFileAsserts.assertOutput()`.

PiperOrigin-RevId: 686046545
2024-10-15 04:11:42 -07:00
sheenachhabra
0b47e93df5 Update FragmentedMp4Muxer and Mp4Muxerdocumentation to include VP9
PiperOrigin-RevId: 686041467
2024-10-15 03:53:08 -07:00
Googler
0100f1d902 Boxes: Add edit list box.
PiperOrigin-RevId: 685974308
2024-10-14 23:26:08 -07:00
Copybara-Service
4df9d4e146 Merge pull request #1792 from DolbyLaboratories:dlb/elst-handling/dev
PiperOrigin-RevId: 685851466
2024-10-14 15:20:17 -07:00
Steve Mayhew
621a9aedba SntpClient periodically re-syncs the offset to NTP server
Many of the Android TV platforms do not report accurate `SystemClock.elapsedRealtime()`
In addition this drift is not consistant accross multiple boxes, so the time offset
between any pair of boxes will vary over time.

This variance will lead to a drift in the Live Offset calculation.

Fix is simple, inValidate the NTP server query after a period of time (10 minutes)
and re-issue the call
2024-10-14 22:03:00 +02:00
kimvde
1084c9ea98 Implement DefaultVideoSink.isReady
PiperOrigin-RevId: 685720088
2024-10-14 08:44:51 -07:00
claincly
adb35ee7c4 Reword javadoc
The old javadoc is, IMO, quite hard to understand, so I simplified it a bit,
and added one example.

PiperOrigin-RevId: 685701916
2024-10-14 07:39:53 -07:00
ibaker
9a23d9a611 Deprecate HlsExtractorFactory.DEFAULT
`HlsExtractorFactory` instances are mutable, so storing one in a static
field is not safe, and can lead to state accidentally/surprisingly being
shared between different player instances.

PiperOrigin-RevId: 685701062
2024-10-14 07:36:10 -07:00
ibaker
4a40fa6451 Update StatsDataSource.lastOpenedUri & responseHeader in finally
This ensures these values are still updated even if the delegate
`DataSource.open()` throws an exception (e.g. an HTTP 404).

PiperOrigin-RevId: 685687810
2024-10-14 06:38:56 -07:00
kimvde
37cd008c01 Remove unnecessary method in VideoFrameRenderControl
PiperOrigin-RevId: 685681192
2024-10-14 06:10:33 -07:00
michaelkatz
1c4ee06ad6 Remove Renderer[] from LoadControl.onTracksSelected
The `DefaultLoadControl` implementation of onTracksSelected only utilizes the `Renderer[]` parameter for use in stream type, of which it can collect from the `ExoTrackSelection[]` parameter.

PiperOrigin-RevId: 685677726
2024-10-14 05:56:24 -07:00
claincly
17c0ff8ba8 Log warnings when Transformer sees unsupported track type
PiperOrigin-RevId: 685649866
2024-10-14 03:54:52 -07:00
shahddaghash
5acb483222 Add export settings to demo-composition
Added UI and logic implementation for the following export settings:
* Output audio MIME type
* Output video MIME type
* Enable debug tracing
* Use Media3 Muxer
* Produce fragmented MP4

The settings are shown in a dialog when `Export` button is clicked.

PiperOrigin-RevId: 685648147
2024-10-14 03:46:05 -07:00
shahddaghash
45d2bc39ae Remove SDK checks for H265 and AV1 in Transformer Demo
For simplicity, the following SDK checks when adding supported video codecs were removed from Transformer demo.
1. Adding H265 for API >= 24.
2. Adding AV1 for API >= 34.

PiperOrigin-RevId: 685634851
2024-10-14 02:45:42 -07:00
kimvde
638eae44ab Remove unnecessary method in VideoFrameRenderControl
PiperOrigin-RevId: 685632001
2024-10-14 02:34:49 -07:00
kimvde
5eeedeacc6 Implement DefaultVideoSink.flush()
This is part of the effort to delegate the rendering of the VideoGraph
output frames to a DefaultVideoSink.

PiperOrigin-RevId: 685622019
2024-10-14 01:53:52 -07:00
kimvde
7dbacdb011 PlaybackVideoGraphWrapper: simplify flushing logic
PiperOrigin-RevId: 685610127
2024-10-14 01:10:07 -07:00
ivanbuper
7e023f915b Use BigDecimal as speed parameter for RandomParameterizedSonicTest
This change simplifies conversions to `BigDecimal` and rounding to a set
number of decimal places.

PiperOrigin-RevId: 684890287
2024-10-11 11:00:44 -07:00
tianyifeng
98dc7f2def Add DefaultPreloadManager.Builder
The `DefaultPreloadManager.Builder` is able to build the `DefaultPreloadManager` and `ExoPlayer` instances with the consistently shared configurations. Apps can:

* Simply setup the `DefaultPreloadManager` and `ExoPlayer` with all default configurations via `build()` and `buildExoPlayer()`;
* Or customize the shared configurations by the setters on `DefaultPreloadManager.Builder` and setup via `build()` and `buildExoPlayer()`;
* Or customize the player-only configurations for `ExoPlayer` via `buildExoPlayer(ExoPlayer.Builder)`.

PiperOrigin-RevId: 684852808
2024-10-11 08:55:25 -07:00
ivanbuper
337e59e733 Move util methods in SpeedChangingAudioProcessorto Util
This CL is prework for implementing
`RandomParameterizedSpeedChangingAudioProcessorTest`, which will build
on logic present in `RandomParameterizedSonicTest`.

This is a non-functional change.

PiperOrigin-RevId: 684838017
2024-10-11 08:02:40 -07:00
ivanbuper
984b0bb31a Avoid dropped output frames on SpeedChangingAudioProcessor
Inconsistent rounding modes between `currentTimeUs` and
`bytesUntilNextSpeedChange` would cause `SpeedChangingAudioProcessor`
to miss calling `queueEndOfStream()` on `SonicAudioProcessor` on a speed
change, and thus the final output samples of that `SonicAudioProcessor`
"configuration" would be missed.

This change is also a partial revert of 971486f5f9, which fixed a hang
of `SpeedChangingAudioProcessor`, but introduced the dropped output
frames issue fixed in this CL (see b/372203420). To avoid reintroducing
the hang, we are now ignoring any mid-sample speed changes and will only
apply speed changes that are effective at a whole sample position.

PiperOrigin-RevId: 684824218
2024-10-11 07:01:59 -07:00
tonihei
73f97c0371 Allow AudioTrack to be provided by a customizable provider
PiperOrigin-RevId: 684800579
2024-10-11 05:23:07 -07:00
rohks
ad0493b90f Re-enable disabled tests in FlacExtractorSeekTest
PiperOrigin-RevId: 684790556
2024-10-11 04:38:25 -07:00
sheenachhabra
a0ccd46653 Skip AACObjectHE encoding on faulty devices
These devices claim to have the AACObjectHE profile but the profile never gets applied.

PiperOrigin-RevId: 684786157
2024-10-11 04:18:52 -07:00
Copybara-Service
019fe0589f Merge pull request #1754 from colinkho:loader-plumbing
PiperOrigin-RevId: 684781854
2024-10-11 04:03:09 -07:00
rohks
c78abaac3f Simplify Flac extension build process
Removed `Android.mk` and `Application.mk`, allowing `CMake` to run directly from the build.gradle file. Users no longer need to check out `NDK` or depend on it, simplifying the usage of the Flac extension.

Also fixed a copy-pasted comment in `CMakeLists.txt` of Opus and IAMF.

PiperOrigin-RevId: 684769561
2024-10-11 03:09:32 -07:00
tonihei
b27cbe60b9 Add release callback and generic class to handle type casting 2024-10-11 11:00:45 +01:00
rohks
a2eda3348b Simplify Opus extension build process
Removed `Android.mk` and `Application.mk`, allowing `CMake` to run directly from the build.gradle file. Users no longer need to check out `NDK` or depend on it, simplifying the usage of the Opus extension.

PiperOrigin-RevId: 684489927
2024-10-10 10:23:26 -07:00
rohks
2640ebd58f Add 16 KB page support for decoder extensions on Android 15
We need to rebuild any native components of the app to prevent crashes on devices with 16 KB page support.

Tested on a device that supports 16 KB pages and runs Android 15, as well as on older Android devices.

Issue: androidx/media#1685
PiperOrigin-RevId: 684488244
2024-10-10 10:18:20 -07:00
rohks
6acddfeee6 Simplify IAMF extension build process
Removed `Android.mk` and `Application.mk`, allowing `CMake` to run directly from the `build.gradle` file. Users no longer need to check out `NDK` or depend on it, simplifying the usage of the IAMF extension.

PiperOrigin-RevId: 684471874
2024-10-10 09:32:25 -07:00
sheenachhabra
1729e11159 Fix version and flags in the ctts box
The version and flags are stored in a single integer,
with the version in the higher 8 bits and the flags in
the lower 24 bits. The version should be 1 and the
flags should be 0.

Surprisingly the incorrect value was ignored by many
players and hence the bug was never caught.
With the bug, the video does not play on
`Samsung Galaxy S22 Ultra` and works well
after fixing the bug.

PiperOrigin-RevId: 684433371
2024-10-10 07:19:24 -07:00
ivanbuper
3818e103e6 Rename timeUs to currentTimeUs
This is a non-functional refactor.

PiperOrigin-RevId: 684408479
2024-10-10 05:36:44 -07:00
bachinger
cbc0ee369f Use connection hints when connecting to MediaBrowserService
Minor improvement to allow an Media3 browser to pass extras
when connecting the initial browser in `MediaControllerImplLegacy`.
Before this change an empty bundle was sent. After this change
the connection hints of the `Media3 browser is used as root hints
of the initial browser that connects when the Media3 browser is
built in `MediaBrowser.buildAsync`.

#cherrypick

PiperOrigin-RevId: 684372552
2024-10-10 03:11:52 -07:00
ibaker
b6d0540059 Use scaleLargeTimestamp in TimestampAdjuster
This helps avoid overflows in intermediate calculations.

Verified the value in the test using `BigInteger`:

```
jshell> BigInteger.valueOf(1L << 52).multiply(BigInteger.valueOf(90000)).divide(BigInteger.valueOf(1000000))
$3 ==> 405323966463344
```

Issue: androidx/media#1763

#cherrypick

PiperOrigin-RevId: 684028178
2024-10-09 07:27:53 -07:00
ibaker
2c46cea088 Use RoundingMode.DOWN in Util.scaleLargeTimestamp and friends
The implementation of these methods was updated from direct java integer
arithmetic in 885ddb167e.
In this change, `RoundingMode.FLOOR` was used to try and maintain
compatibility with java integer division. This was incorrect, because
java integer division uses `DOWN` (i.e. towards zero), rather than
`FLOOR` (i.e. towards negative infinity) semantics.

This change fixes the compatibility.

The dump file changes in this CL relate to tests that exercise edit
list behaviour. This involves manipulating negative timestamps, which
explains why they are impacted by this change.

PiperOrigin-RevId: 684013175
2024-10-09 06:24:26 -07:00
shahddaghash
d5baa4ce59 Add HDR & Resolution Height settings to demo-composition
Added UI and logic implementation for HDR mode and Resolution Height to be used as settings for both previewing and exporting.

PiperOrigin-RevId: 684011852
2024-10-09 06:19:28 -07:00
rohks
c744fe9f8f Recognize IAMF format and enhance channel count constraints
- Updated `DefaultTrackSelector.SpatializerWrapperV32.canBeSpatialized` to handle IAMF format.
- Modified `isAudioFormatWithinAudioChannelCountConstraints` to check for `NO_VALUE` of `channelCount` to improve readability.

Note: `DefaultTrackSelector.SpatializerWrapperV32.canBeSpatialized` is not triggered for the IAMF format due to the unset channel count (`Format.NO_VALUE`). The update ensures completeness.

#cherrypick

PiperOrigin-RevId: 684003980
2024-10-09 05:50:58 -07:00
tonihei
15a6906877 Formatting and javadoc 2024-10-09 13:50:30 +01:00
Colin Kho
2f6d8bf5ba Remove unused import 2024-10-09 13:50:29 +01:00