14284 Commits

Author SHA1 Message Date
claincly
564dc11f28 Add device capability based test skipping.
Change test name prefix from `transform` to `transcode` for consistency.

PiperOrigin-RevId: 445106224
2022-05-09 10:25:07 +01:00
olly
a16c0b3068 Reading AV1 initialization data.
We add an entire class like we do for parsing other codec initialization formats; it's currently not doing any parsing though (... initialization data is really simple for AV1 though: just the entire contents of the box).

For testing, we add the sample file, having been re-encoded with ffmpeg (and we also happen to have another av1 file, too).

PiperOrigin-RevId: 444890282
2022-05-09 10:24:18 +01:00
hschlueter
6312cfb221 Fix PeriodicVignetteFrameProcessor javadoc.
The parameter was removed in a previous CL but wasn't removed
from the javadoc yet.

PiperOrigin-RevId: 444879675
2022-05-09 10:23:30 +01:00
bachinger
1e251b3be7 Fix incorrect JavaDoc
PiperOrigin-RevId: 444874326
2022-05-09 10:22:32 +01:00
ibaker
fd6b57469d Fix calculations that may lose precision compared to their target type
PiperOrigin-RevId: 444861268
2022-05-09 10:21:44 +01:00
claincly
7af91fc9d5 Ignore mandatory SDP fields as ExoPlayer doesn't use them
Issue: google/ExoPlayer#10049
PiperOrigin-RevId: 444833508
2022-05-09 10:20:38 +01:00
ibaker
e414f0d2ac Clean up Util.inferContentType methods
This fixes some small niggles:
1. `inferContentType(String)` is documented to take a path, but in the
   tests we're passing full URIs.
2. A `String` parameter is usually a path, but also a MIME type or an
   extension. In the new methods, the meaning of a `String` parameter
   is always clear from the name of the method.
3. `inferContentType(String)` is always passed an extension in
   'production' code (which has to be manually prefixed with a dot).
4. `inferContentType(Uri, @Nullable String)` always ignores the Uri if
   the String is non-null. IMO this logic is clearer to a reader if it's
   just in-lined at the call-site.

These methods are used from the demo apps, so will be part of the stable
API.

PiperOrigin-RevId: 444826053
2022-05-09 10:19:01 +01:00
Ian Baker
2898d41f4a Merge pull request #9967 from jruesga:cea708-handle-multiple-service-blocks
PiperOrigin-RevId: 444816821
2022-05-09 10:18:14 +01:00
huangdarwin
4cf1207c0c Transformer Demo: Add video with pixelWidthHeightRatio != 1.
This can allow apps to test and demonstrate support for videos with
pixelWidthHeightRatio != 1.

PiperOrigin-RevId: 444815182
2022-05-09 10:17:19 +01:00
bachinger
dee83cc7db Update session position info on timeline change
This fixes an inconsistent state of the `PlayerInfo` when the index of the playing
media item is changed by a playlist modification. In this inconsistent state,
calling `Playerinfo.getCurrentMediaItem` can produce an
`ArrayIndexOutOfBoundException` (see stack trace in GH issue).

This change takes the following measurements:

- always update sessionPosition and timeline of the PlayerInfo together in
  `MediaSessionImpl.PlayerListener` where the PlayerInfo originates from
- add an assertion to avoid building a `PlayerInfo` instance in an inconsistent
  state
- reduce the window of opportunity for concurrent access to
  `mediaSessionImpl.playerInfo` when dispatching player info changes in
  `MediaSessionImpl`

Issue: androidx/media#51
PiperOrigin-RevId: 444812661
2022-05-09 10:16:33 +01:00
Ian Baker
9369348d6f Merge pull request #10150 from egor-n:dev-v2-8435-outlinecolour
PiperOrigin-RevId: 444787307
2022-05-09 10:15:05 +01:00
Ian Baker
9e7c8380c2 Merge pull request #10214 from cedricxperi:dev-v2
PiperOrigin-RevId: 444585404
2022-05-09 10:14:11 +01:00
huangdarwin
f269963e89 Transformer GL: Add support for pixelWidthHeightRatio.
To ensure frame processor operations operate on square pixels,
make the frame taller or wider for non-square input pixels.

In addition to automated tests, this was tested by changing the
inputFormat.pixelWidthHeightRatio in the TransformerVideoRenderer.

PiperOrigin-RevId: 444553517
2022-05-09 10:11:18 +01:00
bachinger
de871ea273 Some fixes/cleanup in MediaControllerImplLegacy
PiperOrigin-RevId: 444542725
2022-05-09 10:10:27 +01:00
bachinger
6708b43bfb Fix incorrect format variable
PiperOrigin-RevId: 444530943
2022-04-26 13:30:27 +01:00
huangdarwin
22c9b8168d Transformer: remove unused bitmap test option.
Remove unused saveTestBitmapToCacheDirectory throwOnFailure option.

