9704 Commits

Author SHA1 Message Date
claincly
c86d70a98b Allow forcing duration in FrameworkMuxer.
PiperOrigin-RevId: 501865706
2023-01-17 03:02:43 +00:00
claincly
07fe60710c Fix not able to set a null output surface.
Previously, after calling MCVR.setOutput() with null, `frameProcessorManager`'s output surface is cleared. What was unexpected is `ExoPlayerInternal` notifies a zero output resolution after clearing the output surface. This zero resolution causes FrameProcessor to fail.

PiperOrigin-RevId: 501861993
2023-01-17 02:58:45 +00:00
huangdarwin
e773031927 Effect: Move BitmapTestUtil to common test util class.
Move BitmapTestUtil from media3.effect to media3.test.utils.

This allows this class to be accessed from both transformer and effect tests.

Refactoring change. No functional change intended.

PiperOrigin-RevId: 501837130
2023-01-17 02:54:54 +00:00
huangdarwin
1a1cdcc350 HDR: Update glsl color transfer errors to use unique colors.
Each error will make the output be a solid color with a unique color.

PiperOrigin-RevId: 501824355
2023-01-17 02:50:57 +00:00
huangdarwin
4ade37c48d HDR: Implement PQ to SDR tone-mapping.
Tested manually on the Pixel 7 and Samsung S10.

PiperOrigin-RevId: 501626354
2023-01-17 02:46:59 +00:00
claincly
91d43dc915 Handle FrameProcessor output size change
Notifies event listener of FrameProcessor's new output size to layout the
PlayerView

PiperOrigin-RevId: 501590239
2023-01-17 02:43:03 +00:00
huangdarwin
4f4f28b923 Transformer: Clarify setResolution javadoc.
This class may be removed soon, but in the meantime clarify this method's
javadoc summary fragment to make it marginally clearer that this only affects
the "displayed" height instead of the "encoded" height.

PiperOrigin-RevId: 501582219
2023-01-17 02:39:07 +00:00
samrobinson
298ad765a3 Make ToInt16AudioProcessor available in common.audio.
PiperOrigin-RevId: 501575932
2023-01-17 02:35:14 +00:00
huangdarwin
27e71d2f91 Transformer: Simplify EncoderWrapper rotationDegrees logic.
Small refactoring change to simplify the logic a tiny bit by removing one
unnecessary variable. No functional change intended.

PiperOrigin-RevId: 501566533
2023-01-17 02:31:20 +00:00
samrobinson
8ccb8b64ae Move BaseAudioProcessor abstract class to common.
This is a prerequisite step to making the `ResamplingAudioProcessor` public.

PiperOrigin-RevId: 501545561
2023-01-17 02:27:27 +00:00
bachinger
055ed77433 Document that DownloadService needs notification permissions
Starting with Android 13 (API 33) an app needs to request the
permission to post notifications or notifications are suppressed.
This change documents this in the class level JavaDoc of the
`DownloadService`.

Issue: google/ExoPlayer#10884
PiperOrigin-RevId: 501346908
2023-01-17 02:19:33 +00:00
samrobinson
8fe90562a6 Allow Muxer.writeSampleData to take @C.BufferFlag int flags.
PiperOrigin-RevId: 501314812
2023-01-17 02:11:33 +00:00
claincly
74cc588049 Fix typo in ExoPlayer.java
PiperOrigin-RevId: 501287961
2023-01-17 02:07:28 +00:00
tofunmi
a786c03a34 Move BitmapLoader to common.
The migration strategy is to deprecate `androidx.media3.session.BitmapLoader` and copy the file into common since BitmapLoader is a public interface that apps could be relying on.

PiperOrigin-RevId: 501266521
2023-01-17 02:03:35 +00:00
kimvde
bbffa8ae27 Remove setDecoderFactory from Transformer
It makes more sense to have it in the AssetLoader now that decoding is
done there, particularly as the decoder factory should rarely be
customized.

Also remove the setter from the AssetLoader.Factory because it's
uncommon to have setters in a factory.

PiperOrigin-RevId: 501244974
2023-01-17 01:59:37 +00:00
kimvde
a5288a20fb Add a queue at the start of the buffer SamplePipelines
This improves performance and makes the code more intuitive.

PiperOrigin-RevId: 501220234
2023-01-17 01:55:45 +00:00
kimvde
4a91a234a8 Remove setters from AssetLoader.Factory
It's unusual to have setters on a Factory.

PiperOrigin-RevId: 501212264
2023-01-17 01:51:45 +00:00
steveanton
25fdc4ed47 Add an audio mixer that combines concurrent audio sources
Design document: go/me-android-audio-mixer

PiperOrigin-RevId: 501048758
2023-01-10 21:03:03 +00:00
kimvde
3a0fa0c89b Indicate that some FrameProcessor methods can be called on any thread
The FrameProcessor is created on the GL thread, but:
- setInputFrameInfo() is currently called from the playback thread.
- release() is currently called from the transformer internal thread.

