4970 Commits

Author SHA1 Message Date
olly
3805237322 Upgrade Cast dependency for Android 12 compatibility
#minor-release
Issue: google/ExoPlayer#9528
PiperOrigin-RevId: 413887784
2021-12-07 16:46:40 +00:00
hschlueter
ef1788dcea Only use a FrameEditor if editing is needed.
When no editing is needed, the OpenGL steps can be skipped.

PiperOrigin-RevId: 413884305
2021-12-07 16:45:42 +00:00
olly
244777234b Refine HW/SW codec approximation for API level 28 and earlier
Hardware audio decoders aren't really a thing, particularly on older
devices. SOC vendors do sometimes provide their own software decoders
though. Hence we update the approximation to assume that audio
decoders on older devices are software.

PiperOrigin-RevId: 413757859
2021-12-07 16:44:25 +00:00
Ian Baker
e1eb30c8ba Merge pull request #9606 from ened:rtsp-socket-factory
PiperOrigin-RevId: 413751821
2021-12-07 16:43:17 +00:00
hschlueter
14b849aba8 Reduce conditional nesting.
PiperOrigin-RevId: 413682281
2021-12-07 16:42:18 +00:00
claincly
fbbedf32f9 Remove the check for dynamic payload type.
Issue: google/ExoPlayer#9744

We do not rely on the payload type to determine the sample MIME type, we depend
on the SDP message, so it's worthless checking the payload type.

After removing the line, a server can use payload type 35 (an unassigned
payload type) for H264; while normally H264 requires payload type >= 96).

PiperOrigin-RevId: 413658076
2021-12-07 16:41:22 +00:00
huangdarwin
58a8aceb97 Transformer GL: Apply transformation_matrix to vertex position.
Previously, transformation_matrix was incorrectly applied to
texture sampling coordinates, which led to transformations
seemingly moving in the opposite position, and an undesirable
GL_CLAMP_TO_EDGE behavior when sampling outside the edge of
the texture.

PiperOrigin-RevId: 413653360
2021-12-07 16:40:04 +00:00
tonihei
417c242625 Prohibit duplicate TrackGroups in TrackGroupArray
Allowing duplicate groups caused some other code working with the
array to use reference equality comparison. This is error-prone,
easily forgotten (e.g. when using the TrackGroups in a map) and
causes bugs when TrackGroups are serialized to disk or to another
process.

All TrackGroups created by ExoPlayer are already unique and custom
code creating TrackGroupArrays with identical groups can easily
distringuish them by adding an id to each group.

Issue: google/ExoPlayer#9718
PiperOrigin-RevId: 413617005
2021-12-02 11:56:42 +00:00
andrewlewis
e077edded5 Update javadoc to reflect removal of WebM container option
It seems fine to remove the documentation about the WebM case now we are only supporting unfragmented MP4, so that new users coming to this API aren't confused about how to set the container MIME type.

PiperOrigin-RevId: 413611472
2021-12-02 11:56:42 +00:00
tonihei
f1a5825d73 Add optional id to TrackGroup.
This allows to give TrackGroups an identifier. The underlying goal is
to provide a way to make otherwise identical TrackGroups
distinguishable.

Also set this id in all internal sources that may produce identical
TrackGroups in certain edge cases.

Issue: google/ExoPlayer#9718
PiperOrigin-RevId: 413430719
2021-12-02 11:56:42 +00:00
huangdarwin
73ed482094 Transformer GL: Create setTransformationMatrix().
Allows a transformation matrix to be input into Transformer,
to apply vertex transformations like cropping, rotation,
and other transformations built into android.graphics.Matrix.

Not building out into a VertexTransformation class yet, as
that class structure wouldn't make sense until we can modify
resolution, per TODOs.

PiperOrigin-RevId: 413384409
2021-12-02 11:56:42 +00:00
andrewlewis
a803604605 Increase transformer min API version to 21
This will remove the need to implement compat code handling very old API
versions where some symbols are not available, and it reduces the burden of
dealing with media framework issues around concurrent codec usage that are
worse on older API versions. Top apps that we've surveyed as potential users
for transformer library features are using API 21 or later.

PiperOrigin-RevId: 413341540
2021-12-02 11:56:42 +00:00
olly
6f63701307 Fix 1 ErrorProneStyle finding
PiperOrigin-RevId: 413188534
2021-12-02 11:55:55 +00:00
hschlueter
8105394ac2 Flip input buffer even if the end of stream is reached.
Sometimes the empty end of stream buffer has a non-zero
data limit. Calling flip first, resets the limit to the
position which is zero in these cases.

PiperOrigin-RevId: 413156455
2021-12-02 11:55:55 +00:00
andrewlewis
1b25e2f93d Add unit test for FrameEditor
The test extracts and decodes the first video frame in the test media, renders it to the frame editor's input surface and then processes data. It then reads back the output from the frame editor, converts it to a bitmap and then compares that with a 'golden' bitmap (which is just the same as the test media's first video frame).

