994 Commits

Author SHA1 Message Date
hschlueter
678b6c0438 Replace 640x360 H264 test video with 320x240 H264 video.
Decoding and encoding 320x240 H264 video should be supported
on all devices from Android 5.0 based on CDD requirements.
https://source.android.com/compatibility/5.0/android-5.0-cdd#5_2_video_encoding

640x360 encoding doesn't seem to be supported on Nexus 5.

PiperOrigin-RevId: 450901715
2022-05-26 11:55:21 +00:00
ibaker
c6ed7c4bcb Make Rating.RATING_UNSET package-private
This value is only needed by subclasses of `Rating`, all of which are
in this package (the `Rating` constructor is already package-private to
ensure this).

PiperOrigin-RevId: 450886872
2022-05-26 11:54:20 +00:00
ibaker
cb04297420 Remove InvalidResponseCodeException#headerFields from the stable API
Representing HTTP headers in a `java.util.Map` is error-prone, because
the names (keys) need to be case-insensitive (per
[RFC 2616 section 4.2](https://datatracker.ietf.org/doc/html/rfc2616#section-4.2))
but this is fundamentally technically incompatible with the `Map`
interface (e.g. with headers `{"key": ["val_1", "val_2"]}` then
`get("key")` and `get("KeY")` both return the same list, but `size()`
returns `1`). It also breaks as soon as you copy the `Map` into a
non-case-insensitive (i.e. normal) `Map` implementation, e.g. Guava's
`ImmutableMap`. It's risky that a line as 'innocent' as
`ImmutableMap.copyOf(headers)` could break things so badly.

For now it's enough to keep this field unstable (it's currently the only
reference to HTTP headers in the stable API). We can consider
stabilising an improved HTTP header representation in future.

PiperOrigin-RevId: 450708598
2022-05-26 11:51:27 +00:00
hschlueter
d840aa4dc1 Skip transform4K60 test if 4K decoding is not supported.
4K decoding is not supported (not required to be supported) on all
devices, e.g., Nexus 5 does not support it.

PiperOrigin-RevId: 450682519
2022-05-26 11:50:24 +00:00
tonihei
9463efef4b Wrap TelephonyCallback in nested class to avoid class loading issues.
PiperOrigin-RevId: 450643824
2022-05-26 11:49:21 +00:00
hschlueter
196a99aa5f Don't reallocate EGLSurface for same debug surface.
Recreating an EGLSurface for a surface that already has an
EGLSurface is not allowed according to the
[documentation](https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglCreatePlatformWindowSurface.xhtml).

This fix was tested on the devices listed in the bug
description (Pixel 5a, Nexus 5).

PiperOrigin-RevId: 450473569
2022-05-23 18:37:04 +01:00
ibaker
26a1817ebf Rollback of e01bb47263
*** Original commit ***

Rollback of 07302a23bd

*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default imple...

***

PiperOrigin-RevId: 450453325
2022-05-23 17:12:22 +01:00
bachinger
a8a4faa28c Do not setOffloadEndOfStream if AudioTrack is not playing
AudioTrack.setOffloadEndOfStream should be called after a track
has been buffered. Additionally, the AudioTrack must be playing.

It has been observed that for very short media (<1s), the AudioTrack
might not have started immediately after the read that buffered
the audio.

In such a situation, calling AudioTrack.setOffloadEndOfStream throws
and playback fails.

Avoid this failure by checking that the AudioTrack is playing before
calling setOffloadEndOfStream.

This means that very short gapless media will not be gapless, this was
deemed acceptable given that such very short media should be very rare
in offload.

PiperOrigin-RevId: 450431146
2022-05-23 15:13:43 +01:00
claincly
d6a6529b06 Skip performance tests if device is not capable.
PiperOrigin-RevId: 450427828
2022-05-23 14:54:02 +01:00
ibaker
89194dee59 Add DefaultMediaSourceFactory.setDataSourceFactory
Also add this to the stable API instead of the constructor that takes
`DataSource.Factory`.

PiperOrigin-RevId: 450414119
2022-05-23 13:26:05 +01:00
ibaker
1d139174fd Rollback of 07302a23bd5894d57514c68b2db499ac46726e77
*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450410833
2022-05-23 13:01:22 +01:00
bachinger
8d03fdfe34 Support custom actions with DefaultMediaNotificationProvider
Refactors the DefaultMediaNotificationProvider by separating the
selection of actions and building the notification with it.

The custom commands of the custom layout of the session are turned
into notification actions and when received from the notification
converted back to custom session commands that are sent to the
session.

PiperOrigin-RevId: 450404350
2022-05-24 11:10:51 +01:00
ibaker
07039a45b0 Remove @Nullable from some Dash/Hls/SsMediaSource.Factory methods
The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

Follow-up to 07302a23bd

PiperOrigin-RevId: 450395941
2022-05-24 11:07:57 +01:00
ibaker
07302a23bd Remove @Nullable from MediaSource.Factory setters
The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450386627
2022-05-24 11:07:07 +01:00
tonihei
38b1338844 Remove 5G-NSA detection on API 29/30.
This detection relies on an unsupported workaround and may trigger
permission warnings in tools analyzing permission usage although
no permission is needed or requested by app code.

Given the majority of 5G-NSA playbacks are on API 31+ by now,
we can remove this path to avoid the permission confusion and the
unsupported detection workaround.

PiperOrigin-RevId: 450382586
2022-05-24 11:06:09 +01:00
ibaker
b6711af334 Use @C.DataType intdef in HlsDataSourceFactory.createDataSource
PiperOrigin-RevId: 449973324
2022-05-24 11:05:03 +01:00
ibaker
994c33f56f Fix comment in MediaCodecRenderer
This constant name was updated in 1bcf1cf9f7

PiperOrigin-RevId: 449969093
2022-05-24 11:04:05 +01:00
andrewlewis
ce1ac5894d Track validity of debug SurfaceView
The debug surface view's output surface can become invalid during a transformation due to the parent activity pausing, for example. This can currently cause a crash when backing out of the `TransformerActivity` in the demo because the surface can be destroyed before the transformer has fully canceled.

Also clarify naming of the outputSurface and inline the private method that created `EGLSurface`s (it was shorter after removing the debug preview).

PiperOrigin-RevId: 449963440
2022-05-24 11:03:09 +01:00
rohks
001090cc43 Migrate leaf listeners of Player to new onCues override
PiperOrigin-RevId: 449587030
2022-05-24 11:02:03 +01:00
ibaker
cd142872bb Rename MediaSession.Builder.setSessionCallback to setCallback
Follow-up to c78c1f5891

PiperOrigin-RevId: 449492810
2022-05-24 10:59:06 +01:00
samrobinson
2a45dd3930 Rename expected to reference in SsimHelper.
Reference is clearer when used in conjunction with actual, and matches
other SSIM documentation.

PiperOrigin-RevId: 449486177
2022-05-24 10:57:56 +01:00
ibaker
c78c1f5891 Rename nested session callback interfaces to just Callback
This is consistent with other nested callback/listener interfaces like
`Player.Listener`.

PiperOrigin-RevId: 449476261
2022-05-24 10:57:02 +01:00
ibaker
7c235d2b84 Remove all null-tolerant methods from BundleableUtil.
In most cases it's clearer to in-line these null-checks with ternary
operators.

PiperOrigin-RevId: 449474621
2022-05-24 10:56:01 +01:00
tonihei
1a171a004a Add missing equals to MergingMediaPeriod.ForwardingTrackSelection
This causes a bug where the forwarded selections are no longer
assumed equal and the child MediaPeriods will think they need
to reset streams even though the selection stayed the same.

Issue: Issue: google/ExoPlayer#10248
PiperOrigin-RevId: 449454038
2022-05-24 10:53:39 +01:00
andrewlewis
dcb58c767c Tidy releasing FrameProcessorChain
PiperOrigin-RevId: 449238525
2022-05-24 10:52:33 +01:00
rohks
c728647290 Create new class to store cues and timestamp.
We need to pass timestamp for the list of cues so we are defining a new class CueGroup which will store both cues and timestamp.

PiperOrigin-RevId: 449212054
2022-05-24 10:49:48 +01:00
andrewlewis
0e2bb8c8bd Update stale bug reference.
The old reference was just for prototyping HDR. The new reference is for planned work to use the correct formats for input and output for HDR editing in GL.

PiperOrigin-RevId: 449211792
2022-05-24 10:48:57 +01:00
tonihei
9345c1addc Add replacement for deprecated network type override constant
The MMWAVE constant was deprecated in favour of a new constant
with a better name. Thus, we need to check for both constants now.

PiperOrigin-RevId: 449018959
2022-05-24 10:47:05 +01:00
Ian Baker
05ce399558 Merge pull request #64 from ittiam-systems:rtp-vp9
PiperOrigin-RevId: 448978892
2022-05-24 10:46:15 +01:00
tonihei
0724f5b5a5 Add language normalization for "arb" (Standard Arabic)
This is an individual language (ISO 639-3) part of the Arabic
macrolanguage ("ar" in ISO 639-1). Add this mapping to our
existing list similar to other individual to macrolanguage
mappings we have already.

Issue: Issue: google/ExoPlayer#10255
PiperOrigin-RevId: 448911950
2022-05-24 10:45:09 +01:00
hschlueter
d59186e53c Combine multiple matrix transformations in one shader.
When using a MatrixTransformationFrameProcessor per transformation
matrix, each frame processor's shader applies the matrix to the
vertices and clips the result to the NDC range when drawing the
output frame.
This change combines consecutive MatrixTransformations into a single
MatrixTransformationFrameProcessor by multiplying the individual
matrices while updating and clipping the visible polygon after
each matrix and mapping the resulting visible polygon back to the
input space so that its vertices and the combined transformation
matrix can be used in the shader.

PiperOrigin-RevId: 448521068
2022-05-24 10:44:15 +01:00
bachinger
f3dd361076 Improve JavaDoc of MediaSession.release
Specifically mention that releasing the session does not release the player and the app needs to take care to release the player.

Issue: androidx/media#73
PiperOrigin-RevId: 448454338
2022-05-24 10:43:23 +01:00
ibaker
4ce60968b2 Fix warning about ambiguous @EnsuresNonNull annotation
```
[expression.parameter.name.shadows.field] The postcondition
EnsuresNonNull on the declaration of method 'setContentTimeline'
contains ambiguous identifier 'contentTimeline'. Use
"this.contentTimeline" for the field, or "#1" for the formal parameter.
  private void setContentTimeline(Timeline contentTimeline) {
               ^
```

PiperOrigin-RevId: 448285571
2022-05-24 10:42:20 +01:00
ibaker
25279ad477 Add DefaultMediaSourceFactory.{set,clear}LocalAdInsertionConfig
Deprecate the setAdsLoaderProvider and setAdViewProvider methods these
replace.

PiperOrigin-RevId: 448251423
2022-05-24 10:41:26 +01:00
samrobinson
de33eee6ec Increase test timeout for 4k60 regression test.
Pixel 5 was occasionally reaching the 2 minute limit.

PiperOrigin-RevId: 448244803
2022-05-24 10:40:25 +01:00
tonihei
fe9e6da8a5 Remove network type test restrictions for API 29/30
Network type detection on these API levels couldn't be tested
yet because of a missing Robolectric feature. This was fixed by
the recent Robolectric upgrade and the restrictions can be removed.

This also requires to replicate the platform hack we rely on on
these API levels.

PiperOrigin-RevId: 448240431
2022-05-24 10:39:39 +01:00
claincly
4c34160a96 Add support for static RTP payload types.
Some RTP foramts are statically assigned, so they don't have the rtpmap
attribute. Create the missing rtpmap attribute in this case.

PiperOrigin-RevId: 448239724
2022-05-24 10:38:44 +01:00
huangdarwin
5067a8da0d Transformer GL: Update test name reference.
The prior test does not exist, and is not a pixel test.

PiperOrigin-RevId: 448224929
2022-05-24 10:37:51 +01:00
hmzh
2725b4c479 Adds key functionality for basic MIDI synthesization
- Add a MidiRenderer skeleton with basic playback
- Add MidiDecoder with placeholder synthesizer (JSyn) impl
- Make MidiExtractor feed placeholder data
- Add Renderer extension loaders for MIDI

PiperOrigin-RevId: 448212797
2022-05-24 10:34:45 +01:00
bachinger
9b07d71f66 Remove all handler messages when controller is released
Issue: androidx/media#74
PiperOrigin-RevId: 448205908
2022-05-24 10:33:49 +01:00
hmzh
efb49f285e Refactor MIDI and Flac extractor loaders for deduplication
Add MIDI filetype information for use in the ExtractorsFactory

PiperOrigin-RevId: 447976272
2022-05-24 10:33:06 +01:00
bachinger
1d89c35f7b Add MediaSession.setCustomLayout(List<CommandButton>)
This provides a way for apps to send a custom layout to media3
controllers and legacy controllers by making sure to include custom
actions in the legacy playback state when built in the PlayerWrapper
for broadcasting.

PiperOrigin-RevId: 447967600
2022-05-24 10:30:00 +01:00
samrobinson
d72ffe4ba1 Expose decoder name to analysis files.
PiperOrigin-RevId: 447950623
2022-05-24 10:29:06 +01:00
christosts
1bcabd3450 Session: Misc change from link tag to linkplain
PiperOrigin-RevId: 447939097
2022-05-24 10:28:00 +01:00
samrobinson
8d2597acc6 Force encoding for the on-device regression tests.
transformWithDecodeEncode is now transformWithoutDecodeEncode,
to test the passthrough path.

PiperOrigin-RevId: 447796892
2022-05-24 10:26:19 +01:00
samrobinson
f8f1a4d1ed Expose the codec name to the analysis files.
PiperOrigin-RevId: 447724152
2022-05-10 17:52:05 +01:00
bachinger
4c838043d3 Dispatch custom action in MediaSessionLegacyStub
A custom action sent by legacy controllers as for instance the System UI mini player arrive at MediaSessionCompat.Callback.onCustomAction() and need to be dispatched to the session callback as a such.

PiperOrigin-RevId: 447486859
2022-05-10 17:50:30 +01:00
christosts
7a631f4050 MediaSessionService: define foregroundServiceType
PiperOrigin-RevId: 447467287
2022-05-10 17:49:22 +01:00
ibaker
54d8b5bc7c Don't implement Player.Listener from SubtitleView
We never register SubtitleView as a Player.Listener directly, it's
always done via PlayerView.

PiperOrigin-RevId: 447467037
2022-05-10 17:48:12 +01:00
hschlueter
63dcdf5803 Add listener for FrameProcessingExceptions.
This listener replaces
FrameProcessorChain#getAndRethrowBackgroundExceptions.
The listener uses a new exception type FrameProcessingException
separate from TransformationException as the frame processing
components will be made reusable outside of transformer soon.

PiperOrigin-RevId: 447455746
2022-05-10 17:47:22 +01:00