20051 Commits

Author SHA1 Message Date
andrewlewis
e82393ed41 Skip 1080p test on Nexus 7, API 21
This device doesn't seem to be capable of simultaneous encode/decode at this
resolution. We don't have a good way to check the capability (we are already
checking separate decode/encode capability) so just skip this test to save time
triaging its failures.

PiperOrigin-RevId: 600399564
2024-01-22 02:52:25 -08:00
christosts
d1d03189eb Rollback of e364510937
PiperOrigin-RevId: 600393114
2024-01-22 02:19:01 -08:00
tonihei
b1c954fa84 Use routed device in AudioCapabilities
From API 23, we may have a preferred device that is most likely used
as the output device.
From API 24, the AudioTrack tells us the actual routed device that is
used for output and we can listen to changes happening mid-playback.
From API 33, we can directly query the default device that will
be used for audio output for the current attributes.

If the routed device is known by any of the methods above, we can add
more targeted checks in methods like isBluetoothConnected to avoid
iterating over all devices that are not relevant.

The knowledge about the routed device will also be useful to check
advanced output capabilities in the future (e.g. for lossless
playback)

PiperOrigin-RevId: 600384923
2024-01-22 01:40:50 -08:00
huangdarwin
cb0f5a7fff Previewing: set VideoFrameReleaseControl after CVSP is created.
This allows us to inject a videoFrameProcessorFactory into
MediaCodecVideoRenderer, without issues about creating the
VideoFrameReleaseControl in the MediaCodecVideoRenderer.

Unfortunately, this does result in more complex CVSP state, where
VideoFrameReleaseControl is no longer final, may be null, and may potentially
change. However, this tries to be careful with assertions to guarantee good
state, and is cleaner than modifying the long-standing MediaCodecVideoRenderer
interface.

Tested that this works on the ExoPlayer demo with setVideoEffects applied, and
using a playlist with SDR->HDR and HDR->SDR items.

PiperOrigin-RevId: 599823412
2024-01-19 07:08:23 -08:00
samrobinson
e364510937 Remove thread blocking for TransformerInternal#getProgress.
Thread-safe interactions with state and value.

PiperOrigin-RevId: 599810672
2024-01-19 06:04:27 -08:00
Copybara-Service
c403df116b Merge pull request #973 from jan-varecka-signageos-io:feat/extractTsAudioType
PiperOrigin-RevId: 599547201
2024-01-18 10:25:47 -08:00
ibaker
34a08e13fc Rollback of 406c0a15be
PiperOrigin-RevId: 599546140
2024-01-18 10:21:53 -08:00
Rohit Singh
50385be7ff Changes based on internal review 2024-01-18 17:25:36 +00:00
ibaker
2e8a81cd4d Update Util.moveItems to explicitly T extends @NonNull Object
PiperOrigin-RevId: 599516707
2024-01-18 08:35:04 -08:00
sheenachhabra
36e99f5264 Remove unnecessary passing around of class variable
PiperOrigin-RevId: 599507570
2024-01-18 08:01:33 -08:00
samrobinson
3e3c746368 Add javadoc to the TransformerState's for pause & resume.
Although not public, documenting what happens in each state allows for
better code understanding at a glance.

As part of this, refactored the #getProgress method to highlight that
the other options are "non standard".

PiperOrigin-RevId: 599505369
2024-01-18 07:52:02 -08:00
sheenachhabra
4b0ff48ca9 Fix release notes
PiperOrigin-RevId: 599499930
2024-01-18 07:25:44 -08:00
tonihei
59dc5b6692 Add missing null and Bundle checks in MediaSession/ControllerStub
PiperOrigin-RevId: 599477547
2024-01-18 05:29:39 -08:00
huangdarwin
616cb943f0 Previewing: Allow inputColorInfo to change, from SDR to HDR.
This also fixes issue introduced by frames being released from a prior version of a
GlShaderProgram

Tested by seeking within a playlist with one SDR then one HDR video.

