9020 Commits

Author SHA1 Message Date
samrobinson
1becb45c62 Clarify variables and improve documentation of SSIM.
PiperOrigin-RevId: 451392021
2022-05-30 17:33:05 +00:00
samrobinson
a96dd2d43e Use updated test name in BUILD and docs.
PiperOrigin-RevId: 451384408
2022-05-30 17:29:11 +00:00
bachinger
74c68b3763 Unconditionally sleep for offload
Unconditionally sleep for offload, if the audio buffer is full.
Previously ExoPlayer would not sleep if the expected wake-up was
in 2s. This was to prevent underrun if the wake-up was delayed.

Experiments have shown that the wakup audio buffer is far more
than 2s (around 1min). Additionally,
the metric was incorrect because it measured both,
AudioTrack + DSP.

Finally, this metric was erroneous after a gapless transition,
when the head position would reset to 0 and thus the computed
delay until next wakeup was too large.

PiperOrigin-RevId: 451383701
2022-05-30 17:25:45 +00:00
hschlueter
6b521b2952 Use video passthrough if clipping starts at key frame.
PiperOrigin-RevId: 451380267
2022-05-30 17:22:16 +00:00
hschlueter
89e239eed1 Expand SSIM skipping to all Nexus API 21 devices.
PiperOrigin-RevId: 451371681
2022-05-30 17:18:46 +00:00
huangdarwin
14fc3179fb Transformer: Skip SSIM in tests when fallback is applied.
SSIM calculation requires the input and output dimensions to be identical.

For devices that can't encode the input dimensions, skip SSIM calculations and
log the cause. Only apply this on tests where the encoder may not support the
input file dimensions.

PiperOrigin-RevId: 451364904
2022-05-30 17:15:25 +00:00
hschlueter
541460a01d Fix handling clipping in transformer renderers.
Decode-only video frames (needed when the frame at / first frame after the
clipping start is not a key frame) need to be decoded but not passed to
the frame processor chain or encoder.

The clipping start offset needs to be removed from the frame timestamps
in the passthrough and video pipelines.
There are no changes needed for this in the audio pipeline, as it doesn't
use the input timestamps -- it uses its own timestamps derived from the
buffer sizes instead.

Also add demo option to try this out.

#minor-release

PiperOrigin-RevId: 451353609
2022-05-30 17:11:57 +00:00
hschlueter
bc1ec9de1f Replace frame processor with texture processor in TODO comment.
PiperOrigin-RevId: 451142799
2022-05-30 17:04:38 +00:00
hschlueter
d37cf34131 Rename GlFrameProcessor to SingleFrameGlTextureProcessor.
Also update names of implementations to match design doc.
In follow-ups, SingleFrameGlTextureProcessor will become
an abstract implementation of a new GlTextureProcessor
interface.

Texture processor makes sense as it processes OpenGL textures.
The term frame processor will be used for something else in
follow-ups.

PiperOrigin-RevId: 451142085
2022-05-30 17:01:17 +00:00
ibaker
53b44524cd Fix typos flagged by lint
PiperOrigin-RevId: 451135097
2022-05-26 13:11:16 +00:00
ibaker
b8769b2717 Fix some inconsistencies in the MediaItem API
* Rename (via deprecation)
  `MediaItem.DrmConfiguration.Builder#forceSessionsForAudioAndVideoTracks`
  to `setForceSessionsForAudioAndVideoTracks`. This is more consistent
  with existing 'force' method names both in this class and in
  `TrackSelectionParameters.Builder`.
* Add missing `@Nullable` annotation to the parameter for
  `MediaItem.SubtitleConfiguration.Builder#setMimeType`. This annotation
  is already present on the `MediaItem.SubtitleConfiguration#mimeType`
  field that this setter corresponds to.

PiperOrigin-RevId: 450941336
2022-05-26 13:07:37 +00:00
hschlueter
2b4642f663 Skip SSIM calculation on Nexus 5 API 21.
There is a problem with the ImageReader formats used by the
SSIM helper that only occurs for Nexus 5 API 21, so as a workaround
we can skip the SSIM calculation on Nexus 5 API 21.

This skips just the SSIM calculation (by setting the value to
1.0 instead and logging). The tests still run when SSIM is skipped
so that we can detect other failures.

