20818 Commits

Author SHA1 Message Date
claincly
ccdc0ffc27 Use us (microsecond) API.
PiperOrigin-RevId: 649058648
2024-07-03 07:00:18 -07:00
sheenachhabra
a1fc4e766f Reduce Exoplayer load control buffer durations for Transformer demo app
The default value is 50 seconds.
Changed it to 5 seconds.

This prevents the player from buffering too much data and causing the app to crash due to OOM.

This was reported in https://github.com/androidx/media/issues/1506

PiperOrigin-RevId: 649054885
2024-07-03 06:41:52 -07:00
kimvde
c832cf5a57 Clarify Javadoc of VideoSink
The VideoSink has an input and an output surface. Clarify which surface
the Javadoc is referring to. Also document that the VideoSink can be fed
with images, and that multiple renderers can feed the same sink.

PiperOrigin-RevId: 649052551
2024-07-03 06:31:40 -07:00
claincly
ed3a741601 Fix MCVR crash when seeking in HDR10 videos
MCVR crashed because MCVR registers a new input stream to VideoSink on every
`onOutputFormatChanged()`, assuming that `onOutputFormatChanged()` is only
invoked on media item transition. However, it can be called multiple times for
one media item.

PiperOrigin-RevId: 649050576
2024-07-03 06:22:44 -07:00
claincly
ce8ab84b7c Add test that covers clipping all videos in a sequence
PiperOrigin-RevId: 649048322
2024-07-03 06:13:08 -07:00
claincly
b9d101f090 Use a resolution that should be encode-able on all devices
The image in the test has a resolution of 1x1 which some device will reject.

PiperOrigin-RevId: 649039791
2024-07-03 05:32:56 -07:00
andrewlewis
0b96f4372f Rollback of 95260e28a5
PiperOrigin-RevId: 649003095
2024-07-03 02:52:00 -07:00
tianyifeng
b531d93b90 Version bump to 1.4.0-rc01
#cherrypick

PiperOrigin-RevId: 648982615
2024-07-03 01:27:39 -07:00
claincly
73da1c09bd Call onProcessedStreamChange() for every media item change
Added `MCR.experimentalEnableProcessedStreamChangedAtStart()` to guard this new
feature.

PiperOrigin-RevId: 648886533
2024-07-02 17:04:08 -07:00
sheenachhabra
3793a06bdd Add support for file format for depth/editing in Mp4Muxer
PiperOrigin-RevId: 648747038
2024-07-02 09:42:36 -07:00
tianyifeng
9277a34253 Update release notes for 1.4.0-rc01
#cherrypick

PiperOrigin-RevId: 648745388
2024-07-02 09:37:05 -07:00
dancho
91bf3d1da1 Use software decoder in VideoDecodingWrapper
Hardware decoder on some devices fails to write 1920x1080 YUV_420_888 buffers into an ImageReader. This change allows us to remove skipCalculateSsim device workaround in ExportTest.java.

VideoDecodingWrapper now uses media3.MediaExtractorCompat: necessary for parsing of MediaFormat#KEY_CODECS_STRING and decoder capabilities check

PiperOrigin-RevId: 648726721
2024-07-02 08:29:36 -07:00
andrewlewis
3b7d59ef4f Rollback of 95260e28a5
PiperOrigin-RevId: 648708459
2024-07-02 07:16:27 -07:00
tianyifeng
afe3826d7c Suppress the lint "WrongConstant" error
Lint somehow complains that the integer resulting from the bit-manipulation shouldn't be passed as an @IntDef parameter.

#cherrypick

PiperOrigin-RevId: 648687698
2024-07-02 05:49:23 -07:00
andrewlewis
95260e28a5 Add input type for automatic frame registration
Deprecate `setInputDefaultBufferSize` and `setRequireRegisteringAllInputFrames`
as the new input stream type replaces these (as far as we know they are always
used together).

This is in preparation for supporting asset loaders signaling that they require
these features, specifically for recording from a surface.

PiperOrigin-RevId: 648686087
2024-07-02 05:41:23 -07:00
kimvde
a2087ba5bb Improve Javadoc of VideoSink.registerInputFrame/queueBitmap
Document that the stream must be registered before

PiperOrigin-RevId: 648648650
2024-07-02 02:50:02 -07:00
ibaker
03a205f220 Re-order CEA-6/708 samples during extraction instead of rendering
This is required before we can move CEA-6/708 parsing from the rendering
side of the sample queue to the extraction side.

This re-ordering is needed for video encodings with different decoder
and presentation orders, because the CEA-6/708 data is attached to each
frame and needs to be processed in presentation order instead of decode
order. This change re-orders frames within a group-of-pictures, but also
takes advantage of `maxNumReorderFrames/Pics` values to cap the size of
the re-ordering queue, allowing caption data to be released 'earlier'
than the end of a GoP.

Annex D of the CEA-708 spec (which also applies for CEA-608 embedded in
SEI messages), makes the need to re-order from decode to presentation
order clear.