#cleanup

PiperOrigin-RevId: 444516857
2022-04-26 12:05:30 +01:00
huangdarwin
3cf7f58edf Transformer GL: save actual bitmap before checking pixel diffs.
This allows the actual bitmap to be saved, even if output
dimensions are different than expected. Otherwise, differing
output dimensions would throw an exception, preventing the bitmap
from being saved.

PiperOrigin-RevId: 444512210
2022-04-26 11:37:03 +01:00
samrobinson
c87d03e78e Add 30 second high motion clips to AndroidTestUtil.
30 second clips at higher resolutions are useful for testing encoder
behaviour compared to shorter clips.

PiperOrigin-RevId: 444505865
2022-04-26 10:59:07 +01:00
samrobinson
d194ba93ac Revert of a29206d891193fc7efa312edd551e8e4ee5729b0
PiperOrigin-RevId: 444347415
2022-04-25 20:59:35 +01:00
samrobinson
f0b34b8f4c Rollback of 8a4168271d
*** Original commit ***

Keep AudioTrack on flush as default

***

PiperOrigin-RevId: 444327724
2022-04-25 19:38:07 +01:00
samrobinson
b816a3fe21 Keep AudioTrack on flush as default
PiperOrigin-RevId: 444264961
2022-04-25 15:38:36 +01:00
huangdarwin
f1cda5fe2a FrameProcessor: Avoid early rounding in Presentation output dimensions.
PiperOrigin-RevId: 444253425
2022-04-25 14:38:17 +01:00
bachinger
bf16273350 Remove unused field lastPlayerInfo
PiperOrigin-RevId: 444247251
2022-04-25 14:05:08 +01:00
ibaker
b7a41519e6 Fix warning about potential integer overflow in DefaultAudioSink
PiperOrigin-RevId: 444221415
2022-04-26 15:05:24 +01:00
hschlueter
02743456a0 Use last frame processor to draw on debug surface view.
The last frame processor could use a different drawing command
than a four vertex triangle strip. So we need call its drawing
method again instead of assuming the shape.

PiperOrigin-RevId: 444217274
2022-04-26 15:04:33 +01:00
huangdarwin
36d190bb66 Transformer GL: Avoid no-op ScaleToFit / Presentation FrameProcessors
Avoid no-op FrameProcessors in VideoTranscodingSamplePipeline, to avoid
creating resources for and executing GL for a no-op vertex+fragment shader.

EncoderCompatibilityFrameProcessor will still always be exercised.

PiperOrigin-RevId: 443675833
2022-04-26 15:03:22 +01:00
claincly
59ced5325c Catch unchecked exception in RtspSessionTiming parsing.
Issue: google/ExoPlayer#10165
#minor-release
PiperOrigin-RevId: 443653894
2022-04-26 15:01:29 +01:00
andrewlewis
c8744ee9bd Add an SSIM test with 360p input
This test should run on all devices from API 21 (the media uses Baseline
profile level 3.0 H.264) to give us coverage of the full pipeline (forcing
re-encoding) and SSIM calculation on all devices.

