14550 Commits

Author SHA1 Message Date
claincly
f2b4701e92 Round the frame rate in MediaFormat
Although MediaCodec claims supporting float frame rate, encoder init failed on
API21 Nexus 5. Since it's just a performance hint to the codec, it's OK to
generalize it to other API versions.

PiperOrigin-RevId: 458434650
(cherry picked from commit 1f47fa832c6228a5545d8a15c9c09fe76c17dfc5)
2022-07-01 11:06:12 +00:00
hmzh
8b0fe16821 Fix MIDI command timestamp calculations and synthesization duration.
- Improve variable naming to include time units for clarity
- Fix existing timestamp calculations to respect time units as well as track tempo (default values for now)
- Ensure the synthesizer produces PCM for the correct amount of time (including gaps between commands).

PiperOrigin-RevId: 458428243
(cherry picked from commit da0a208b89a7914dae577900c990b0f36c23df14)
2022-07-01 10:18:50 +00:00
rohks
39d04cf2ac Fix formatting in release notes.
PiperOrigin-RevId: 458283415
(cherry picked from commit c0359cad927bc83e567c39a6107b17028d6cb7c1)
2022-06-30 19:10:22 +00:00
hschlueter
d48507a2d1 Move DebugViewProvider out of Transformer class.
The GlEffectsFrameProcessor that will be part of the effects module
uses the DebugViewProvider. So it does not make sense for it
to be an inner interface of Transformer.

PiperOrigin-RevId: 458014932
(cherry picked from commit cd0e5b99de9577ff1af0da15a9ea6c9041f38361)
2022-06-29 17:56:53 +00:00
hschlueter
1a1c6e94bb FrameProcessor: Replace SurfaceInfo.Provider with setter.
The FinalMatrixTransformationProcessorWrapper ensures that the
surface is only replaced when it is not being rendered to and vice
versa.

PiperOrigin-RevId: 458007639
(cherry picked from commit 234015cb952fbdaf274f1fa9005ddc0d2b4ba17a)
2022-06-29 17:27:05 +00:00
rohks
5ac982b9d0 Make MetadataRenderer configurable to output metadata early.
PiperOrigin-RevId: 457974611
(cherry picked from commit 621617f98103f67082e47bf585460d90c00ea32f)
2022-06-29 14:47:12 +00:00
hschlueter
129cfb6eeb Fix outputHeight pass-through condition.
The outputHeight in the TransformationRequest is the height of
the frame as it would be displayed (i.e., after applying any
rotation specified in the format). So pass-through should only
be used if the requested outputHeight matches the input
format's height after applying the rotation.

PiperOrigin-RevId: 457934867
(cherry picked from commit 87beb273e464d291423ccb4129c83f36195343f1)
2022-06-29 10:28:54 +00:00
hschlueter
c250d2d791 Allow changing input pixelWidthHeightRatio for GlEffectsFrameProcessor.
pixelWidthHeightRatio is now passed to setInputFrameInfo instead of
the factory.

PiperOrigin-RevId: 457696703
(cherry picked from commit b7b5f20e592bee772772eb1b009c7f5a96077520)
2022-06-28 11:22:45 +00:00
rohks
87d91ed19e Add timestamp to Metadata
`MetadataRenderer` is updated to output `Metadata` with its presentation time, in microseconds.

PiperOrigin-RevId: 457444718
(cherry picked from commit b2831d8559713b757feb3f15a2c828db0e5ecd7c)
2022-06-27 11:31:10 +00:00
hschlueter
864230fd11 Rename setVideoFrameEffects to setVideoEffects.
PiperOrigin-RevId: 457023382
(cherry picked from commit 4819b28587c41e75c716ba3fa84fa84a8934c78e)
2022-06-24 17:04:45 +01:00
hschlueter
928036523a Allow FrameProcessor input surface size changes.
This will be useful for downgrading to a lower resolution during
a slow preview and for processing slide-shows once sequential
multi-asset editing is supported.

