13875 Commits

Author SHA1 Message Date
bachinger
8c0e8898fb Publish session test modules for the media3 repo
Issue: androidx/media#60
PiperOrigin-RevId: 438028148
2022-04-06 11:23:18 +01:00
hschlueter
d97de5b9f0 Use microseconds not nanoseconds for GlFrameProcessor.
This requires an additional nanos to micros conversion because
the SurfaceTexture uses nanos. But as the timestamps from the
MediaCodec decoder (propagated in DefaultCodec#releaseOutputBuffer) are
in microseconds no precision is lost here.

Also add test that checks output video duration.

PiperOrigin-RevId: 438010490
2022-04-06 11:22:22 +01:00
christosts
2adf0f67d8 Fix NPE in PlayerActivity
PiperOrigin-RevId: 438010395
2022-04-06 11:21:21 +01:00
hschlueter
bd6eaab6b4 Reword MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE javadoc.
MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE was copied from a test
class, but BitmapTestUtil isn't a test. So the javadoc needs
rewording to reflect that.

PiperOrigin-RevId: 438001833
2022-04-06 11:20:17 +01:00
Ian Baker
f48babb4ed Merge pull request #35 from ittiam-systems:rtp-mpeg4
PiperOrigin-RevId: 438000682
2022-04-06 11:19:08 +01:00
hschlueter
808909289c Use @linkplain for link text that doesn't match symbol name.
PiperOrigin-RevId: 437992927
2022-04-06 11:18:03 +01:00
ibaker
9d48cff9ff Remove IntDef warning suppression from DefaultTrackSelector
The problem is not the IntDef array, it's the fact the lint tool
is unable to correctly infer the annotations on the lambda parameters
without them being explicitly annotated. It seems explicitly annotating
is better than suppressing all IntDef warnings in the whole method.

PiperOrigin-RevId: 437969271
2022-04-06 11:17:06 +01:00
ibaker
f722114fc0 Add a Kotlin example for opting-in to the unstable API
PiperOrigin-RevId: 437962027
2022-04-06 11:16:07 +01:00
Ian Baker
e3a9ed6581 Merge pull request #56 from ittiam-systems:rtp_wav
PiperOrigin-RevId: 437783926
2022-04-06 11:14:43 +01:00
ibaker
0096b40b75 More demo app unstable API opt-in and reshuffling
Follow-up to a5330d43d4

PiperOrigin-RevId: 437777871
2022-04-06 11:13:42 +01:00
ibaker
e4556d76a9 Replace Util.SDK_INT with Build.VERSION.SDK_INT in the demo app
Util.SDK_INT will not be part of the stable API. This change only
touches those parts of the main demo app that will not be opted-in to
the unstable API for other reasons (e.g. download use-cases).

PiperOrigin-RevId: 437777687
2022-04-06 11:12:44 +01:00
ibaker
2a2873840d Add PlayerView to the stable API
PiperOrigin-RevId: 437777445
2022-04-06 11:11:54 +01:00
hschlueter
0724e2b99f Check if there is a current context before generating textures/FBOs.
This avoids silent failures where the generated identifiers are 0.

PiperOrigin-RevId: 437775689
2022-04-06 11:10:56 +01:00
andrewlewis
d2a9419ad3 Add support for requesting color transfer to SDR
From Android T onwards `MediaCodec` supports requesting tone-mapping down to
SDR. Add an option to request this behavior and document that it isn't
supported before T. Also add an option in the demo app to try it out.

Tested manually on a prerelease build.

PiperOrigin-RevId: 437765325
2022-04-06 11:10:06 +01:00
andrewlewis
79db98e733 Remove unnecessary initialization
PiperOrigin-RevId: 437753013
2022-04-06 11:09:03 +01:00
hschlueter
827cf51dc9 Check thread name for GL methods.
The thread name is used to verify the thread in both  createOpenGlObjectsAndInitializeFrameProcessors() and processFrame().
Also remove glThread field that was only used for this verification.

PiperOrigin-RevId: 437730804
2022-04-06 11:07:45 +01:00
ibaker
1b52739dfb Switch the demo app from Util.areEqual to Guava's Objects.equals
Util.areEqual will not be part of the stable API.

PiperOrigin-RevId: 437723080
2022-04-06 11:06:45 +01:00
Ian Baker
9f29d22659 Merge pull request #47 from ittiam-systems:rtp-vp8
PiperOrigin-RevId: 437710223
2022-04-06 11:05:54 +01:00
huangdarwin
6858fe9116 Transformer Demo: Add 8k24fps video option.
This can help allow Transformer be more aware of issues in high-res videos.

PiperOrigin-RevId: 437313282
2022-04-06 11:04:52 +01:00
Ian Baker
a11c22b67e Merge pull request #46 from ittiam-systems:rtp_amr
PiperOrigin-RevId: 437274290
2022-04-06 11:03:43 +01:00
ibaker
a5330d43d4 Opt uncontroversial bits of the main demo app into unstable APIs
None of these components/features are planned to be part of the initial
stable API, so these suppressions will need to be in place when we
enable the warnings.

PiperOrigin-RevId: 437256731
2022-04-06 11:02:47 +01:00
hschlueter
92eb09fa6f Fix output viewport size of empty FrameProcessorChain.
Since the output size can be overridden, the viewport should be
ouputWidth/Height and NOT the ExternalCopyFrameProcessor's output size
which matches the input size.

PiperOrigin-RevId: 437256635
2022-04-06 11:01:43 +01:00
aquilescanta
67acfc67de Support seeking in un-intearleaved tracks in Mp4Extractor
A client can pass the id of the track on which they want to seek.

PiperOrigin-RevId: 437248055
2022-04-06 10:59:41 +01:00
Shraddha Basantwani
3f8a68004c Add PCM and G711 Reader Test
Add RtpPcmReader tests and warning for out of
order packets in RtpPcmReader.

Change-Id: I1554fa0a944dad00248a0a41fefad958da073a21
2022-03-28 11:27:32 +05:30
Shraddha Basantwani
500c879b8a Modify RtpPcmReader
Rename a few variable to be more relevant
Add detailed java docs
2022-03-28 11:22:23 +05:30
Shraddha Basantwani
bfc1fb9aa7 Merge branch 'main' of github.com:ittiam-systems/media into rtp_wav 2022-03-28 11:13:21 +05:30
huangdarwin
acacb23ba6 Media: Remove unused CastPlayer values.
PiperOrigin-RevId: 437237835
2022-03-25 14:11:38 +00:00
hschlueter
5f573ad3ad Remove old TODOs and reassign another TODO.
* The AdvancedFrameProcessor calls use() in updateProgramAndDraw().
* The AdvancedFrameProcessor has the same input and output dimensions.

PiperOrigin-RevId: 437231350
2022-03-25 14:10:47 +00:00
ibaker
dc4dbe6a40 Demo: Move DownloadService calls to new method in SampleChooserActivity
This allows the whole startDownloadService() method to be opted into the
unstable media3 API in a follow-up change.

PiperOrigin-RevId: 437228776
2022-03-25 14:09:37 +00:00
hschlueter
0f5686fe07 Allow frame processors to be set on Transformer.Builder.
Also make GlFrameProcessor, ScaleToFitFrameProcessor, and
AdvancedFrameProcessor public.

PiperOrigin-RevId: 437227388
2022-03-25 14:08:41 +00:00
hschlueter
d5056072a8 Check for GL errors after glClear and glDrawArrays.
These methods can cause errors so we should check for them.
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glClear.xml
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glDrawArrays.xml

PiperOrigin-RevId: 437218519
2022-03-25 14:07:49 +00:00
ibaker
be4cbb886b Stabilise DefaultDataSource.Factory, including 2 constructors
This allows apps to customise the HTTP DataSource while still supporting
non-HTTP URIs as well, as documented in our dev guide:
https://exoplayer.dev/network-stacks.html#configuring-exoplayer-to-use-a-specific-network-stack

PiperOrigin-RevId: 437209880
2022-03-25 14:06:58 +00:00
andrewlewis
c87d16ca63 Handle non-standard MIME type on LG AC3 decoder
PiperOrigin-RevId: 437057336
2022-03-25 14:06:06 +00:00
andrewlewis
117456c137 Improve throughput on devices requiring workaround
On some devices, decoding gets stuck when the number of frames pending at the
`SurfaceTexture` is too high. We added a workaround that only allows one frame
to be pending at a time. That fixed the issue, however, based on on-device
testing it seems that it's safe to queue more than one frame.

Add a method that returns a safe estimate of the number of frames that can be
pending at a time, and use this to limit the number of frames that can be
released from the decoder but not processed by the frame processor chain.

PiperOrigin-RevId: 437057075
2022-03-25 14:05:08 +00:00
hschlueter
37559deacf Configure the frame sizes in FrameProcessorChain instead of caller.
Configuring the frame sizes between frame processors is now the
FrameProcessorChain's rather than the caller's responsibility.
The caller can getOutputSize() and override it for encoder fallback
in configure().

PiperOrigin-RevId: 437048436
2022-03-25 14:04:19 +00:00
hschlueter
20daaa20ef Move OpenGL setup to FrameProcessorChain#configure().
The factory method is replaced by a public constructor and
configure() method which configures the input/output surfaces
and handles the OpenGL setup.

This is a prerequisite for removing the responsibility of the
caller to configureSizes() before creating the chain in a follow-up.

PiperOrigin-RevId: 437028882
2022-03-25 14:03:17 +00:00
ibaker
da3cb63c5e Remove exo_legacy_player_view.xml from media3
This is only used by LegacyPlayerView which was removed in
6aa1816bd3

PiperOrigin-RevId: 437018966
2022-03-24 16:54:31 +00:00
ibaker
90d1c6fc33 Tolerate the result of View.getLayoutParams being null
PiperOrigin-RevId: 437017422
2022-03-24 16:47:44 +00:00
ibaker
a11adbc08c Switch the main demo app to use Guava's Preconditions
ExoPlayer's internal Assertions class will not be part of the stable
API.

PiperOrigin-RevId: 437008634
2022-03-24 16:07:42 +00:00
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