14424 Commits

Author SHA1 Message Date
claincly
661d7ddedb Record transformation duration in TransformerAndroidTestRunner.
The change will be useful in testing transcoding performance

PiperOrigin-RevId: 432956283
2022-03-09 15:12:53 +00:00
samrobinson
3877171f18 Remove SSIM calculation on audio only output.
PiperOrigin-RevId: 432937645
2022-03-09 15:09:27 +00:00
samrobinson
8adc145fa2 Add regression test forcing encode/decode.
PiperOrigin-RevId: 432928418
2022-03-09 15:05:29 +00:00
claincly
e5c229be00 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:02:07 +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
347080fbe3 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.

PiperOrigin-RevId: 432646037
(cherry picked from commit 25e56804152ddd86ab782286a550ab34a3b7dd31)
2022-03-08 17:15:55 +00:00
ibaker
812b8d5f73 Remove media3 PlayerView javadoc references to overriding layouts
These should have been removed as part of 1391b7c65d, since we no
longer officially support overriding the layout file for this class.

This class is known as StyledPlayerView in exoplayer2.

#minor-release

PiperOrigin-RevId: 432411322
(cherry picked from commit 41276e8b9bcab15fb258efcbbc1edbb1634bbdab)
2022-03-08 17:14:58 +00:00
andrewlewis
657703e4b0 Fix E-AC3 output capability check without sample rate
PiperOrigin-RevId: 432189509
(cherry picked from commit e66d0c9039dec5d60afd930c10520db5ccf08121)
2022-03-08 17:14:55 +00:00
ibaker
71685dabf1 Deprecate SingleSampleMediaSource.Factory#setTrackId
This method is no longer needed since we added SubtitleConfiguration#id
in 59d98b9a4e.

Issue: google/ExoPlayer#10016

PiperOrigin-RevId: 432169262
(cherry picked from commit 540f2061cb963fe538e01776acf4a6df2ce47608)
2022-03-08 17:13:57 +00:00
ibaker
9f0351cbe5 More 2.17.0 release note fixes
PiperOrigin-RevId: 432154626
(cherry picked from commit 733cd609a0082d0e4072df3e5b7a8d22116a395b)
2022-03-08 17:12:57 +00:00
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
Ian Baker
9a50379194 Merge pull request #10011 from tonykwok:dev-v2
PiperOrigin-RevId: 431395359
(cherry picked from commit f66c9290ad0713dc0eb1a36ab8074e1a782ae30a)
2022-03-08 16:59:58 +00:00
ibaker
af89163883 Cross-reference the corresponding media3 and exoplayer releases
PiperOrigin-RevId: 431376857
(cherry picked from commit 95c74f048d3a33870b8889d0b16d2af7b2e9b616)
2022-03-08 16:59:58 +00:00
bachinger
885266d764 Drop ads for which we don't have metadata when joining a live stream
When a live stream is joined while ads are already playing, the LOADED event is
missed and we don't have ad information for those ads in the ad group that are
before the ad index at which we joined. This way we can clip the duration when we
receive the LOADED event for the last ad in the group. This fixes the problem of
the playback controls being hidden when content resumes after the ad group.

#minor-release

PiperOrigin-RevId: 431269627
(cherry picked from commit da00f0c6a97431e6e71aa245565f9b5ebb1c7ad8)
2022-03-08 16:59:58 +00:00
ibaker
2d3a7ec85f Remove unecessary git checkout command from README
The command is not needed, because the specified branch is already the
default branch on GitHub so will be checked out by clone automatically.

PiperOrigin-RevId: 430910549
(cherry picked from commit 6ed72dcdbc86d7b7959c5ad4d824bdc679f1454f)
2022-03-08 16:59:58 +00:00
olly
fbb2bcb953 FMP4: Fix output of mixed v0 and v1 emsg samples
Issue: google/ExoPlayer#9996
PiperOrigin-RevId: 430773329
(cherry picked from commit 1bc4ba29f5082997b509e9a22ae37df20457ea55)
2022-03-08 16:59:41 +00:00
christosts
4456a865cc Misc cleanup in session tests
PiperOrigin-RevId: 432430345
(cherry picked from commit 8e98187a1e08167cbef08c94e632c8d84a4667f1)
2022-03-08 16:58:05 +00:00
ibaker
50550ab191 Remove media3 PlayerView javadoc references to overriding layouts
These should have been removed as part of 1391b7c65d, since we no
longer officially support overriding the layout file for this class.

This class is known as StyledPlayerView in exoplayer2.

#minor-release

PiperOrigin-RevId: 432411322
(cherry picked from commit a353b3332abefc798d9751f037e7ef7a78ecbeae)
2022-03-08 16:58:05 +00:00
christosts
25004f8988 Remove CountDownLatch from MockPlayer
The MockPlayer has a single CountDownLatch field and multiple boolean
flags that track if a player method was called. Upon calling the methods
the latch count. Tests set the latch count to match exactly with the
number of expected player interactions then block the test thread until
the latch reaches zero and assert the respective method flags are true.

This is subject to false positives. If the underneath implementation
changes and call more player method, then the test thread will unblock
as soon as a certain number of interactions is performed, which may be
less than what the test expected originally. However, the test may stil
pass if the player thread had enough time to update the expected method
flag.

This change removes the single CountDownLatch and the boolean flags and
instead it adds APIs to query the MockPlayer if a method has been called
and await until a method is called. Internally, the MockPlayer has a
ConditionVariable per method.