PiperOrigin-RevId: 457017255
(cherry picked from commit 30c52c58f0772e43ca4e4639120d95f41ea8a9b5)
2022-06-24 16:31:31 +01:00
hschlueter
71f3ebb79c Extract FrameProcessor interface from GlEffectsFrameProcessor.
PiperOrigin-RevId: 456814150
(cherry picked from commit f3893c146d5e4521b84af45551ea5fda4d9c66bd)
2022-06-23 19:00:01 +01:00
hschlueter
4fc36bafdd Disable flaky transformer emulator test on API 31.
videoEncoderFormatUnsupported_completesWithError() has recently
been flaky on API 31 emulators on presubmit because a different
exception than the expected exception is thrown.
This disables it on those emulators to reduce testing noise
until the underlying problem is investigated and resolved.

PiperOrigin-RevId: 456765512
(cherry picked from commit 938d3c2e5b6f016f7075a3d2d162d37c1951d825)
2022-06-23 15:44:02 +01:00
hschlueter
498123da68 Rename FrameProcessorChain to GlEffectsFrameProcessor.
This change is just renaming. There is no functional change intended.
The FrameProcessor interface will be created in a follow-up.

PiperOrigin-RevId: 456741628
(cherry picked from commit 709224fb1ed3a1dab1433a5dc7fbb33a04eecaae)
2022-06-23 13:13:56 +01:00
samrobinson
90c904b089 Add a Builder for DefaultEncoderFactory.
PiperOrigin-RevId: 456728032
(cherry picked from commit 352967f65661296ff5551138fd6346fce0c52a3f)
2022-06-23 11:37:19 +01:00
rohks
49f4c9342d Add timestamp to CueGroup
`TextRenderer` is updated to output `CueGroup`, which contains the presentation time of the cues, in microseconds.

PiperOrigin-RevId: 456531399
(cherry picked from commit 74d61bbffb834cdb50d003a8de66af0e094ef702)
2022-06-22 17:19:55 +01:00
hschlueter
26ee3d32b2 Use GlTextureProcessor to avoid redundant copy in MediaPipeProcessor.
After this change GlEffects can use any GlTextureProcessor not just
SingleFrameGlTextureProcessor.
MediaPipeProcessor now implements GlTextureProcessor directly which
allows it to reuse MediaPipe's output texture for its output texture
and avoids an extra copy shader step.

PiperOrigin-RevId: 456530718
(cherry picked from commit 69ab79418ef21033ca25cebdf5a5e80752818ab5)
2022-06-22 17:16:54 +01:00
hschlueter
0007a47365 Support chaining async GlTextureProcessors in FrameProcessorChain.
After this change, FrameProcessorChain chains any GlTextureProcessors
instead of only SingleFrameGlTextureProcessors.

The GlTextureProcessors are chained in a bidirectional manner using
ChainingGlTextureProcessorListener to feed input and output related
events forward and release events backwards.

PiperOrigin-RevId: 456478414
(cherry picked from commit 555ab97e34d6586d38a9979bc0595a4818b7ecb8)
2022-06-22 12:03:41 +01:00
huangdarwin
4773fc6873 FrameProcessor: Use factories instead of a builder for Presentation.
PiperOrigin-RevId: 456064021
(cherry picked from commit f5d8800d51def6304db9c1f5a8f5ea3f6e3c69a6)
2022-06-20 14:26:12 +01:00
hschlueter
fab04c45f1 Add option to disable debug preview.
This is useful for testing Transformer in the same way as it is used
in tests and to see only the real transformation time.

PiperOrigin-RevId: 456058466
(cherry picked from commit 931562c24380ff8bd1f8fad6b2c0bb3581dc65e5)
2022-06-20 13:50:16 +01:00
hschlueter
73b57d3c77 Implement chaining GlTextureProcessor.Listener.
In follow-ups the FrameProcessorChain will set an instance of this
listener for each GlTextureProcessor to chain it with its previous
and next GlTextureProcesssor.