PiperOrigin-RevId: 599475959
2024-01-18 05:20:18 -08:00
christosts
0e66197419 Rename TimestampIterator argument name in queueInputBitmap()
#minor-release

PiperOrigin-RevId: 599460771
2024-01-18 04:01:27 -08:00
tofunmi
5eb1f4043b disallow go links in Media3 open source code
PiperOrigin-RevId: 599455204
2024-01-18 03:28:31 -08:00
tonihei
e730feb98a Add missing IntDef annotation
PiperOrigin-RevId: 599414024
2024-01-18 00:16:59 -08:00
huangdarwin
1ec193883c HDR: Propagate PQ to SDR OOTF to internal input.
Previously, 8f69bb0d9d updated external input (video input)
but not internal input (image/texture input). Update internal input as
well to match.

PiperOrigin-RevId: 599235813
2024-01-17 11:27:38 -08:00
sheenachhabra
666685bd85 Use 4 Byte size field in fMP4 mdat boxes
Since mdat box can be huge so there is a provision to use 64 bit size field.
In case of fragmented MP4, individual fragments should not have large mdat box
so a 32 bit size field should be sufficient.

PiperOrigin-RevId: 599219041
2024-01-17 10:36:47 -08:00
ibaker
406c0a15be CompositeSequenceableLoader: Prefer buffered position of A/V tracks
Preferring audio and video tracks matches logic we already have in
[`ProgressiveMediaPeriod.getBufferedPositionUs`](f6fe90f30b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ProgressiveMediaPeriod.java (L403)).

PiperOrigin-RevId: 599154217
2024-01-17 06:33:14 -08:00
Rohit Singh
32576be3e3 Add release note 2024-01-17 13:26:17 +00:00
ibaker
80bfa819c0 Add method to TextRenderer to control whether decoding is done or not
When we default to 'parse during extraction', we will flip the default
of this, to ensure that apps know they are using an
incompatible/deprecated flow for subtitle handling.

PiperOrigin-RevId: 599109304
2024-01-17 02:51:48 -08:00
Rohit Singh
7e21da8b73 Format with google-java-format 2024-01-17 10:51:28 +00:00
Jan Vařečka
286b1f52d9 Add test for MPEG audio with audio type 2024-01-17 10:22:55 +00:00
Jan Vařečka
a83662b8e1 Extract audio type from TS descriptors
The audio type of the stream is defined by ISO/IEC 13818-1 in section 2.6.18.
2024-01-17 10:22:52 +00:00
bachinger
2c8ba50524 Disable double-click detection for TV apps
Issue: androidx/media#962
PiperOrigin-RevId: 598876214
2024-01-16 10:10:09 -08:00
rahulnmohan
27c021fd7b Merge Issue: androidx/media#275: MPEG2-TS: Support DTS, DTS-LBR and DTS:X Profile2
Imported from GitHub PR https://github.com/androidx/media/pull/275

Added below mentioned features.

- Support for extracting DTS LBR(DTS Express) and DTS UHD Profile 2(DTS:X) descriptor ID from PSI PMT
- The DTSReader class is updated for extracting a DTS LBR.
- Newly added DtsUhdReader class for extracting DTS UHD frame.
- The DTSUtil class is updated to parse the DTS LBR or DTS UHD frame and report the format information.

Feature request for ExoPlayer: https://github.com/google/ExoPlayer/issues/11075
Merge 21efa0810db31550d6b215639f9ca2af6a32139a into 104cfc322c095b40f88e705eb4a6c2f029bacdd6

COPYBARA_INTEGRATE_REVIEW=https://github.com/androidx/media/pull/275 from rahulnmohan:dts-mpeg2ts-update 21efa0810db31550d6b215639f9ca2af6a32139a
PiperOrigin-RevId: 598854998
2024-01-16 08:54:43 -08:00
samrobinson
e41b23d2f4 Add thread-safe information & annotations to necessary fields.
This change is a small incremental step towards better thread-safety.

