945 Commits

Author SHA1 Message Date
claincly
12543a9682 Split method findEncoderWithClosestFormatSupport.
Add checking for bitrate mode settings.
Add logging to the encoder filtering.

PiperOrigin-RevId: 435662418
2022-03-18 16:43:26 +00:00
andrewlewis
db0093f4c8 Remove AMR NB encoding from SSIM quality test
This currently causes the test to fail on Pixel 6 Pro running a recent S build
SQ1D.220205.004.

There is no need to test audio transcoding while we are measuring video
quality.

PiperOrigin-RevId: 435635314
2022-03-18 14:42:49 +00:00
hschlueter
96f8771de0 Always use FrameEditor for Nexus 5 and Moto Z Play.
PiperOrigin-RevId: 435628703
2022-03-18 14:10:07 +00:00
claincly
e476337dd5 Add encoding options.
PiperOrigin-RevId: 435398814
2022-03-17 18:22:42 +00:00
huangdarwin
481b9bd63d Transformer: Split javadoc summary fragment and descriptive text.
PiperOrigin-RevId: 435368283
2022-03-17 16:33:35 +00:00
bachinger
3848595377 Remove rounding errors of ad durations when converting from double
#minor-release

PiperOrigin-RevId: 435360232
2022-03-17 16:02:00 +00:00
christosts
c016978a6c Hide media notification when nothing to play
With this change, the MediaNotificationManager stops MediaSessionService
and hides any notifications if the player has no media items or the
player hasn't been prepared yet.

PiperOrigin-RevId: 435349363
2022-03-17 15:13:46 +00:00
olly
5d8ac644a6 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
hschlueter
c74b16e9f4 Add missing exception checks after EGL14 calls in GlUtil.
PiperOrigin-RevId: 435308470
2022-03-17 11:23:46 +00:00
hschlueter
b2b27dc571 Fix FrameEditor intermediate texture size.
ExternalCopyFrameProcessor's output dimensions match the input
size not the output size. So the intermediate texture size
should match the input size.

Also rename configureOutputDimensions to configureOutputSize.

PiperOrigin-RevId: 435058789
2022-03-16 15:36:06 +00:00
olly
845b55d230 Migrate from strongly discouraged @Test(expected = ...) to assertThrows(...).
More info: go/lsc-assertthrows and go/assertthrows