PiperOrigin-RevId: 455628942
(cherry picked from commit 981baae7095ef34c548df600bfbea1f7765dbb9e)
2022-06-17 16:57:46 +01:00
hschlueter
c16e5ac47c Wrap processor chain executor service for better exception handling.
The wrapper
* catches exceptions for each task and notifies the
  listener (this will be used more in follow-ups when processFrame
  is split into lots of listeners and callbacks),
* removes finished tasks from the queue and signals any exceptions
  that occurred to the listener each time a new task is executed.

PiperOrigin-RevId: 455345184
(cherry picked from commit ee847d92c50c8d2929da287e1103110149d78170)
2022-06-16 10:41:23 +00:00
olly
8c748485d2 Don't export broadcast receivers that don't require it
Issue: google/ExoPlayer#10287
PiperOrigin-RevId: 455131138
(cherry picked from commit 691b392b246522fb664cdb1ce196e16c3449926c)
2022-06-15 15:00:47 +00:00
hschlueter
8c465a7860 Replace FrameProcessorChain#isEnded with listener method.
PiperOrigin-RevId: 455114693
(cherry picked from commit fdfca880195da2ca5e5d0ef002feb8144009384c)
2022-06-15 13:27:35 +00:00
hschlueter
b7118486dc Use FrameProcessorChain#SurfaceProvider for encoder compat transform.
This change adds a SurfaceProvider interface which is necessary to
allow for texture processors whose output size becomes available
asynchronously in follow-ups.
VTSP's implementation of this interface wraps the encoder and provides
its input surface together with the output frame width, height, and
orientation as used for encoder configuration.
The FrameProcessorChain converts the output frames to the provided
orientation and resolution using a ScaleToFitTransformation and
Presentation replacing EncoderCompatibilityTransformation.

PiperOrigin-RevId: 455112598
(cherry picked from commit ea7f1ca1e32f19131cec690c6934d82c81a2d6d0)
2022-06-15 13:14:56 +00:00
hmzh
f5f95a8f40 Implement seeking to the start of a MIDI file
- Fixed MidiExtractor state issues which caused seeking to behave unexpectedly. Ensures the extractor is now always in the file loading state after returning RESULT_END_OF_INPUT.
- Fixed an infinite loop in MidiExtractor caused by the file data array having an initial size of 0. The extractor attempted to increase the capacity of the array by using this size of 0 in it's calculations.

PiperOrigin-RevId: 455107511
(cherry picked from commit 84c43f855fd60f96b5f415dc316c1333cfdec704)
2022-06-15 12:42:05 +00:00
olly
84e772ada8 Suppress an ExtendsObjects violation
to support enabling this as a compile-time error.

More information: go/lsc-extends-object

PiperOrigin-RevId: 454582570
(cherry picked from commit ab56f865ea076ac3cc9eb1ad5aff6000136caf80)
2022-06-13 12:34:43 +00:00
olly
2d5238d82b Update compileSdkVersion to 33
PiperOrigin-RevId: 454573995
(cherry picked from commit 33caabbc4422a81efbc8e04bc9994ee870ea2d13)
2022-06-13 11:37:38 +00:00
ibaker
2396887234 Remove ExoPlayerTest.PlayerStateGrabber
It's no longer needed

PiperOrigin-RevId: 454161070
(cherry picked from commit 8c63ba6fdbfcf632538acbfb6737f227923e54bf)
2022-06-10 14:32:54 +00:00
hschlueter
0a42c702ca Combine all native GL errors in a GlException instead of logging.
The native GL errors are in an arbitrary order according to
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetError.xml
This means any of them could contain the most useful message
so it's better to use all for the GlException's message rather than
picking the last message and logging all others.