PiperOrigin-RevId: 501035719
2023-01-10 20:59:10 +00:00
tonihei
09a15fb731 Update bandwidth meter estimates
PiperOrigin-RevId: 501010994
2023-01-10 20:55:15 +00:00
tonihei
3c6b8c5d7b Handle AV sync timestamps when draining the audio sink during tunneling
When audio processors are enabled during tunneling, they must produce
output immediately, ensuring that the timestamps of the output samples
correspond to the input and that no additional samples are produced.
This requirement is documented in the Javadoc of DefaultAudioSink.

However, this alone doesn't guarantee all buffers are immediately
written to the AudioTrack, because the AudioTrack writes are
non-blocking and may need multiple attempts.

When draining the audio sink at the end of the stream, we currently
fail in this situation because we assert that the timestamp must be
set (=the drain operation is a no-op). But this may not be true when
the previous non-blocking write wasn't fully handled. We can fix this
by saving the last timestamp and reusing it during draining.

Issue: google/ExoPlayer#10847
PiperOrigin-RevId: 500943891
2023-01-10 20:51:19 +00:00
samrobinson
2693b6025f Make EncoderBitrateProvider and implementations package private.
There is no API to allow applications to use these currently. Until
that exists, these classes do not need to be public.

PiperOrigin-RevId: 500792401
2023-01-10 20:47:24 +00:00
samrobinson
8cac27a77c Add audio and video values from Format to TransformationResult.
PiperOrigin-RevId: 500789076
2023-01-10 20:43:34 +00:00
samrobinson
8ad26c0d8b Split IAE and ISE cases in MuxerWrapper and improve javadoc.
PiperOrigin-RevId: 500786191
2023-01-10 20:39:43 +00:00
samrobinson
b3831778ef Improve docs and split audio/video order in TransformationResult.
PiperOrigin-RevId: 500776260
2023-01-10 20:35:52 +00:00
kimvde
886063d649 Rename SampleConsumer dequeueInputBuffer to getInputBuffer
This makes more sense as SampleConsumer.dequeueInputBuffer returns the
same buffer as long as it is not queued.

PiperOrigin-RevId: 500631982
2023-01-10 20:31:59 +00:00
kimvde
c642f811a6 Fix sample interleaving
Whether to write a sample or not was based on the timestamp of the
previous sample, rather than the current sample.

PiperOrigin-RevId: 500195279
2023-01-10 20:28:01 +00:00
kimvde
ee37b453dd Split ExoPlayerAssetLoaderRenderer
Split ExoPlayerAssetLoaderRenderer into audio and video renderers.

PiperOrigin-RevId: 500102256
2023-01-10 20:24:03 +00:00
rohks
d49437c6e1 Initialise fields used for bundling as String directly
Initialising the fields as Integer and then getting a String on compute time is slow. Instead we directly initialise these fields as String. Improves the time taken in bundling PlayerInfo further to less than 200ms from ~300ms.

Also modified a test to improve productive coverage.

PiperOrigin-RevId: 500003935
2023-01-10 20:20:08 +00:00
rohks
bdd6818c14 Fix typo in DefaultTrackSelector.Parameters field
PiperOrigin-RevId: 499905136
2023-01-10 20:16:03 +00:00
samrobinson
03bb91401d Refactor MuxerWrapper handling of track details.
This brings together the multiple details about a muxer track, and
reduces the need for additional variables and more complicated track
tracking.

PiperOrigin-RevId: 499872145
2023-01-10 20:12:05 +00:00
andrewlewis
9835e91439 Fix some minor issues/typos
PiperOrigin-RevId: 499808853
2023-01-10 20:08:14 +00:00
Googler
bbe78b10c1 Throw a ParserException instead of a NullPointerException if the sample table (stbl) is missing a required sample description (stsd).
As per the javadoc for AtomParsers.parseTrack, ParserException should be "thrown if the trak atom can't be parsed."

PiperOrigin-RevId: 499522748
2023-01-10 20:04:22 +00:00
rohks
2a77f1e2f9 Optimise bundling for Timeline.Window and Timeline.Period
Improves the time taken to construct playerInfo from its bundle from ~400 ms to ~300 ms.

Also made `Timeline.Window.toBundle(boolean excludeMediaItem)` public as it was required to assert a condition in tests.

PiperOrigin-RevId: 499512353
2023-01-04 20:03:19 +00:00
kimvde
827bd6b8f1 Rename the SamplePipelines
The old names are not really correct anymore because:
- The Audio/VideoTranscodingSamplePipelines do not decode anymore.
- The pipelines now mux the encoded data.

PiperOrigin-RevId: 499498446
2023-01-04 19:59:05 +00:00
samrobinson
7d727c88af Improve encoder resolution capability checking.
Whilst testing fallback functionality, I found that we were
aggressively reducing the resolution if it was not supported. A quick
test found that we could reduce by a much smaller increments.
Performance wise it appears these checks are incredibly quick.