NOTE: if the source of truth for this code is _NOT_ `//third_party/`, please ask for this CL to be reverted.

Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:434925976:BASE:434869111:1647399186064:de338189
PiperOrigin-RevId: 435047509
2022-03-16 14:46:13 +00:00
claincly
191629ed7c Making mediaCodecName @NonNull in DefaultCodec constructor.
PiperOrigin-RevId: 435045138
2022-03-16 14:34:52 +00:00
aquilescanta
1a6e176873 Rework if condition to avoid NewApi lint error
Some infra thinks the if does not protect against API incompatibilities
(example: Android's soong build system). AndroidStudio 2021.3.1 also
signals a warning.

#minor-release

PiperOrigin-RevId: 435027073
2022-03-16 13:01:35 +00:00
claincly
1b3838cb0e Add test for DefaultEncoderFactory.
PiperOrigin-RevId: 435009545
2022-03-16 11:10:06 +00:00
olly
298e61398e Improve EventLogger metadata logging
1. Fix indentation
2. Fix intention to only log one Metadata block

PiperOrigin-RevId: 434818209
2022-03-15 19:02:41 +00:00
huangdarwin
03c02b8b5d Transformer: Use Size for output dimensions.
Use android.util.Size, whose naming is much easier to understand than Pair<Integer, Integer>, in both FrameProcessor and EncoderUtil.

PiperOrigin-RevId: 434813986
2022-03-15 18:48:25 +00:00
samrobinson
fb03db8108 Add analysisException field to TransformationTestResult new Builder.
Having this in place means that analysis exceptions can be swallowed
or thrown as needed.

PiperOrigin-RevId: 434788802
2022-03-15 17:26:52 +00:00
huangdarwin
72aca58286 Transformer GL: Split out ScaleToFit and Advanced GlFrameProcessors
* Move auto-adjustments for transformation matrices from the
  VideoTranscodingSamplePipeline constructor to the new
  ScaleToFitFrameProcessor.
* Add GlFrameProcessor#getOutputDimensions() to allow for GlFrameProcessors with
  different input and output dimensions. This is a prerequisite for
  Presentation.
* Tested with unit tests (and manually just in case).
* A follow up CL will implement change the FrameProcessor input to be scale and
  rotate values as requested by the user. This was kept out of this CL to
  reduce CL review size. Presentation will also be implemented in a follow up
  CL.

PiperOrigin-RevId: 434774854
2022-03-15 16:36:52 +00:00
huangdarwin
628a8dd4fc Transformer: Add javadoc to VideoTranscodingSamplePipeline.
As pointed out in a previous review, createFallbackTransformationRequest
can be a bit confusing to parse.

Added javadocs and renamed parameters appropriately, to make it slightly
more easy to understand.

PiperOrigin-RevId: 434733313
2022-03-15 13:24:28 +00:00
Shraddha Basantwani
ac528d3ab0 Add support for RTSP PCM/WAV and G711/WAV
Added PCM RTP packet reader and added support for PCM 8 bit,
16 bit, ALAW and MULAW playback through RTSP.

Change-Id: If0a187b55faa89850a159e17eae28358d6634799
2022-03-15 18:51:57 +05:30
olly
29fb77ea3a Rollback of 98e039d872
*** Original commit ***

Rollback of aa22bc2dbe

*** Original commit ***

Fix PlayerView touch handling

Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClick...

***

PiperOrigin-RevId: 434502423
2022-03-14 17:29:56 +00:00
aquilescanta
06da55527f Force CMake version 3.21.0+ for the FFMPEG extension
Issue: google/ExoPlayer#9933
#minor-release
PiperOrigin-RevId: 434449816
2022-03-14 13:42:31 +00:00
hschlueter
682a5ca77b Clarify GlProgram parameter name.
PiperOrigin-RevId: 434441008
2022-03-14 12:52:16 +00:00
ibaker
fb88a4fbe7 Fix stale javadoc in DashUtil
The type of this parameter was changed when it was moved from
OfflineLicenseHelper to DashUtil in
98f4fb85c2

PiperOrigin-RevId: 433770325
2022-03-10 17:15:49 +00:00
hschlueter
0e98c044da Move inputTexId parameter to GlFrameProcessor#initialize().
This parameter will not change between frames in the near
future.

PiperOrigin-RevId: 433765986
2022-03-24 17:24:14 +00:00
claincly
2e991acbdc Fix namings in SsimHelper.
There's no use of encoders in SsimHelper, changed all to "decoder".

PiperOrigin-RevId: 433730292
2022-03-24 17:22:12 +00:00
olly
2ea902c1b2 Move TrackSelection back to ExoPlayer module
PiperOrigin-RevId: 433729648
2022-03-24 17:21:11 +00:00
ibaker
50efd86619 Rollback of d5482fe343
*** Original commit ***

Don't call MediaDrm.setLogSessionId in FrameworkMediaDrm

This method throws an UnsupportedOperationException on some Android 12
devices.

***

PiperOrigin-RevId: 433708582
2022-03-24 17:19:59 +00:00
huangdarwin
0587a4f9c4 Transformer GL: Rename TexCoords to TexSampleCoords.
The variable marks the coordinates used to sample from a texture, so hopefully
this makes the naming a bit more descriptive.

This renames vTexCoords and aTexCoords. No functional changes intended.

PiperOrigin-RevId: 433499934
2022-03-09 17:38:35 +00:00
bachinger
e531e788df Transform map of AdsLoader.State to a Bundle
This fixes an exception thrown when parceling becasue the type can not be found
(expects the AdsPlaybackState to be Serializable). Transforming the map and the
ad playback states to a Bundle fixes the problem.

#minor-release

PiperOrigin-RevId: 433491993
2022-03-09 17:37:34 +00:00
ibaker
583249345a Version bump to exoplayer:2.17.1 and media3:1.0.0-alpha03
#minor-release

PiperOrigin-RevId: 433467068
(cherry picked from commit af6f6bb40666d5c27fd4274ad5e3479cf593ce04)
2022-03-09 16:38:20 +00:00
huangdarwin
d06d690d78 Transformer GL: Remove unused setResolution exception javadoc.
PiperOrigin-RevId: 433467719
2022-03-09 14:55:33 +00:00
ibaker
af6f6bb406 Version bump to exoplayer:2.17.1 and media3:1.0.0-alpha03
#minor-release

PiperOrigin-RevId: 433467068
2022-03-09 14:51:19 +00:00
bachinger
e5d1466731 Avoid rebuffering at the end of SSAI post-rolls
When the start position of a MediaPeriodInfo is equal or higher than the duration,
we set the start position to `duration - 1` to end on the last frame. With server
side inserted ad streams, this has the effect that we actually need to seek back to
the last content frame after a post-roll.

This is desirable when actually ending on that frame but produces a BUFFERING event
when transitioning from an SSAI stream with a post-roll to the next media item in
the playlist. This change sets the start position to the duration when we are
clipping the last content period of an SSAI stream that is played in a playlist.

PiperOrigin-RevId: 433445680
2022-03-09 12:22:02 +00:00
hschlueter
140be836dd Use background thread for FrameEditor's OpenGL calls.
If an OpenGL call blocks because the encoder's input surface is full,
this will now block the background thread while the main thread can
continue querying encoder output and free up encoder capacity until
it accepts more input unblocking the background thread.

PiperOrigin-RevId: 433283287
2022-03-09 15:12:28 +00:00
olly
98e039d872 Rollback of aa22bc2dbe
*** Original commit ***

Fix PlayerView touch handling

Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClickListener when
   useController is false.
3. Delivery of events to a registered OnLongClickListener
   in all configurations.
4. Incorrectly treating a sequence of touch events that
   exit the bounds of the vi...

***

PiperOrigin-RevId: 433262414
2022-03-09 15:11:23 +00:00
samrobinson
3ef4f6ff24 Disable calculating SSIM on instrumentation tests.
PiperOrigin-RevId: 433237266
2022-03-09 15:10:24 +00:00
christosts
b94ca4f2ad Only COMMAND_PLAY starts the service in the foreground
This change makes all notification actions start MediaSessionService
in the background except COMMAND_PLAY which starts the service
in the foreground. This is to avoid ANRs that are raised if we don't
call MediaSessionService.startForeground() within 5 seconds since the
service was started in the foreground.

We only call MediaSessionService.startForeground() when
Player.getPlayWhenReady() returns true, and only COMMAND_PLAY sets
playWhenReady to true.

Issue: androidx/media#20

#minor-release

PiperOrigin-RevId: 433229604
2022-03-09 15:09:27 +00:00
claincly
2f4630a8e8 Improve resolution fallback logic.
With the new version, we try the following before fixing resolution:

- Fix size alignment
- Try 3/4 the width and height
- Try 2/3 the width and height
- Try 1/2 the width and height

Also: align the resolution ends in 1 or 9 to 0.
PiperOrigin-RevId: 433206358
2022-03-09 15:08:15 +00:00
samrobinson
a349f311d4 Nit cleanup of SsimHelper.
PiperOrigin-RevId: 433174767
2022-03-09 15:07:15 +00:00
christosts
fae8097aca Custom notification actions start the service in background
PiperOrigin-RevId: 433172330
2022-03-09 15:06:07 +00:00
olly
aa22bc2dbe Fix PlayerView touch handling
Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClickListener when
   useController is false.
3. Delivery of events to a registered OnLongClickListener
   in all configurations.
4. Incorrectly treating a sequence of touch events that
   exit the bounds of the view before ACTION_UP as a click,
   both for delivery to OnClickListener and for toggling
   the controls.

Note: After this change, control visibility will not be
toggled if the application developer explicitly sets the
view to be non-clickable. I think that's probably working
as intended though. It seems correct that a non-clickable
view would not respond to clicks.

Issue: google/ExoPlayer#8627
Issue: google/ExoPlayer#9605
Issue: google/ExoPlayer#9861
PiperOrigin-RevId: 433016626
2022-03-09 15:05:07 +00:00
olly
08b861b61a Decouple UI module from ExoPlayer
This change rewrites the UI module's track selection
components to depend on the Player API, allowing us to
finally remove the UI module's dependency on ExoPlayer
as a concrete player implementation.

PiperOrigin-RevId: 432989318
2022-03-09 15:04:11 +00:00
claincly
5ab32b6e0d Record transformation duration in TransformerAndroidTestRunner.
The change will be useful in testing transcoding performance

PiperOrigin-RevId: 432956283
2022-03-09 15:03:10 +00:00
samrobinson
743c6cf5f8 Remove SSIM calculation on audio only output.
PiperOrigin-RevId: 432937645
2022-03-09 15:02:02 +00:00
samrobinson
04ed774bef Add regression test forcing encode/decode.
PiperOrigin-RevId: 432928418
2022-03-09 15:01:00 +00:00
claincly
461effc6c2 Use getSupportedWidth/HeightFor() API for finding resolution.
Previously, we've used getSupportedHeights/Widths() to find the supported
resolution. However, the height/width can be over-reported when using these
APIs. For example, getSupportedWidths and getSupportedHeights can both return
3840, but the supported height when using 3840 as width is only 2160.

PiperOrigin-RevId: 432926192
2022-03-09 15:00:00 +00:00
Manisha Jajoo
1761b423ca Fix review comments in RtpAmrReader 2022-03-09 13:55:58 +05:30
bachinger
dc83fae19d Ignore MetadataRenderer when evaluating SSAI period transitions
This makes the reading period advance early as expected at the end of an ad
period. Before this change the reading position of the metadata renderer
prevented advancing the period until metadata arrived after the start position of
the following period. Only then the reading position of the metadata renderer
is updated and beyond the start position of the following period which is a
condition to advance the reading period.

Because transitioning to the next period is a virtual transition and the
SharedMediaPeriod keeps reading from the same underlying sample streams, the
metadata renderer can safely be ignored for this check.

#minor-release

PiperOrigin-RevId: 432646037
(cherry picked from commit c7c75173224057defd031aa30bbf8346442700a6)
2022-03-08 17:11:59 +00:00
christosts
c56c6a2ea4 Start playback from notification
This change fixes two bugs where MediaSessionServe shows a notification
with the Play icon but tapping it will not start playback:
1. After playback ends: we need to seek to the beginning of the media
   item.
2. After adding media items to the player but not starting playback:
   We need to call Player.prepare() too.

PiperOrigin-RevId: 432469953
(cherry picked from commit 1023b9d55efe8f0470c5f3b75cd84e40860f79be)
2022-03-08 17:11:55 +00:00