PiperOrigin-RevId: 454130460
(cherry picked from commit d6a6b44715c15be8348b4a30664254e57d79036a)
2022-06-10 11:03:38 +00:00
hschlueter
56f234ea75 Check targetSdkVersion for frame dropping workaround.
Based on
https://developer.android.com/reference/android/media/MediaCodec#using-an-output-surface,
frame dropping behaviour depends on the target SDK version.
After this change transformer will only use
MediaFormat#KEY_ALLOW_FRAME_DROP if both the target and system SDK
version are at least 29 and default to its pre 29 behaviour where each
decoder output frame must be processed before a new one is rendered
to prevent frame dropping otherwise.

Also remove deprecated Transformer.Builder constructor without a
context and the context setter.

PiperOrigin-RevId: 453971097
(cherry picked from commit a105d033a7d44b8c3afb0e8134ad65f624caf256)
2022-06-09 18:22:39 +00:00
hschlueter
0b08396255 Make GlUtil.GlException checked and remove flag to disable it.
Transformer always enabled glAssertionsEnabled, so there should
be no functional change.

ExoPlayer previously disabled glAssertionsEnabled, so GlUtil logged
GlExceptions instead of throwing them. The GlExceptions are now
caught and logged by the callers so that there should also be no
functional change overall.

This change also replaces EGLSurfaceTexture#GlException with
GlUtil#GlException.

PiperOrigin-RevId: 453963741
(cherry picked from commit cc1f32d094cc4371d92b3ddab144d8965e1bc1c3)
2022-06-09 17:53:39 +00:00
claincly
780631c14b Ensure re-encode on performance tests
PiperOrigin-RevId: 453933854
(cherry picked from commit 12d775f055faac1b9de2c53fd296c5b1d0f89a32)
2022-06-09 15:41:09 +00:00
huangdarwin
5349312f50 Transformer GL: Split Presentation and Crop.
This removes the prior restriction of needing to remember not to crop and set aspect ratio in the same Presentation.Builder, and makes each class a bit more targeted.

This is partially made feasible by the past work to merge consecutive
MatrixTransformations into a single MatrixTransformationFrameProcessor, which
ensures that there's no loss in quality between successive MatrixTransformations.

PiperOrigin-RevId: 453660582
(cherry picked from commit c5b881e0899e713a7c632da48f1cd64b1394a221)
2022-06-08 12:51:28 +00:00
hschlueter
8973efd199 Mention alpha for matrix transformation background color.
PiperOrigin-RevId: 453633920
(cherry picked from commit cdb80387828c0087d9c9b96c55f303b978847910)
2022-06-08 09:50:18 +00:00
hschlueter
dac3878273 Implement default GlTextureProcessor in SingleFrameGlTextureProcessor.
SingleFrameGlTextureProcessor is now an abstract class containing a
default implementation of the more flexible GlTextureProcessor interface
while still exposing the same simple abstract methods for single frame
processing it previously did.

FrameProcessorChain and GlEffect will be changed to use
GlTextureProcessor in follow-ups.

PiperOrigin-RevId: 453633000
(cherry picked from commit 457f446114823831b940bf46fb256daa0ea00815)
2022-06-08 09:44:25 +00:00
christosts
a6fc6fac31 Ignore flaky test
PiperOrigin-RevId: 453168843
(cherry picked from commit 8d326312fba9ec36264815746c531ea9b28e2c28)
2022-06-06 11:35:12 +00:00
christosts
94e97fe5db De-flake test in MediaSessionPermissionTest
This change makes MediaSessionPermissionTest.removeMediaItems()
non-flaky. This is a quick fix though it'd be good to refactor this
test file.

PiperOrigin-RevId: 453162764
(cherry picked from commit 34ca3bc3c3b52b8dcfc531de76bc0b34f7a89c8c)
2022-06-06 10:42:08 +00:00
hschlueter
f4dfbdbc37 Add interface for async texture processors.
Implementations of this interface will be able to drop or add frames,
change timestamps, accept multiple input frames before producing
output, and process frames on their own background thread.