PiperOrigin-RevId: 413131811
2021-12-02 11:55:55 +00:00
olly
b91db3f5e2 Add "3" into media3 version string
PiperOrigin-RevId: 413079384
2021-12-02 11:55:55 +00:00
ibaker
43328d7623 Rollback of f637bb3d40
*** Original commit ***

Remove usage of @ForOverride.

Fixes the gradle compilation failures.

Gradle dependencies need revising if we want to be using this, as
checkerframework is ahead of their latest version, such that we
can't compile.

***

PiperOrigin-RevId: 412901827
2021-12-02 11:55:55 +00:00
samrobinson
d55f9876ac Make use of try with-resources to auto close file.
PiperOrigin-RevId: 412901581
2021-12-02 11:55:55 +00:00
samrobinson
dd9d87549d Create and write the TransformationResult to on-device text file.
PiperOrigin-RevId: 412856100
2021-12-02 11:55:55 +00:00
tonihei
805d3b763d Update track selection to prefer content over technical preferences.
Currently we prefer technical preferences set in the Parameters over
content preferences implied by the media. It proably makes more
sense in the opposite order to avoid the situation where a
non-default track (e.g. commentary) is selected just because it
better matches some technical criteria.

Also add comments explaining the track selection logic stages.

PiperOrigin-RevId: 412840962
2021-12-02 11:55:55 +00:00
hschlueter
fb0768e0d2 Use audio passthrough if flattening is requested but not needed.
When the input is not a slow motion video, then flattening should do
nothing, so there is no need to re-encode audio.

PiperOrigin-RevId: 412443097
2021-12-02 11:55:55 +00:00
samrobinson
2ba7422da3 Move tests into a mh package.
PiperOrigin-RevId: 412438389
2021-12-02 11:55:44 +00:00
huangdarwin
60ce9ae345 Misc refactoring.
Use @VisibleForTesting and add some comments for GL code.

Refactoring change only. No functional changes intended

PiperOrigin-RevId: 412428196
2021-12-02 11:55:44 +00:00
kimvde
f9d3bedb0b Fix inconsistency with spec in H.265 SPS nal units parsing
Issue: google/ExoPlayer#9719

#minor-release

PiperOrigin-RevId: 412424558
2021-12-02 11:55:44 +00:00
bachinger
2a62a5ee30 Make setMediaItemFiller public in MediaSession.Builder
#minor-release
Issue: androidx/media#8
PiperOrigin-RevId: 412403132
2021-12-02 11:55:44 +00:00
huangdarwin
f0fcad16a9 GL: Remove redundant use() call.
This is already called in GlUtil.Program().

Tested by confirming that the demo-gl target still runs as expected.

Refactoring change only. No intended functional changes.

PiperOrigin-RevId: 412308564
2021-12-02 11:55:44 +00:00
tonihei
a7d7c7b73a Add preferredVideoRoleFlags to TrackSelectionParameters.
And also tweak existing role flag logic to strictly prefer perfect
matches over partial matches.

