9191 Commits

Author SHA1 Message Date
rohks
320dcadfec Add missing imports in Metadata
PiperOrigin-RevId: 459533055
2022-07-07 18:33:39 +00:00
rohks
a1665841fc Add tests for extracting MP4 with large bitrates
Also added the test to `MP4PlaybackTest`.

PiperOrigin-RevId: 459492188
2022-07-07 18:30:04 +00:00
samrobinson
a36967c19b Move Encoder quality API to VideoEncoderSettings.
Some other minor nits and adjustments to the API logic.

PiperOrigin-RevId: 459490431
2022-07-07 18:26:35 +00:00
christosts
752e82df2e Add missing Nullable annotation
PiperOrigin-RevId: 459485334
2022-07-07 18:22:55 +00:00
tonihei
a80dd60449 Don't block AudioTrack when waiting for previous release
We wait until a previous AudioTrack has been released before
creating a new one. This is currently done with a thread
block operation, which may cause ANRs in the extreme case
when someone attempts to release the player while this is
still blocked.

The problem can be avoided by just returning false from
DefaultAudioSink.handleBuffer to try again until the previous
AudioTrack is released.

Reproduction steps to force the issue:
1. Add Thread.sleep(10000); to the AudioTrack release thread.
2. Add this to the demo app:
    private int positionMs = 0;

    Handler handler = new Handler();
    handler.post(new Runnable() {
      @Override
      public void run() {
        player.seekTo(positionMs++);
        if (positionMs == 10) {
          player.release();
        } else {
          handler.postDelayed(this, 1000);
        }
      }
3. Observe Player release timeout exception.

These steps can't be easily captured in a unit test as we can't
artifically delay the AudioTrack release from the test.

Issue: google/ExoPlayer#10057
PiperOrigin-RevId: 459468912
2022-07-07 18:19:19 +00:00
huangdarwin
4230ea94e9 HDR: Remove ColorInfo.SDR constant
The SDR constant also specified a color space and range, in addition to
C.COLOR_TRANSFER_SDR. However, it turns out that SDR videos may use different color
space and range values, so following prior ExoPlayer conventions to have `null`
mean "generic SDR" is preferable here.

PiperOrigin-RevId: 459296746
2022-07-07 18:15:38 +00:00
Rohit Singh
9521807681 Merge pull request #10260 from sr1990:clearkey_parse_licenseurl
PiperOrigin-RevId: 459215225
2022-07-07 18:12:15 +00:00
huangdarwin
77d353b58b HDR: Throw error if attempting HDR editing under API 31.
HDR editing is not supported under API 31

PiperOrigin-RevId: 459211106
2022-07-07 18:08:47 +00:00
tonihei
bf88f28539 Exclude HEVC 10bit profile on Pixel 1.
This profile is declared as supported although it isn't.

Issue: google/ExoPlayer#10345
Issue: google/ExoPlayer#3537

#minor-release

PiperOrigin-RevId: 459205512
2022-07-07 18:05:03 +00:00
huangdarwin
bbbb009608 HDR: Remove unused EGL_GL_COLORSPACE_KHR attribute.
PiperOrigin-RevId: 459106221
2022-07-07 17:58:02 +00:00
samrobinson
d5b02e7584 Implement device based encoder bitrate mapping.
This feature is disabled by default for now.

PiperOrigin-RevId: 458932471
2022-07-07 17:54:40 +00:00
hschlueter
474e2f2c77 Fallback to SDR if encoder doesn't support HDR (HLG only).
If the input is HDR (HLG), check encoder capabilities for HDR support
and request tone-mapping to SDR during decoder configuration otherwise.
Capabilities are only checked for API 31 and above, as HDR editing is
not supported before.

As the encoder capabilities check needs to happen before selecting the
encoder to use (as this may depend on the resolution output by the
effects chain), the EncoderWrapper checks all candidate encoders
for the MIME type for HDR capabilities and only requests fallback to
SDR if none of them support it.

When the actual encoder is selected, the wrapper checks that it matches
one of the encoders is checked capabilities for.

PiperOrigin-RevId: 458511599
2022-07-07 17:47:46 +00:00
huangdarwin
53db305612 HDR: Configure GL shaders and encoder.
Configure the GL shaders and encoder to take in HDR metadata.

This mostly just consists of passing the Format.colorInfo through
the VideoTranscodingSamplePipeline down to the encoder, rather than passing
the PQ-ness down to the GL step.

Due to b/237674316, this will remove HDR10+ support temporarily to introduce
support for HLG10.

Manually tested to confirm that HLG10 operations that don't affect color display
correctly after this CL with "HDR editing" in the demo checked, and continue to display incorrectly (as before this CL) without the option unchecked.

PiperOrigin-RevId: 458490810
2022-07-07 17:44:14 +00:00
claincly
2b6f62b2a1 Fix error in frame rate handling.
The old getString() will throw because FRAME_RATE can only be float or int.

PiperOrigin-RevId: 458481251
2022-07-07 17:40:55 +00:00
tonihei
577e19168d Only consider enabled tracks in ProgressiveMediaPeriod.bufferedPosition
ProgressiveMediaPeriod loads all available tracks into SampleStreams
(because it needs to read the data anyway and it allows easy activation
of tracks without reloading). However, the SampleStreams for disabled
tracks are not read and no one if waiting for them.

The buffered position is used for user-visible state (e.g. in the UI)
and to check how much data is already buffered to decide when to stop
buffering (using LoadControl). Both values benefit from only
using the actually enabled tracks to better reflect what is available
for playback at the moment.

Issue:Issue: google/ExoPlayer#10361
PiperOrigin-RevId: 458475038
2022-07-07 17:37:35 +00:00
claincly
8f89eba59c Find only REGULAR_CODECS in EncoderUtil.
We used "ALL_COOECS" previously, and it is not necessary because "ALL_CODECS"
additionally the codecs that support tunneling/secure decoding, which there
is no use case in Transformer.

PiperOrigin-RevId: 458470278
2022-07-07 17:34:12 +00:00
claincly
821ab26702 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
2022-07-07 17:30:49 +00:00
rohks
9e10286b5e Fix MP4 parser issue in reading bitrates from esds boxes.
As per MP4 spec, bitrates in esds boxes can be a 32 bit number which doesn't fits in Java int type, so now reading it as a long value. Our class for holding media format, only allows bitrates value to be an int as we don't expect the bitrates to be greater than or equal to 2^31. So we're limiting the values for bitrates to Integer.MAX_VALUE.

#minor-release

PiperOrigin-RevId: 458423162
2022-07-07 17:23:16 +00:00
rohks
5095ff160b Fix MP4 parser issue in reading length of URL array from esds boxes.
As per MP4 spec, the length of URL array is a 8 bit number.

#minor-release

PiperOrigin-RevId: 458421436
2022-07-07 17:19:49 +00:00
hschlueter
f41e6796ce 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
2022-07-07 17:16:30 +00:00
hschlueter
e5527a8add 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
2022-07-07 17:12:50 +00:00
ibaker
bf86b603a3 Ensure TalkBack announces the selected playback speed in the UI menu
Issue: google/ExoPlayer#10298
#minor-release
PiperOrigin-RevId: 457991028
2022-07-07 17:09:32 +00:00
rohks
14f75c162f Make MetadataRenderer configurable to output metadata early.
PiperOrigin-RevId: 457974611
2022-07-07 17:06:13 +00:00
hschlueter
c74cf1f1aa 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
2022-07-07 17:02:56 +00:00
ibaker
5c7ec13e85 Consider shuffle order in Timeline.equals()
Previously two timelines that differed only in shuffle order were
considered equal, which resulted in no call to
Player.Listener.onTimelineChanged when calling
ExoPlayer.setShuffleOrder. This in turn resulted in no call to
MediaControllerCompat.Callback.onQueueChanged.

Also make a small fix inside ExoPlayerImpl.setShuffleOrder, to ensure
that the new shuffle order is used when constructing the masked
timeline.

Issue: google/ExoPlayer#9889
#minor-release
PiperOrigin-RevId: 457703727
2022-07-07 16:59:33 +00:00
ibaker
292f6de630 Use a helper function and Truth Correspondence instead of NoUidTimeline
NoUidTimeline still exists as a private detail of TestUtil, but it no
longer extends ForwardingTimeline because the interactions are quite
hard to reason about.

#minor-release

PiperOrigin-RevId: 457703593
2022-07-07 16:56:21 +00:00
hschlueter
bfa663d2b1 Allow changing input pixelWidthHeightRatio for GlEffectsFrameProcessor.
pixelWidthHeightRatio is now passed to setInputFrameInfo instead of
the factory.

PiperOrigin-RevId: 457696703
2022-07-07 16:53:01 +00:00
rohks
6e9275c13d Add timestamp to Metadata
`MetadataRenderer` is updated to output `Metadata` with its presentation time, in microseconds.

PiperOrigin-RevId: 457444718
2022-07-07 16:42:28 +00:00
tonihei
aedde2de39 Clean up offload state tracking
1. The offloadSchedulingEnabled value doesn't need to be in
   PlaybackInfo because it's never updated in EPII.
2. The sleepingForOffload value in EPII wasn't updated explicitly
   (just via the return value of a method). It was also only
   meant to be enabled while the player is actively playing, but
   confusingly triggered from a path where the player may
   theoretically be buffering as well.
3. The offload sleeping (=not scheduling doSomeWork) was interwoven
   into the actual scheduling code making it slightly hard to follow.
   This can be improved slightly by keeping the offload sleeping
   decision and the scheduling separate.

PiperOrigin-RevId: 457427293
2022-06-27 12:09:42 +01:00
tonihei
aaa0152905 Rename shouldUseDummySurface to shouldUsePlaceholderSurface
This was likely missed in 33373d0d0a.

PiperOrigin-RevId: 457422574
2022-06-27 12:06:28 +01:00
hschlueter
20d220193e Rename setVideoFrameEffects to setVideoEffects.
PiperOrigin-RevId: 457023382
2022-06-27 12:03:04 +01:00
hschlueter
a230d59f1b 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
2022-06-27 11:59:48 +01:00
hschlueter
1b5dd92dec Extract FrameProcessor interface from GlEffectsFrameProcessor.
PiperOrigin-RevId: 456814150
2022-06-27 11:53:24 +01:00
hschlueter
d9c63c1e87 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
2022-06-27 11:50:05 +01:00
olly
531f03a369 Inform ProgressiveMediaPeriod of known length earlier
PiperOrigin-RevId: 456753343
2022-06-27 11:46:44 +01:00
hschlueter
216fefd669 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
2022-06-27 11:43:32 +01:00
samrobinson
19bdff96ba Add a Builder for DefaultEncoderFactory.
PiperOrigin-RevId: 456728032
2022-06-27 11:40:04 +01:00
rohks
bf11a8a831 Add timestamp to CueGroup
`TextRenderer` is updated to output `CueGroup`, which contains the presentation time of the cues, in microseconds.

PiperOrigin-RevId: 456531399
2022-06-27 11:36:43 +01:00
hschlueter
e25bf81195 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
2022-06-27 11:33:30 +01:00
hschlueter
3a96691654 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
2022-06-27 11:30:18 +01:00
tonihei
251389d744 Clear pending doSomeWork messages when sleeping for offload
The offload sleeping stops as soon as a new DO_SOME_WORK message
is handled (because this indicates an expected change in rendering
and we want to stop sleeping until we know it's safe to do so).

Every exit path from doSomeWork needs to clear other pending
DO_SOME_WORK messages as these requests have already been handled by
the current method invocation. This currently doesn't happen from the
offload sleeping return path and a previously queued DO_SOME_WORK
message can immediately wake up the rendering loop again.

Fix this by moving the message removal to the beginning of the
doSomeWork method (as it prevents forgetting it in one of the
exit paths later).

PiperOrigin-RevId: 456259715
2022-06-27 11:27:03 +01:00
olly
d86bc1078c Fix parsing H265 short term reference picture sets
Issue: google/ExoPlayer#10316
PiperOrigin-RevId: 456084302
2022-06-27 11:23:40 +01:00
huangdarwin
d1357e8b59 FrameProcessor: Use factories instead of a builder for Presentation.
PiperOrigin-RevId: 456064021
2022-06-27 11:20:18 +01:00
hschlueter
c92e18ec58 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
2022-06-27 11:13:25 +01:00
christosts
4f5e99c543 Misc improvement in Util
#minor-release

PiperOrigin-RevId: 455380010
2022-06-16 17:48:22 +00:00
bachinger
495480a66a Add lint base xml file for string.xml files
Fixing lint errors in the string.xml files makes no sense because these are
overridden with the next automated string import. Adding a lint-baseline.xml
instead for the ui module.

See https://issuetracker.google.com/208178382

#minor-release

PiperOrigin-RevId: 455354304
2022-06-16 12:53:07 +00:00
bachinger
209d3085b7 Version bump to exoplayer:2.18.0 and media3:1.0.0-beta01
#minor-release

PiperOrigin-RevId: 455350486
2022-06-16 11:35:41 +00:00
Marc Baechinger
e220f5377b Merge pull request #63 from ittiam-systems:rtp-h263
PiperOrigin-RevId: 455347182
2022-06-16 11:31:37 +00:00
hschlueter
bf9fa12411 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
2022-06-16 11:27:18 +00:00
christosts
91de5fa0cb Misc javadoc fix.
PiperOrigin-RevId: 455157744
2022-06-15 19:01:50 +00:00