A default implementation of this interface will be added to SingleFrameGlTextureProcessor in a follow-up.

PiperOrigin-RevId: 453159835
(cherry picked from commit 63436390de55741620ab3faccbbc504af24c2686)
2022-06-06 10:18:26 +00:00
hschlueter
27f23041cf Add async error listener to transformer to avoid exception wrapping.
This internal listener avoids wrapping the TransformationExceptions
in PlaybackExceptions that are handled via the Player.Listener and
is also used for FrameProcessingExceptions which already avoided
the PlaybackException layer previously.

This listener will also be useful in follow-ups for encoder-related
TransformationExceptions that are thrown in the SurfaceProvider that
will be called on the GL thread.

PiperOrigin-RevId: 452074575
(cherry picked from commit 35b5147eb1404698132d9b063c905202c22e31d8)
2022-05-31 17:01:02 +00:00
hschlueter
22ee071b53 Move program initialization to texture processor constructor.
Once the more advanced GlTextureProcessor interface exists,
it will be possible to change the output size of a GlTextureProcessor
between frames. To keep the re-configuration based on the frame sizes
minimal, things indepedent of the frame size, such as the GlProgram,
can be initialized in the constructor.

PiperOrigin-RevId: 451997584
(cherry picked from commit 87ab96d352c0ffbf83d514d93193638895b61e5e)
2022-05-31 09:36:18 +00:00
aquilescanta
4776779b95 Use fluent assertions
Gives a bit more information upon failures

PiperOrigin-RevId: 451882968
(cherry picked from commit 9d460023a2842b8b03f563ecfed090149ce73b81)
2022-05-30 15:53:16 +00:00
tonihei
50475814f7 Update README for beta release.
PiperOrigin-RevId: 465318320
2022-08-08 09:46:09 +00:00
Rohit Kumar Singh
ca6835bf0a
Merge pull request #120 from androidx/release-1.0
r1.0.0 beta02
1.0.0-beta02
2022-07-22 09:31:34 +00:00
Rohit Singh
86e2361c50 Remove unreleased changes section from RELEASENOTES.md 2022-07-21 14:42:42 +00:00
rohks
cae428c7a6 Modify release date for 2.18.1 and media3:1.0.0-beta02
Also rearranged release notes to correctly show when the changes were released.

PiperOrigin-RevId: 462361982
(cherry picked from commit 26c8478de667180cb8137a20ae88df285c0bb046)
2022-07-21 14:17:51 +00:00
rohks
37f11161ce Version bump to exoplayer:2.18.1 and media3:1.0.0-beta02
#minor-release

PiperOrigin-RevId: 461162552
(cherry picked from commit be27daebc4e598a4c0d532779649a77f82650911)
2022-07-15 10:39:34 +00:00
tonihei
dfe8bee0cf Fix setDataSourceFactory handling in DefaultMediaSourceFactory
The call doesn't currently reset the already loaded suppliers and
factories. Also fix the supplier loading code to use a local copy
of the current dataSourceFactory to avoid leaking an updated
instance to a later invocation.

Issue: androidx/media#116

PiperOrigin-RevId: 460721541
(cherry picked from commit adc50515e93e6fdcf303d168e8388050503c46ef)
2022-07-13 15:27:55 +00:00
Rohit Singh
3abffb7583 Merge pull request #10185 from TiVo:p-custom-logger
PiperOrigin-RevId: 460689252
(cherry picked from commit bd8723e35a195e0e67816a64e74266bac9fe5058)
2022-07-13 17:45:54 +00:00
bachinger
6180035ecf Add migration script
Note: This was already reviewed in <unknown commit>. This doesn't mean we cannot apply further changes though.
PiperOrigin-RevId: 460542835
(cherry picked from commit f9a39201aafdb9b660d8c57fb8ffa051a9dc31c7)
2022-07-12 20:43:24 +00:00