Caveat: Video role flags only supported for fixed track selections
(same issue as Issue: google/ExoPlayer#9519).

Issue: google/ExoPlayer#9402
PiperOrigin-RevId: 412292835
2021-12-02 11:55:44 +00:00
kimvde
a520e7f559 Miscellaneous small fixes in Transformer
PiperOrigin-RevId: 412286692
2021-12-02 11:55:44 +00:00
ibaker
a4c12ca97d Parse DASH forced-subtitle role value
Issue: google/ExoPlayer#9727

#minor-release

PiperOrigin-RevId: 412266397
2021-12-02 11:55:44 +00:00
samrobinson
2054b29089 Pull files from the device cache after a test concludes.
PiperOrigin-RevId: 412251020
2021-12-02 11:55:32 +00:00
tonihei
965062857d Move MediaMetricsListener creation to static constructor method.
This allows to check if the media metrics service is available outside
the actual constructor and to fail gracefully if it is missing.

PiperOrigin-RevId: 412232425
2021-12-02 10:14:27 +00:00
kimvde
b7f0071e8c Rename decoderInputFormat in transformer renderers
- This format is passed to the PassthroughPipeline, which doesn't use
  any decoder.
- In most other cases where it is used, it is not relevant that this
  format will be or has been passed to the decoder. What's relevant is
  that it is the format of the input.

PiperOrigin-RevId: 412093371
2021-12-02 10:12:40 +00:00
samrobinson
e45140871e Derive test output video name from the TAG.
We need the filename of the output videos to be predictable, because
MobileHarness requires the exact filename to pull the file.

PiperOrigin-RevId: 412092347
2021-12-02 10:11:39 +00:00
huangdarwin
c18cbf1b22 Transformer: Move required Builder context to be a constructor arg.
Deprecates setContext() and moves the required Context arg into the constructor.

This way, the parameter can later be final and non-null, per the comment at:
79f03bb135/depot/google3/third_party/java_src/android_libs/media/libraries/transformer/src/main/java/androidx/media3/transformer/TranscodingTransformer.java (97L)

Also, fixes setOutputMimeType_unsupportedMimeType_throws by providing a context
in the builder, and updating the FrameworkMuxer#supportsOutputMimeType to catch
IllegalArgumentExceptions thrown by FrameworkMuxer#mimeTypeToMuxerOutputFormat.

PiperOrigin-RevId: 412053564
2021-12-02 10:09:52 +00:00
samrobinson
f637bb3d40 Remove usage of @ForOverride.
Fixes the gradle compilation failures.

Gradle dependencies need revising if we want to be using this, as
checkerframework is ahead of their latest version, such that we
can't compile.

PiperOrigin-RevId: 412004021
2021-12-02 10:07:54 +00:00
hschlueter
551a47e1fc Deduplicate transformer audio and video renderer implementations.
This change moves methods that are the same in
`TransformerAudioRenderer` and `TransformerVideoRenderer` to
`TransformerBaseRenderer`.

PiperOrigin-RevId: 411758928
2021-12-02 10:06:19 +00:00
tonihei
736ea9a148 Remove ExoPlayerImpl inheritance from BasePlayer.
This inheritance is really confusing because ExoPlayerImpl is not
a full Player interface implementation. It also claims to be an
ExoPlayer implementation in the Javadoc which isn't true in its
current state.

Removing the inheritance also allows to clean up some unused methods.

PiperOrigin-RevId: 411756963
2021-12-02 10:05:29 +00:00
kimvde
6adf41f03a Transformer: rename OpenGlFrameEditor to FrameEditor
PiperOrigin-RevId: 411751425
2021-12-02 10:04:27 +00:00
bachinger
f5d3900b6d Document that channelNameResourceId needs to be set
This is documented on the setter already, but it seems to make sense to do this in the constructor as well for clarity.

Issue: google/ExoPlayer#9550
PiperOrigin-RevId: 411675700
2021-12-02 10:03:06 +00:00
bachinger
2749dbd3f5 Rename ServerSideInsertedAdMediaSource et al
PiperOrigin-RevId: 411657479
2021-12-02 10:01:59 +00:00
bachinger
dc887070c8 Don't drop updates of the playing period for skipped SSI ads
Before this change ExpPlayerImplInternal dropped a change of the playing period when a change in the timeline occurred that actually changed the playing period but we don't want to update the period queue. This logic also dropped the update of a skipped server side inserted preroll ad for which we want the periodQueue to 'seek' to the stream position after the preroll ad and trigger a SKIP discontinuity.

This change now introduces an exception so that a skipped SSI ad is still causing an update in the period queue which leads to a 'seek' and a discontinuity of type SKIP.

PiperOrigin-RevId: 411607299
2021-12-02 09:58:49 +00:00
tonihei
039eef00bf Add aquaman to devices needing setOutputSurface workaround.
Issue: google/ExoPlayer#9710
PiperOrigin-RevId: 411568601
2021-11-22 17:21:14 +00:00
samrobinson
05db03b8ad Change RepeatedTranscode test to attempt no audio or no video.
Test failure message now also reports the number of different sizes.

PiperOrigin-RevId: 411529648
2021-11-22 17:21:14 +00:00
samrobinson
d6cddf9ac1 Add a 120s timeout to transformer running within instrumentation tests.
PiperOrigin-RevId: 411526089
2021-11-22 17:21:14 +00:00
tonihei
343279b213 Add MediaMetricsListener class.
PiperOrigin-RevId: 411517319
2021-11-22 17:21:14 +00:00
andrewlewis
5b22b06ec4 Encapsulate attributes and uniforms within Program
Document that apps should retain `GlUtil.Program` while the program is in use,
and keep a reference to attributes/uniforms within the program to make sure
they don't get GC'd causing any allocated buffers passed to GL to become
invalid.

Tested manually by running gldemo and transformer.

PiperOrigin-RevId: 411516894
2021-11-22 17:21:14 +00:00
hschlueter
720b68dc9c Merge Transformer and TranscodingTransformer.
The features supported by `TranscodingTransformer` are a
superset of those supported by `Transformer` after merging
the video renderers in
35c891a7bf.
This change removes `TranscodingTransformer` and adds its features to
`Transformer`.

PiperOrigin-RevId: 411072392
2021-11-22 17:21:14 +00:00
hschlueter
51901ad568 Do not queue empty input buffers.
Follow-up to a comment on
ac8e418f3d
Buffers that are useful to pass to the sample/passthrough pipeline
should either contain data or the end of input flag. Otherwise, passing
these buffers along is unnecessary and may even cause the decoder to
allocate a new input buffer which is wasteful.

PiperOrigin-RevId: 411060709
2021-11-22 17:20:34 +00:00
Ian Baker
30caac6fc3 Merge pull request #9536 from TiVo:p-fix-issue-2882
PiperOrigin-RevId: 411056555
2021-11-22 17:00:01 +00:00
christosts
f594d914b5 Make SynchronousMediaCodecAdapter final
PiperOrigin-RevId: 411047838
2021-11-22 16:58:15 +00:00