PiperOrigin-RevId: 443650002
2022-04-26 15:00:34 +01:00
andrewlewis
0a378a4555 Fix encoder configuration before API 25
Float I-frame intervals are only supported from API 25 onwards (see https://developer.android.com/reference/android/media/MediaFormat#KEY_I_FRAME_INTERVAL).

Setting a null value for profile/level can cause a native crash when configuring the decoder.

PiperOrigin-RevId: 443647924
2022-04-26 14:59:44 +01:00
claincly
f9bce2a6b6 Remove a completed TODO item
PiperOrigin-RevId: 443620931
2022-04-26 14:58:37 +01:00
huangdarwin
3cfdfb41c6 FrameProcessor: Create EncoderCompatibilityFrameProcessor.
Split rotationDegrees changes to EncoderCompatibilityFrameProcessor, a new
FrameProcessor.

This removes automatic rotationDegrees adjustments from Presentation, which
allows Presentation to be used for changes before the end of a
FrameProcessorChain pipeline.

PiperOrigin-RevId: 443387226
2022-04-26 14:57:40 +01:00
claincly
16b0cee0b6 Fix Basic authentication header
Issue: google/ExoPlayer#9544

The header must include the word "Basic", but the word is missing.

#minor-release

PiperOrigin-RevId: 443386880
2022-04-26 14:56:38 +01:00
andrewlewis
27c1876c9f Expand Samsung/1+ workaround to API 31 + 32
The issue with decoding getting stuck is still reproducible on `samsung/beyond1lteeea/beyond1:12/SP1A.210812.016/G973FXXUEGULB:user/release-keys`.

PiperOrigin-RevId: 443368546
2022-04-26 14:55:39 +01:00
samrobinson
a29206d891 Align MediaCodec and Decoder AudioRenderer onDisabled logic.
PiperOrigin-RevId: 443156130
2022-04-26 14:54:29 +01:00
hschlueter
6939464f91 Don't use API 26 SurfaceTexture constructor in frame processor tests.
After this change the test will use EGL_NO_SURFACE or a pixel buffer surface if using no surface is not supported.

PiperOrigin-RevId: 443113794
2022-04-26 14:53:31 +01:00
claincly
f903e4a9f8 Apply resolution fix.
Some devices under report their resolution support, like 2144 for 2160 in
H265, 1072 for 1080 in H264. This CL only takes care of these two cases,

- reporting 1920x1080 is supported when the device reports 1920x1072, and
- reporting 3840x2160 is supported when the device reports 3840x2144

PiperOrigin-RevId: 443095042
2022-04-26 14:50:35 +01:00
christosts
63052e1a7c DownloadHelper: propagate errors to callback
When downlading an adaptive asset, if an ExoPlaybackException happens
during track selection, the player raises an
UnsupportedOperationException which is not handled gracefully and can
crash the app main thread.

This change catches the error and forwards it to
DownloadHelper.Callback.onPrepareError() as an IOException.

PiperOrigin-RevId: 443015332
2022-04-26 14:49:38 +01:00
samrobinson
d1f8e96d9c Add 4 different video resolutions for bitrate analysis.
PiperOrigin-RevId: 442844189
2022-04-26 14:48:20 +01:00
huangdarwin
7f7e84bee3 FrameProcessor: Improve PresentationFrameProcessor javadocs.
PiperOrigin-RevId: 442835160
2022-04-26 14:47:21 +01:00
hschlueter
5248bbb882 Add context param to GlFrameProcessor initialize().
PiperOrigin-RevId: 442826391
2022-04-26 14:46:24 +01:00
hschlueter
afa551ab8f Block until FrameProcessorChain is released.
This is safer because it will prevent any future problems with
creating a new FrameProcessorChain before the previous one has
completed its async release.

From [eglDestroyContext documentation](https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglDestroyContext.xhtml):
"If the EGL rendering context is not current to any thread,
eglDestroyContext destroys it immediately."
The context isn't current to any thread here because GlUtil calls
eglMakeCurrent with EGL_NO_CONTEXT before calling eglDestroyContext.
So everthing should be released once the FrameProcessorChain's
release task terminates.

PiperOrigin-RevId: 442807484
2022-04-26 14:45:31 +01:00
claincly
7a67609561 Add checks for device capability in tests.
PiperOrigin-RevId: 442751310
2022-04-26 14:42:31 +01:00
ibaker
5186798db9 Rename Player.COMMAND_GET_TRACK_INFOS to COMMAND_GET_TRACKS
`Player.getCurrentTracksInfo` was renamed to `Player.getCurrentTracks` in
83daa052cb.

PiperOrigin-RevId: 441825078
2022-04-26 14:41:41 +01:00
huangdarwin
3f4d03e731 FrameProcessor: Add checks to ensure width and height are positive.
Negative and zero values should be disallowed.

PiperOrigin-RevId: 441757246
2022-04-26 14:39:29 +01:00
huangdarwin
d629e45cfa Transformer Demo: Add short test video
Add a very short (1 second) video, so that some manual tests / prototyping,
including tests for the start and end of a video, encoder selection, or
changes applied to frames, can finish quickly.

PiperOrigin-RevId: 441756901
2022-04-26 14:38:36 +01:00
olly
d9f0c2c071 Tracks.Group/TrackGroup variable naming disambiguation
PiperOrigin-RevId: 441712166
2022-04-26 14:37:35 +01:00
huangdarwin
29e32540de FrameProcessor: Move test bitmaps to a separate directory.
* Group what's now many related test PNGs by moving them to their own directory.
* Move bitmap references to files where they're used, as each bitmap is only
used once each, except the original bitmap.

PiperOrigin-RevId: 441485489
2022-04-26 14:36:31 +01:00
hschlueter
22e016e851 Clarify TransformationRequest setResolution javadoc.
Scaling and rotation using ScaleToFitFrameProcessor may change the
the resolution and aspect ratio, so defaulting to the same as the
input is no longer accurate.

PiperOrigin-RevId: 441463349
2022-04-26 14:35:12 +01:00
hschlueter
f25c912c72 Rename GlFrameProcessor updateProgramAndDraw to drawFrame.
What a minimal implementation should include is now explained in the
interface javadoc while the method name reflects what the method does.

PiperOrigin-RevId: 441432059
2022-04-26 14:34:11 +01:00
christosts
d152fc2ac1 Upgrade compileSdkVersion to 32 (Android 12L)
PiperOrigin-RevId: 441424063
2022-04-26 14:33:16 +01:00