14116 Commits

Author SHA1 Message Date
olly
200ee68479 Reading average and peak bitrates from esds boxes.
This provides better compatibility with MediaExtractor, which does read these fields; we also need them for being able to mux file contents into another mp4 file.

Also, there is a minor refactor included so that we have an actual type for esds box contents instead of a pair.

PiperOrigin-RevId: 438673825
2022-04-07 16:14:43 +01:00
olly
72846c4ff9 Decrease polling rate for IMA Video Ads from 100ms to 200ms
PiperOrigin-RevId: 438634901
2022-04-07 16:11:13 +01:00
claincly
30189f70df Move a commonly used encoder factory mode to util.
The encoder factory will be used in other tests.

PiperOrigin-RevId: 438552381
2022-04-07 16:04:28 +01:00
ibaker
57a937d72a Deduplicate the network-stacks and customization dev guide pages
PiperOrigin-RevId: 438547078
2022-04-07 16:00:58 +01:00
hschlueter
36376eb941 Split configureOutputSize into setInputSize and getOutputSize.
This makes it easier (smaller CL diff) to merge output size
configuration and initialize() in a follow-up.

PiperOrigin-RevId: 438543247
2022-04-07 15:57:30 +01:00
samrobinson
ef99d28a48 Re-use test runner in each loop of RepeatedTranscodeTransformationTest
PiperOrigin-RevId: 438542239
2022-04-07 15:54:04 +01:00
hschlueter
491de6991a Use placeholder surface to configure OpenGL and frame processors.
The placeholder surface is either EGL_NO_SURFACE or a 1x1 pbuffer
depending on whether the device supports EGL_KHR_surfaceless_context.

PiperOrigin-RevId: 438541846
2022-04-07 15:50:44 +01:00
hschlueter
775681c4eb glClear in FrameProcessorChain so the GlFrameProcessors don't have to.
Since the output textures and surfaces are managed by the
FrameProcessorChain, clearing them there makes sense.
This is also less error-prone as it might not be obvious to
someone implementing a GlFrameProcessor that they need to
glClear. (Clearing twice won't cause any problems.)

PiperOrigin-RevId: 438532247
2022-04-07 15:47:15 +01:00
hschlueter
33373d0d0a Fix non-inclusive language in class names.
https://source.android.com/setup/contribute/respectful-code#term-examples

PiperOrigin-RevId: 438335305
2022-04-07 15:40:24 +01:00
christosts
8038a53a64 Fallback to chunkful preparation if CODECS does not contain audio
Issue: google/ExoPlayer#10065

#minor-release

PiperOrigin-RevId: 438281023
2022-04-07 15:37:05 +01:00
samrobinson
5a43263782 Move Json helper methods to AndroidTestUtil.
PiperOrigin-RevId: 438253138
2022-04-07 15:33:39 +01:00
samrobinson
082c039b50 Add support for analyzing bitrates across devices.
Allows for input values to be propagated to the analysis file.

PiperOrigin-RevId: 438030322
2022-04-07 15:30:09 +01:00
hschlueter
d4a9e3d966 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-07 15:23:24 +01:00
christosts
d0d0935f3f Fix NPE in PlayerActivity
PiperOrigin-RevId: 438010395
2022-04-07 15:19:59 +01:00
hschlueter
d609a7ffda 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-07 15:16:32 +01:00
Ian Baker
349c72aba7 Merge pull request #35 from ittiam-systems:rtp-mpeg4
PiperOrigin-RevId: 438000682
2022-04-07 15:13:10 +01:00
hschlueter
990d5ccf4d Use @linkplain for link text that doesn't match symbol name.
PiperOrigin-RevId: 437992927
2022-04-07 15:09:42 +01:00
ibaker
479e8ea36e 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-07 15:06:16 +01:00
Ian Baker
930709e592 Merge pull request #56 from ittiam-systems:rtp_wav
PiperOrigin-RevId: 437783926
2022-04-07 15:02:40 +01:00
ibaker
544bb8546c More demo app unstable API opt-in and reshuffling
Follow-up to <unknown commit>

PiperOrigin-RevId: 437777871
2022-04-07 14:59:09 +01:00
ibaker
1168c419d1 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-07 14:55:40 +01:00
ibaker
1d4f99cc86 Add PlayerView to the stable API
PiperOrigin-RevId: 437777445
2022-04-07 14:52:12 +01:00
hschlueter
ad6396a3e5 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-07 14:48:41 +01:00
andrewlewis
35528fd1bf 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-07 14:44:59 +01:00
andrewlewis
001c6c2dac Remove unnecessary initialization
PiperOrigin-RevId: 437753013
2022-04-07 14:41:24 +01:00
hschlueter
f3c861a6de 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-07 14:37:56 +01:00
ibaker
a8896c3996 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-07 14:34:32 +01:00
Ian Baker
d76658e6fc Merge pull request #47 from ittiam-systems:rtp-vp8
PiperOrigin-RevId: 437710223
2022-04-07 14:31:07 +01:00
huangdarwin
083aa7b29d 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-07 14:27:43 +01:00
Ian Baker
a4c05fab7d Merge pull request #46 from ittiam-systems:rtp_amr
PiperOrigin-RevId: 437274290
2022-04-07 14:24:15 +01:00
hschlueter
d1394780ec 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-07 14:17:01 +01:00
aquilescanta
202a82a915 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-07 14:10:02 +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
cf0a680677 Media: Remove unused CastPlayer values.
PiperOrigin-RevId: 437237835
2022-03-25 14:46:29 +00:00
hschlueter
9cd37385d0 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:43:01 +00:00
ibaker
9c2ee5a224 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:39:34 +00:00
hschlueter
f42d09cf15 Allow frame processors to be set on Transformer.Builder.
Also make GlFrameProcessor, ScaleToFitFrameProcessor, and
AdvancedFrameProcessor public.

PiperOrigin-RevId: 437227388
2022-03-25 14:36:02 +00:00
hschlueter
8dc039c084 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:32:20 +00:00
ibaker
e11d105f39 Switch the bug template to a form
Also force people to use one of the templates

Documentation:
https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
PiperOrigin-RevId: 437210882
2022-03-25 14:28:35 +00:00
andrewlewis
edfa03d969 Handle non-standard MIME type on LG AC3 decoder
PiperOrigin-RevId: 437057336
2022-03-25 14:21:17 +00:00
andrewlewis
f41ebf6c65 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:17:50 +00:00
hschlueter
dbe57af553 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:14:28 +00:00
huangdarwin
acacb23ba6 Media: Remove unused CastPlayer values.
PiperOrigin-RevId: 437237835
2022-03-25 14:11:38 +00:00
hschlueter
4e63bdf3cc 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:10:52 +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