The code for checking supported sizes was duplicated, with one case
having a bug because of this duplication (2/3 case). This CL abstracts
this into a loop.

PiperOrigin-RevId: 499497646
2023-01-04 19:54:54 +00:00
kimvde
e6527ec1dd Merge BaseSamplePipeline and SamplePipeline
PiperOrigin-RevId: 499469006
2023-01-04 19:50:56 +00:00
rohks
9d431a52ef Check bundles in MediaItem to verify keys are skipped
Added another check in each of these tests to make sure we don't add keys to bundle for fields with default values.

Also fixed comments of similar changes in `AdPlaybackStateTest` and `MediaMetadataTest`.

PiperOrigin-RevId: 499463581
2023-01-04 19:47:02 +00:00
kimvde
8a8c81d57f Move video decoding to AssetLoader
PiperOrigin-RevId: 499454273
2023-01-04 19:43:10 +00:00
andrewlewis
bec46b66eb Reduce flakiness of GL release test
Based on experimentation it seems that buffers can occasionally (roughly 1% of test runs) be dropped when rendering off-screen from EGL on the emulator. Specifically, in this test, sometimes after rendering three buffers with distinct timestamps only the first and third buffers' timestamps are handled in the `ImageReader`'s image available callback causing the assertion checking all frames rendered to fail. This behavior seems to be independent of the nanosecond presentation time attached to the buffers (as expected for off-screen rendering).

Introducing a pause of 1 second between rendering each frame reduces the flake rate to around 1/2000. This increases the run time of some of the tests, so this change also removes the 5 second `FRAME_PROCESSING_WAIT_MS` (it seems to be unnecessary when rendering off-screen) and instead uses a latch to wait until the frame processor has handled 'end of stream'.

PiperOrigin-RevId: 499440591
2023-01-04 19:39:12 +00:00
kimvde
09d431147d Remove unnecessary exceptions in tests
PiperOrigin-RevId: 499160043
2023-01-04 19:30:59 +00:00
kimvde
220a5b9ff3 Misc small fixes
- Improve AssetLoader Javadoc
- Fix Javadoc of sample pipelines
- Improve Javadoc of Transformer.startTransformation
- Move thread hops for Transformer listener callbacks to
  TransformerInternal

PiperOrigin-RevId: 499156604
2023-01-04 19:27:01 +00:00
samrobinson
46f5654643 Deprecated onTransformationError methods are not called.
When a listener method is deprecated, the new method should (by
default) called through to the deprecated one. This is because any
class that implements the method that is now deprecated needs to still
receive that callback.

It appears when onTransformationError(MediaItem, Exception) was
deprecated in favour of onTransformationError(MediaItem,
TransformationException), this deprecation was the wrong way round, and
the newer callback - onTransformationError(MediaItem,
TransformationResult, TransformationException) continued this mistake.

This CL now corrects this.

PiperOrigin-RevId: 498221504
2023-01-04 19:22:56 +00:00
kimvde
8e6daec955 Remove mentions of player in TransformationException
PiperOrigin-RevId: 497921432
2023-01-04 19:19:04 +00:00
tofunmi
967e44c066 Add TextureOverlay.configure() to configure overlay before frame processing
This change allows an overlay to be sized with respect to the video dimensions.

PiperOrigin-RevId: 497337734
2023-01-04 19:15:18 +00:00
samrobinson
2716ff89db Simplify TransformerEndToEndTest and TransformerTestRunner.
PiperOrigin-RevId: 497335605
2023-01-04 19:11:17 +00:00
samrobinson
c0bbfe929a Add a MuxerWrapper listener for events.
Events on the wrapper should be propagated to TransformerInternal as
soon as they occur, switching round the process so TransformerInternal
does not have to query MuxerWrapper.

This CL is a prerequisite for the child CL, where MuxerWrapper can
simplify the internal state and logic.

PiperOrigin-RevId: 497267202
2023-01-04 19:07:29 +00:00
ibaker
8313af1677 Fix order of playback controls in RTL layout
Issue: androidx/media#227

#minor-release

PiperOrigin-RevId: 497159283
2023-01-04 18:56:03 +00:00
tofunmi
7ce7e0aefd Specify units for VideoEncoderSettings.
PiperOrigin-RevId: 497113780
2023-01-04 18:52:15 +00:00
kimvde
7c980f12db Ensure AssetLoader callbacks are always called in the right order
Before, it was possible for onDurationUs() and onAllTracksRegistered()
to be called before onTrackAdded() because they are called from
different threads. onDurationUs() and onAllTracksRegistered() are called
from the Transformer internal thread, and onTrackAdded() is called from
the playback thread.

PiperOrigin-RevId: 497102556
2023-01-04 18:44:50 +00:00