PiperOrigin-RevId: 598852158
2024-01-16 08:43:15 -08:00
andrewlewis
0513a28169 Remove initialization in declaration
PiperOrigin-RevId: 598835989
2024-01-16 07:35:18 -08:00
andrewlewis
fc9900c483 Document setVideoEffects surface limitation
`Surface`s don't expose their size via Java APIs. Recommend apps pass a
`SurfaceView` (which is preferable to `TextureView` as it's more efficient)
or `SurfaceHolder` so they benefit from the player automatically passing the
size down to the video renderer via `MSG_SET_VIDEO_OUTPUT_RESOLUTION`.

PiperOrigin-RevId: 598804258
2024-01-16 04:52:08 -08:00
tofunmi
5488d33da8 Transformer: add api to cutomize image loading
PiperOrigin-RevId: 598793134
2024-01-16 03:56:08 -08:00
christosts
2d89ffc682 Annotate CompositingVideoSinkProvider with RestrictTo
The class is public so that it can be used between different
packages but it is not meant to be used by apps.

PiperOrigin-RevId: 598792759
2024-01-16 03:52:41 -08:00
ibaker
520687af28 Bump media1 dep to 1.7.0
This brings in a fix for Issue: androidx/media#489.

PiperOrigin-RevId: 598771006
2024-01-16 02:05:20 -08:00
tofunmi
0155ae998b Gaussian Blur: support blurring without drawing sharp image on top
PiperOrigin-RevId: 598626481
2024-01-15 09:39:38 -08:00
jbibik
e51c293f75 Plumb SubtitleParser.Factory into MatroskaExtractor
MatroskaExtractor will no longer be wrapped in SubtitleTranscodingExtractor, but instead use SubtitleTranscodingExtractorOutput under the hood.

FLAG_EMIT_RAW_SUBTITLE_DATA flag will be used to toggle between subtitle parsing during extraction (before the sample queue) or during decoding (after the sample queue).

The new extractor dump files generated by `MatroskaExtractorTest` now follow the new parsing logic and hence have mimeType as `x-media3-cues`.

PiperOrigin-RevId: 598616231
2024-01-15 08:32:22 -08:00
bachinger
be2f8c41b7 Fix typo in MediaSessionLegacyStub
PiperOrigin-RevId: 598615782
2024-01-15 08:29:10 -08:00
jbibik
a88d8a415a Plumb SubtitleParser.Factory into AviExtractor
AviExtractor supports text tracks (`AviExtractor.FOURCC_txts` -> `C.TRACK_TYPE_TEXT`) with subtitles.

AviExtractor will no longer be wrapped in SubtitleTranscodingExtractor, but instead use SubtitleTranscodingExtractorOutput under the hood.

FLAG_EMIT_RAW_SUBTITLE_DATA flag will be used to toggle between subtitle parsing during extraction (before the sample queue) or during decoding (after the sample queue).

PiperOrigin-RevId: 598594981
2024-01-15 06:21:33 -08:00
sheenachhabra
4a07d13838 Version bump to media3:1.3.0-alpha01
#minor-release

PiperOrigin-RevId: 598588547
2024-01-15 05:44:03 -08:00
tofunmi
7f087243bb Add supportsMimeType API to bitmapLoader
PiperOrigin-RevId: 597942459
2024-01-12 13:49:38 -08:00
tofunmi
6879698d7e Move setting bitmapFactory options from interface to implementation
Moves setting bitmapFactory options from BitmapLoader to DatasourceBitmapLoader

BitmapLoader is a general interface for bitmap loading that could use loading implementations other that BitmapFactory, with the rise of Glide being a loader of choice. It's best to correct this interface so that it remains generic

We can't deprecate easily because the other loadBitmap method in that case has a default implementation that relies on the first one, so the change is still breaking. BitmapLoader is public api in common, but it's @UnstableAPI and hasn't been around for very long (be38670391 added it), so it seems this is the best way forward.

PiperOrigin-RevId: 597897098
2024-01-12 11:21:48 -08:00
sheenachhabra
09a547953b Update RELEASENOTES for 1.3.0-alpha01
#minor-release

PiperOrigin-RevId: 597862117
2024-01-12 09:33:58 -08:00
ibaker
d4be30b04d Mark CompositeSequenceableLoader final
Subclasses of this component can customize it by wrapping with the
decorator pattern, and a custom `CompositeSequencableLoaderFactory`
allows access to the list of delegate `SequenceableLoader` instances.

The `final` keyword was removed as part of <unknown commit> but this
component never ended up being subclassed within the library.

Making this class `final` makes upcoming changes easier to reason
about.

PiperOrigin-RevId: 597853429
2024-01-12 09:02:06 -08:00
ibaker
4061d476a1 MP3: Assume an Info header indicates CBR for seeking purposes
The seek table in a Xing/Info header is very imprecise (max resolution
of 255 to describe each of 100 byte positions in the file). Seeking
using a constant bitrate assumption is more accurate, especially for
longer files (which exacerbates the imprecision of the Info header).

VBR files should contain an Xing header, while an Info header is
identical but indicates the file is CBR.

Issue: androidx/media#878
PiperOrigin-RevId: 597827891
2024-01-12 06:48:00 -08:00
christosts
5056dfaa2b Regression fix of ExoPlayer.setVideoEffects()
7e65cce967 introduced a regression on ExoPlayer.setVideoEffects()
where there is flash on the screen after the first few frames are shown.

Before 7e65cce967, the first frames of the content are missed, until
MediaCodecVideoRenderer sends the onVideoSizeChanged() callback. The
first frame is processed but not shown, the onVideoSizeChanged() is
triggered and the renderer receives a video output resolution message as
a response from the UI.

7e65cce967 fixed the missed first frames by setting a surface on the
CompositingVideoSinkProvider before the provider is initialized, and as
as result:
- the first frames are rendered
- the MediaCodecVideoRenderer sends the the onVideoSizeChanged() after
  frames are shown
- the UI sends a video output resolution change
- the MediaCodecVideoRenderer updates the CompositingVideoSinkProvider
  which causes the flash.

The underlying problem is with onVideoSizeChanged() not being
triggered early enough, before the first frame is shown.

Because the flashing is a regression, this commit is reverting
7e65cce967 but keeps the test that was added as ignored, so that the
test is re-enabled as soon as we address the underlying issue.

PiperOrigin-RevId: 597814013
2024-01-12 05:20:46 -08:00
tofunmi
78c419e566 Extension to Gaussian Blur: support changing blur over time
PiperOrigin-RevId: 597809380
2024-01-12 04:53:02 -08:00
jbibik
59afb4fb01 Plumb SubtitleParser.Factory into WebvttExtractor
WebvttExtractor will no longer be wrapped in SubtitleTranscodingExtractor, but instead use SubtitleTranscodingExtractorOutput under the hood.

A new constructor will take a boolean parameter to toggle between subtitle parsing during extraction (before the sample queue) or during decoding (after the sample queue).

PiperOrigin-RevId: 597604942
2024-01-11 11:13:08 -08:00
tofunmi
f2be3fd0cb Trim Opt: Calculate duration based on sample rate from audio format
Calculating the encoded audio buffer duration.

PiperOrigin-RevId: 597591689
2024-01-11 10:28:14 -08:00
jbibik
a728ec8e67 Plumb SubtitleParser.Factory into TsExtractor
PiperOrigin-RevId: 597578122
2024-01-11 09:35:22 -08:00
huangdarwin
c59711f592 Effect: Remove unused arguments in DefaultShaderProgram factories.
Partially addresses the following TODO, by simplifying the DefaultShaderProgram
API surface.
```
// TODO(b/274109008): Refactor DefaultShaderProgram to create a class just for sampling.
```

PiperOrigin-RevId: 597575575
2024-01-11 09:25:25 -08:00
huangdarwin
b4dfbed73d Update javadoc param name to match argument name
PiperOrigin-RevId: 597554111
2024-01-11 07:50:13 -08:00