13824 Commits

Author SHA1 Message Date
huangdarwin
2a363ac3fc Transformer: Always use FrameProcessorChain when decoding.
This allows us to bypass many device-specific issues, that only occur when
decoding directly to an encoder surface, without OpenGL. This also allows us
to maintain fewer code branches, which require additional testing to verify
correctness.

PiperOrigin-RevId: 437003138
2022-03-24 15:42:12 +00:00
aquilescanta
e8b0971f12 Simplify nullability in Mp4Extractor
PiperOrigin-RevId: 437002406
2022-03-24 15:38:20 +00:00
ibaker
c83a28f260 Remove references to deprecated DefaultDataSourceFactory from dev guide
#minor-release

PiperOrigin-RevId: 436997521
2022-03-24 15:13:09 +00:00
aquilescanta
7db0d91dd9 Add maxNumRefFrames to NalUnitUtil
Needed for AVI support.

PiperOrigin-RevId: 436991922
2022-03-24 14:41:28 +00:00
huangdarwin
5bc94da16a FrameProcessor: Create PresentationFrameProcessor.
Allow apps to modify how frames are presented, via modifying resolution.

A follow-up CL will provide aspect ratio, cropping, etc.

PiperOrigin-RevId: 436963312
2022-03-24 11:42:05 +00:00
hschlueter
c5e8503e2c Increase test frame processing wait time.
PiperOrigin-RevId: 436961627
2022-03-24 11:29:52 +00:00
olly
ea2fbfd0a1 Suppress new nullness warnings when stub for View.getLayoutParams is added.
I am suppressing these warnings so that the stub file can be added and future usages will be checked correctly. As noted in https://developer.android.com/reference/android/view/View#getLayoutParams() this can be null before params are set. This was produced by running the TGP on <unknown commit>.

More information: go/new-nullness-stubs-lsc

Tested:
    Automated deflaking failed to skip failures:  http://mondo/deflaker/run/ff55923b-d76d-4eba-86dc-1b3077362352
    http://test/OCL:435678706:BASE:436509228:1647985874385:4fae6f0a
    Some test failures are present, but the CL author has decided to mail the change anyway