PiperOrigin-RevId: 648648002
2024-07-02 02:47:45 -07:00
tianyifeng
0510370bd2 Add OptIn annotation to method declaration in demo app file
#cherrypick

PiperOrigin-RevId: 648641357
2024-07-02 02:19:18 -07:00
bachinger
ec3a58f8db Count down three playback states to match the assertion
PiperOrigin-RevId: 648629427
2024-07-02 01:30:38 -07:00
tianyifeng
7fb6eee920 Add PreloadException with initial subset of error codes
As the first version, the error codes only include the miscellaneous and IO errors, but are likely to be extended.

PiperOrigin-RevId: 648466385
2024-07-01 13:24:34 -07:00
ibaker
711d18de03 Fix index out of bounds exception when a Subtitle is empty
Issue: androidx/media#1516

#cherrypick

PiperOrigin-RevId: 648416119
2024-07-01 10:40:15 -07:00
bachinger
70c063905c Improve automatic error replication for legacy browsers
This change extends the error replication to a given set of
error codes (not only authentication error), but only
replicates an error if the caller of the service `Callback`
is a legacy controller. It also makes error replication
configurable so that apps can opt-out and report errors
manually instead, or define the error codes for which
replication is enabled.

The change also removes the restriction of `sendError` only
being available for Media3 controllers. Instead, sending an
error to a legacy controller updates the platform playback
state in the same way as sending the error to the media
notification controller.

#cherrypick

PiperOrigin-RevId: 648399237
2024-07-01 09:47:25 -07:00
tianyifeng
6bf2461f80 Update translations
#cherrypick

PiperOrigin-RevId: 648385733
2024-07-01 09:02:21 -07:00
simakova
16ef63cdfc Update the composition README file
PiperOrigin-RevId: 648282532
2024-07-01 01:34:17 -07:00
dancho
9939d77d14 Change test to output 16x width and height
PiperOrigin-RevId: 647716870
2024-06-28 10:03:48 -07:00
claincly
174d5ea530 Update test golden images
Now VFP receives actual (un-offsetted) frame presentation time, updates the
test goldens to match.

PiperOrigin-RevId: 647665323
2024-06-28 07:04:47 -07:00
ktrajkovski
e4d4a776c3 Remove deprecated hasPreviousWindow() and hasPrevious() methods.
Use Player.hasPreviousMediaItem() and Player.seekToPreviousMediaItem() instead.

PiperOrigin-RevId: 647664991
2024-06-28 07:02:33 -07:00
dancho
18b28cd625 Skip seahawk device for 8K encoding
PiperOrigin-RevId: 647647264
2024-06-28 05:40:50 -07:00
ktrajkovski
e392084c4d Remove deprecated DrmSessionEventListener.onDrmSessionAcquired method.
#cherrypick

PiperOrigin-RevId: 647620751
2024-06-28 03:36:51 -07:00
ktrajkovski
47b1ca18ed Remove deprecated Player#hasPrevious() method.
Use Player#hasPreviousMediaItem() instead.

#cherrypick

PiperOrigin-RevId: 647336042
2024-06-27 09:04:21 -07:00
Googler
3da63eeaa7 Add NAL unit parsing needed for stereo MV-HEVC playback.
Add the following NAL unit parsing utility functions that will be needed for the MV-HEVC support as proposed in Apple's HEVC stereo video interoperability profile:
- NAL unit header parsing to get the layer information needed for MV-HEVC support.
- VPS parsing, including vps_extension() needed for MV-HEVC support.
- SPS parsing modifications to support MV-HEVC.

PiperOrigin-RevId: 647329211
2024-06-27 08:39:12 -07:00
michaelkatz
304bcfc852 Fix spelling typo in 1.4.0-beta01 release notes
PiperOrigin-RevId: 647327810
2024-06-27 08:35:06 -07:00
michaelkatz
a58e77a5a6 Cache audio timestamp frame position across track transition reset
Upon track transition of offloaded playback of gapless tracks, the framework will reset the audiotrack frame position. The `AudioTrackPositionTracker`'s `AudioTimestampPoller` must be made to expect the reset and cache accumulated sum of `AudioTimestamp.framePosition`.

#cherrypick

PiperOrigin-RevId: 647294360
2024-06-27 06:27:32 -07:00
andrewlewis
dcbded0fa9 Rename cancel to pause in Transformer demo
The user might expect this button to back out to the configuration activity,
but actually it toggles pause/resume (though `cancel` is the method called).

PiperOrigin-RevId: 647273416
2024-06-27 04:59:13 -07:00
tonihei
727645179b Send pending updates before adding discontinuity for error
When handling a playback error that originates from a future item in
the playlist, we added support for jumping to that item first,
ensuring the errors 'happen' for the right 'current item'.
See 79b688ef30.