PiperOrigin-RevId: 432399077
(cherry picked from commit 45d512160c7c14eda33785a632a1fc3eebc9769d)
2022-03-08 16:58:05 +00:00
andrewlewis
7afaf97489 Fix E-AC3 output capability check without sample rate
#minor-release

PiperOrigin-RevId: 432189509
(cherry picked from commit a73a9e9ca5e1a93518443e3e20953727a4189e9a)
2022-03-08 16:58:05 +00:00
ibaker
d20160d751 Deprecate SingleSampleMediaSource.Factory#setTrackId
This method is no longer needed since we added SubtitleConfiguration#id
in 59d98b9a4e.

Issue: google/ExoPlayer#10016

#minor-release

PiperOrigin-RevId: 432169262
(cherry picked from commit 232f2d815d4bf306bddca033b8b5a1454af8601f)
2022-03-08 16:58:05 +00:00
ibaker
8e386ef21c More 2.17.0 release note fixes
#minor-release

PiperOrigin-RevId: 432154626
(cherry picked from commit 986928a89c7291ce997153e1b9351f2b4fb94f69)
2022-03-08 16:58:05 +00:00
Ian Baker
49e6fa805a Merge pull request #10011 from tonykwok:dev-v2
PiperOrigin-RevId: 431395359
(cherry picked from commit c961ea1ca7c119b309456033021434dd38ad0e84)
2022-03-08 16:58:05 +00:00
bachinger
291c95daa0 Accept page index 0 for getChildren() in MediaLibraryServiceLegacyStub
This is consistent with the new MediaSessionStub that accepts page index 0
and the JavaDoc of legacy and new service callbacks.

Issue: androidx/media#32
PiperOrigin-RevId: 431390454
(cherry picked from commit 9821dd282c05dde945d787b8c1d4259fbc22bfef)
2022-03-08 16:58:05 +00:00
ibaker
405795ca98 Cross-reference the corresponding media3 and exoplayer releases
PiperOrigin-RevId: 431376857
(cherry picked from commit 3e9dfaa5865217420c2ac5dc8f103a7c2d9f152d)
2022-03-08 16:58:05 +00:00
bachinger
6f5206cd76 Drop ads for which we don't have metadata when joining a live stream
When a live stream is joined while ads are already playing, the LOADED event is
missed and we don't have ad information for those ads in the ad group that are
before the ad index at which we joined. This way we can clip the duration when we
receive the LOADED event for the last ad in the group. This fixes the problem of
the playback controls being hidden when content resumes after the ad group.

#minor-release

PiperOrigin-RevId: 431269627
(cherry picked from commit 8e8c59031c328e4c64a16193732078568712a632)
2022-03-08 16:58:05 +00:00
ibaker
bc1bcab553 Remove exoplayer-only release note from media3
There's no media3 equivalent to the
`com.google.android.exoplayer:exoplayer` dependency.

PiperOrigin-RevId: 430955037
(cherry picked from commit 8ae74ad873e18cd8510b9a398a264b3359766347)
2022-03-08 16:58:05 +00:00
ibaker
ca50beee6c Remove duplicate media3 release note and fix formatting
PiperOrigin-RevId: 430946606
(cherry picked from commit 5d0c7b91d042970811b5fcc095c4148542b31cf8)
2022-03-08 16:58:04 +00:00
ibaker
a8fd90ec84 Update media3 docs with details of new release branch
PiperOrigin-RevId: 430911179
(cherry picked from commit 7d389361063059656ee54c7297c99a76683b19bd)
2022-03-08 16:58:04 +00:00
ibaker
16819edebd Remove unecessary git checkout command from README
The command is not needed, because the specified branch is already the
default branch on GitHub so will be checked out by clone automatically.

PiperOrigin-RevId: 430910549
(cherry picked from commit d34221519d907f002abce245a3450ccacf988de8)
2022-03-08 16:58:04 +00:00
olly
d10700456d FMP4: Fix output of mixed v0 and v1 emsg samples
Issue: google/ExoPlayer#9996
#minor-release
PiperOrigin-RevId: 430773329
(cherry picked from commit 5a304fdbd9bc8af8229b1a9cddc79f359fe8e215)
2022-03-08 16:58:04 +00:00
ibaker
7125a3361b Update the gradle wrapper scripts
Generated by running:
./gradlew wrapper --gradle-version 7.4 --distribution-type all

#minor-release

PiperOrigin-RevId: 430666317
(cherry picked from commit 92af42bf2588e9f9a102b8f6812e140e077f2d6a)
2022-03-08 16:58:04 +00:00
ibaker
c5b046900d Update gradle wrapper to 7.4
#minor-release

PiperOrigin-RevId: 430454251
(cherry picked from commit e8096f07b9a458310589685b6019d5d79cbde433)
2022-03-08 16:58:04 +00:00
ibaker
715a00ac5b Update the gradle wrapper scripts
Generated by running:
./gradlew wrapper --gradle-version 7.4 --distribution-type all

#minor-release

PiperOrigin-RevId: 430666317
(cherry picked from commit 8416f465ee7fa4b8d1e46201cdf777dc9d1dafc8)
2022-03-08 16:57:53 +00:00
ibaker
c375600893 Update gradle wrapper to 7.4
#minor-release

PiperOrigin-RevId: 430454251
(cherry picked from commit f310a57a30b4f13aaf7f44d3d2d591801cba3c3e)
2022-03-08 16:57:53 +00:00