PiperOrigin-RevId: 450903183
2022-05-26 13:04:03 +00:00
hschlueter
52ad75c0a4 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 13:00:27 +00:00
ibaker
74653838ad 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 12:56:51 +00:00
hschlueter
066327daf9 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 12:49:39 +00:00
tonihei
9c5bc56df1 Wrap TelephonyCallback in nested class to avoid class loading issues.
PiperOrigin-RevId: 450643824
2022-05-26 12:46:13 +00:00
hschlueter
ccd61b1c1f 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
ecea2b9e90 Rollback of e705999cf3
*** Original commit ***

Rollback of 57182ac7bd

*** 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
3c9b0b9b61 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
ffb75d746c Skip performance tests if device is not capable.
PiperOrigin-RevId: 450427828
2022-05-23 14:54:02 +01:00
ibaker
e39a324b19 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
274f3a13a2 Rollback of 57182ac7bd32db54d11fd41e21338a2bbfaf043c
*** 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
ibaker
dc6cc4550e 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 57182ac7bd

PiperOrigin-RevId: 450395941
2022-05-24 12:20:20 +01:00
ibaker
57182ac7bd 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 12:16:55 +01:00
tonihei
48a0301bf5 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 12:13:33 +01:00
ibaker
bbb6d8f049 Use @C.DataType intdef in HlsDataSourceFactory.createDataSource
PiperOrigin-RevId: 449973324
2022-05-24 12:06:31 +01:00
ibaker
685761b05b Fix comment in MediaCodecRenderer
This constant name was updated in 1bcf1cf9f7

PiperOrigin-RevId: 449969093
2022-05-24 12:03:03 +01:00
andrewlewis
7ef65b69d6 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:59:37 +01:00
rohks
75dc0e26c5 Migrate leaf listeners of Player to new onCues override
PiperOrigin-RevId: 449587030
2022-05-24 11:55:09 +01:00
samrobinson
97331a612a 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 11:51:41 +01:00
ibaker
aef2f154a7 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 11:44:55 +01:00
tonihei
e9d5381b54 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 11:41:34 +01:00
andrewlewis
b3dc32d7fb Tidy releasing FrameProcessorChain
PiperOrigin-RevId: 449238525
2022-05-24 11:37:08 +01:00
rohks
a27b5398a8 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 11:27:01 +01:00
andrewlewis
b2f46fabf7 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 11:23:33 +01:00
tonihei
463603049e 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 11:16:39 +01:00
Ian Baker
f28f8026ff Merge pull request #64 from ittiam-systems:rtp-vp9
PiperOrigin-RevId: 448978892
2022-05-24 11:13:17 +01:00
tonihei
daa4c1c0a6 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 11:09:21 +01:00
hschlueter
df1b733d50 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 11:05:59 +01:00
ibaker
938728ce00 Add DefaultMediaSourceFactory.{set,clear}LocalAdInsertionConfig
Deprecate the setAdsLoaderProvider and setAdViewProvider methods these
replace.

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

PiperOrigin-RevId: 448244803
2022-05-24 10:55:20 +01:00
tonihei
3eb6f0e806 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:51:54 +01:00
claincly
010a00e458 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:48:29 +01:00
huangdarwin
dd365cbeb8 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:44:55 +01:00
hmzh
0948fd1cd8 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:41:20 +01:00
hmzh
dce0db35f1 Refactor MIDI and Flac extractor loaders for deduplication
Add MIDI filetype information for use in the ExtractorsFactory

PiperOrigin-RevId: 447976272
2022-05-24 10:37:39 +01:00
samrobinson
d254967a85 Expose decoder name to analysis files.
PiperOrigin-RevId: 447950623
2022-05-24 10:34:20 +01:00
samrobinson
271cdbed35 Force encoding for the on-device regression tests.
transformWithDecodeEncode is now transformWithoutDecodeEncode,
to test the passthrough path.

PiperOrigin-RevId: 447796892
2022-05-24 10:30:55 +01:00
samrobinson
6ac1306ec2 Expose the codec name to the analysis files.
PiperOrigin-RevId: 447724152
2022-05-10 15:08:51 +01:00
ibaker
06d73e93e6 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-09 15:45:54 +01:00