However, when we add this new position discontinuity to the
playback state, there may already be other position discontinuities
pending from other parts of the code that executed before the
error. As we can't control that in this case (because it's part
of a generic try/catch block), we need to send any pending
updates first before handling the new change.

Issue: androidx/media#1483
#cherrypick
PiperOrigin-RevId: 646968309
2024-06-26 09:09:01 -07:00
kimvde
25b8385cff Fix Javadoc of VideoSink.setStreamOffsetAndAdjustmentUs
PiperOrigin-RevId: 646942034
2024-06-26 07:40:26 -07:00
Copybara-Service
6244d8605f Merge pull request #1487 from colinkho:main
PiperOrigin-RevId: 646917527
2024-06-26 06:05:07 -07:00
sheenachhabra
6fc0243106 Use Set instead of a List for metadata collection
All metadata entries are supposed to be unique, so Set is more appropriate.

PiperOrigin-RevId: 646907916
2024-06-26 05:29:47 -07:00
claincly
efbd522df9 Fix test with TimestampWrapper
The renderer offset is not needed as the pipeline now takes un-offset time,
from 73bf852405

PiperOrigin-RevId: 646808594
2024-06-26 03:48:43 -07:00
kimvde
3694487285 Correct documented Transformer HDR limitation
PiperOrigin-RevId: 646798618
2024-06-26 03:08:08 -07:00
claincly
9e7318e3b4 Clarify the HDR10 video in the demos is actually HDR10+
It's captured on a Samsung and has dynamic metadata.

PiperOrigin-RevId: 646796836
2024-06-26 03:02:00 -07:00
Ian Baker
a15710ba44 Reformat and add/remove some final keywords 2024-06-25 15:51:03 +01:00
Colin Kho
2ee69cb1f9 Avoid unnecessary getSystemService call on WifiLockManager and WakeLockManager if not enabled 2024-06-25 15:51:02 +01:00
sheenachhabra
be2d68c2b3 Improve method names in Mp4Writer
PiperOrigin-RevId: 646465516
2024-06-25 07:09:12 -07:00
rohks
12c42585d2 Use removeKey method instead of setting null for KEY_CODECS_STRING
Setting a `null` value doesn't remove the key as expected per the `MediaFormat` API documentation, using the `removeKey` method instead which is only available starting API level 29.

PiperOrigin-RevId: 646462402
2024-06-25 06:57:19 -07:00
ibaker
5fcc7433a1 Use MediaCodec.stop() before release() for surface switching bug
ExoPlayer used to call `stop()` before `release()`. This was removed in
<unknown commit>.

A framework bug introduced in Android 11 (API 30) resulted in some
DRM -> clear transitions failing during `MediaCodec.configure()`. An
investigation in Issue: google/ExoPlayer#8696 and b/191966399 identified that this was
due to `release()` returning 'too early' and the subsequent
`configure()` call was then trying to re-use a `Surface` that hadn't
been fully detached from the previous codec. This was fixed in
Android 13 (API 33) with http://r.android.com/2094347.

ExoPlayer worked around the framework bug by adding an arbitrary 50ms
sleep after a failed codec initialization, followed by retrying. This
was enough to resolve the problem in the test scenario on a OnePlus
AC2003.

Issue: androidx/media#1497 points out that 50ms might not be the appropriate delay
for all devices, so it's an incomplete fix. They suggested re-adding the
`MediaCodec.stop()` call instead. This also reliably resolves the issue
on the OnePlus AC2003 (with neither workaround in place, the problem
repros almost immediately).
PiperOrigin-RevId: 646461943
2024-06-25 06:54:45 -07:00
claincly
73bf852405 Make ExoPlayer.setVideoEffects() timestamp start from 0
This is consistent with `Transformer` and `CompositionPlayer`

Issue: androidx/media#1098
PiperOrigin-RevId: 646446824
2024-06-25 05:59:15 -07:00
tonihei
867410fece Rename DummyTrackOutput and DummyExtractorOutput
#cherrypick

PiperOrigin-RevId: 646434450
2024-06-25 05:07:56 -07:00
tonihei
18e631ff79 Add guard against additional tracks reported by Extractors
Extractors should not report additional tracks once they called
ExtractorOutput.endTracks. This causes thread safety issues in
ProgressiveMediaPeriod where the array of sample queues is
extended while the playback thread accesses the arrays.

Detecting this problem early is beneficial to avoid unexplained
exceptions later one. In most cases where this may happen (namely
TS extractors finding new tracks), it's better to ignore the new
tracks instead of failing completely. So this change adds a
warning log message and assigns a placeholder output.

Note: The same workaround already exists in HlsSampleStreamWrapper
and MediaExtractorCompat.

Issue: androidx/media#1476
#cherrypick
PiperOrigin-RevId: 646427213
2024-06-25 04:38:22 -07:00
Copybara-Service
0466728497 Merge pull request #1479 from dryganets:sdryanets/fix-handler-usage
PiperOrigin-RevId: 646402268
2024-06-25 02:56:09 -07:00