PiperOrigin-RevId: 436951684
2022-03-24 10:15:13 +00:00
olly
76928738f3 Fix 11 ErrorProneStyle findings:
* These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them
  (see http://go/bugpattern/UnnecessaryParentheses) (11 times)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if there's an issue with the CL content.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/media/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/media/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 436726763
2022-03-23 13:55:36 +00:00
hschlueter
831866f441 Add javadoc for more FrameProcessorChain fields.
PiperOrigin-RevId: 436723149
2022-03-23 13:36:22 +00:00
samrobinson
76d44bec30 Remove SSIM calculation on SEF videos.
SEF is similar to frame editing, where the input and output videos are
not intended to match, so SSIM will not provide a reliable value. To
check SSIM correctly in future, we would need to provide
golden/expected video files to compare output against.

PiperOrigin-RevId: 436707240
2022-03-23 11:56:30 +00:00
hschlueter
bda6604757 Remove FrameEditor reference.
PiperOrigin-RevId: 436702840
2022-03-23 11:25:58 +00:00
ibaker
fe8996e634 Allow stable API users to customise the DataSource used
Also stabilise the 3 HTTP-based DataSource implementations:
* DefaultHttpDataSource
* OkHttpDataSource
* CronetDataSource

PiperOrigin-RevId: 436690643
2022-03-23 10:05:27 +00:00
ibaker
534bc5ad9d Deprecate DefaultDrmSessionManager#setDrmUserAgent
PiperOrigin-RevId: 436521418
2022-03-22 18:13:26 +00:00
ibaker
079e79540d Switch demo apps from HttpDataSource to DataSource
All the (Http)DataSource interactions can be done with the DataSource
interface and don't need HttpDataSource.

PiperOrigin-RevId: 436521036
2022-03-22 18:12:00 +00:00
ibaker
54d3e45473 Switch DRM and download components from HttpDataSource to DataSource
All the (Http)DataSource interactions can be done with the DataSource
interface and don't need HttpDataSource.

PiperOrigin-RevId: 436520898
2022-03-22 18:11:31 +00:00
claincly
d57958e86d Remove dependency of Robolectric snapshot.
Depend on a alpha release now, so that we can remove the snapshot repo.

PiperOrigin-RevId: 436471634
2022-03-22 14:49:12 +00:00
andrewlewis
89098a8a83 Remove analysis error suppression
PiperOrigin-RevId: 436470453
2022-03-22 14:42:02 +00:00
hschlueter
e14b8b0c6e Remove unnecessary 'final' from local variables.
PiperOrigin-RevId: 436469107
2022-03-22 14:35:19 +00:00
hschlueter
ecfbc65a0d Convert FrameEditor to a FrameProcessorChain.
The FrameProcessorChain manages a List<GlFrameProcessor>.
FrameProcessorChainDataProcessingTest now tests chaining ScaleToFit-
and AdvancedFrameProcessors.

PiperOrigin-RevId: 436468037
2022-03-22 14:29:53 +00:00
aquilescanta
5b4abc31f3 Group NAL type constants in NalUnitUtil
To be shared with AviExtractor in a later CL.

PiperOrigin-RevId: 436430385
2022-03-22 10:32:35 +00:00
huangdarwin
57953d8947 FrameProcessor: Make a class member private final.
PiperOrigin-RevId: 436211808
2022-03-21 15:21:17 +00:00
samrobinson
a60e5f597b Force video encoding if VideoEncoderSettings are not default.
Add a MH test exercising this behaviour.

PiperOrigin-RevId: 436177198
2022-03-21 12:16:50 +00:00
huangdarwin
2a14e3c604 FrameProcessor: Add a ScaleToFitFrameProcessor builder.
This allows us to input scale and rotation in an easier-to-use manner.

PiperOrigin-RevId: 436175982
2022-03-21 12:08:18 +00:00
bachinger
ea67fbbb9a Correct order of parameters when creating PositionInfo
PiperOrigin-RevId: 436174782
2022-03-21 12:01:53 +00:00
andrewlewis
0292f82ddf Fix end of stream detection for SSIM helper
PiperOrigin-RevId: 436165237
2022-03-21 11:00:21 +00:00
andrewlewis
9e62ea3fca Move image buffer extraction to test thread
This also ensures that if there's an error reading the image data then this
gets surfaced as an analysis exception.

PiperOrigin-RevId: 435680785
2022-03-18 17:55:26 +00:00
claincly
12543a9682 Split method findEncoderWithClosestFormatSupport.
Add checking for bitrate mode settings.
Add logging to the encoder filtering.

PiperOrigin-RevId: 435662418
2022-03-18 16:43:26 +00:00
andrewlewis
db0093f4c8 Remove AMR NB encoding from SSIM quality test
This currently causes the test to fail on Pixel 6 Pro running a recent S build
SQ1D.220205.004.

There is no need to test audio transcoding while we are measuring video
quality.

PiperOrigin-RevId: 435635314
2022-03-18 14:42:49 +00:00
hschlueter
96f8771de0 Always use FrameEditor for Nexus 5 and Moto Z Play.
PiperOrigin-RevId: 435628703
2022-03-18 14:10:07 +00:00
claincly
e476337dd5 Add encoding options.
PiperOrigin-RevId: 435398814
2022-03-17 18:22:42 +00:00
huangdarwin
481b9bd63d Transformer: Split javadoc summary fragment and descriptive text.
PiperOrigin-RevId: 435368283
2022-03-17 16:33:35 +00:00
bachinger
3848595377 Remove rounding errors of ad durations when converting from double
#minor-release

PiperOrigin-RevId: 435360232
2022-03-17 16:02:00 +00:00
christosts
c016978a6c Hide media notification when nothing to play
With this change, the MediaNotificationManager stops MediaSessionService
and hides any notifications if the player has no media items or the
player hasn't been prepared yet.

PiperOrigin-RevId: 435349363
2022-03-17 15:13:46 +00:00
olly
5d8ac644a6 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
hschlueter
c74b16e9f4 Add missing exception checks after EGL14 calls in GlUtil.
PiperOrigin-RevId: 435308470
2022-03-17 11:23:46 +00:00
hschlueter
b2b27dc571 Fix FrameEditor intermediate texture size.
ExternalCopyFrameProcessor's output dimensions match the input
size not the output size. So the intermediate texture size
should match the input size.

Also rename configureOutputDimensions to configureOutputSize.

PiperOrigin-RevId: 435058789
2022-03-16 15:36:06 +00:00
olly
845b55d230 Migrate from strongly discouraged @Test(expected = ...) to assertThrows(...).
More info: go/lsc-assertthrows and go/assertthrows

NOTE: if the source of truth for this code is _NOT_ `//third_party/`, please ask for this CL to be reverted.

Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:434925976:BASE:434869111:1647399186064:de338189
PiperOrigin-RevId: 435047509
2022-03-16 14:46:13 +00:00
claincly
191629ed7c Making mediaCodecName @NonNull in DefaultCodec constructor.
PiperOrigin-RevId: 435045138
2022-03-16 14:34:52 +00:00
aquilescanta
1a6e176873 Rework if condition to avoid NewApi lint error
Some infra thinks the if does not protect against API incompatibilities
(example: Android's soong build system). AndroidStudio 2021.3.1 also
signals a warning.

#minor-release

PiperOrigin-RevId: 435027073
2022-03-16 13:01:35 +00:00
claincly
1b3838cb0e Add test for DefaultEncoderFactory.
PiperOrigin-RevId: 435009545
2022-03-16 11:10:06 +00:00
olly
298e61398e Improve EventLogger metadata logging
1. Fix indentation
2. Fix intention to only log one Metadata block

PiperOrigin-RevId: 434818209
2022-03-15 19:02:41 +00:00
huangdarwin
03c02b8b5d Transformer: Use Size for output dimensions.
Use android.util.Size, whose naming is much easier to understand than Pair<Integer, Integer>, in both FrameProcessor and EncoderUtil.

PiperOrigin-RevId: 434813986
2022-03-15 18:48:25 +00:00
samrobinson
fb03db8108 Add analysisException field to TransformationTestResult new Builder.
Having this in place means that analysis exceptions can be swallowed
or thrown as needed.

PiperOrigin-RevId: 434788802
2022-03-15 17:26:52 +00:00
huangdarwin
72aca58286 Transformer GL: Split out ScaleToFit and Advanced GlFrameProcessors
* Move auto-adjustments for transformation matrices from the
  VideoTranscodingSamplePipeline constructor to the new
  ScaleToFitFrameProcessor.
* Add GlFrameProcessor#getOutputDimensions() to allow for GlFrameProcessors with
  different input and output dimensions. This is a prerequisite for
  Presentation.
* Tested with unit tests (and manually just in case).
* A follow up CL will implement change the FrameProcessor input to be scale and
  rotate values as requested by the user. This was kept out of this CL to
  reduce CL review size. Presentation will also be implemented in a follow up
  CL.

PiperOrigin-RevId: 434774854
2022-03-15 16:36:52 +00:00
huangdarwin
628a8dd4fc Transformer: Add javadoc to VideoTranscodingSamplePipeline.
As pointed out in a previous review, createFallbackTransformationRequest
can be a bit confusing to parse.

Added javadocs and renamed parameters appropriately, to make it slightly
more easy to understand.

PiperOrigin-RevId: 434733313
2022-03-15 13:24:28 +00:00
olly
29fb77ea3a Rollback of 98e039d872
*** Original commit ***

Rollback of aa22bc2dbe

*** Original commit ***

Fix PlayerView touch handling

Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClick...

***

PiperOrigin-RevId: 434502423
2022-03-14 17:29:56 +00:00
aquilescanta
06da55527f Force CMake version 3.21.0+ for the FFMPEG extension
Issue: google/ExoPlayer#9933
#minor-release
PiperOrigin-RevId: 434449816
2022-03-14 13:42:31 +00:00
hschlueter
682a5ca77b Clarify GlProgram parameter name.
PiperOrigin-RevId: 434441008
2022-03-14 12:52:16 +00:00
ibaker
fb88a4fbe7 Fix stale javadoc in DashUtil
The type of this parameter was changed when it was moved from
OfflineLicenseHelper to DashUtil in
98f4fb85c2

PiperOrigin-RevId: 433770325
2022-03-10 17:15:49 +00:00
hschlueter
0e98c044da Move inputTexId parameter to GlFrameProcessor#initialize().
This parameter will not change between frames in the near
future.

PiperOrigin-RevId: 433765986
2022-03-24 17:24:14 +00:00