998 Commits

Author SHA1 Message Date
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
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
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
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
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
Rakesh Kumar
8afa7a548a Fix review comments in RtpVP8Reader
Change-Id: Id47c746b199831d0bb51dc736c43fd20c2e79c08
2022-03-08 16:54:36 +05:30
bachinger
c7c7517322 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
2022-03-05 14:16:43 +00:00
olly
fdbae6379d Simplify application of track overrides
PiperOrigin-RevId: 432485797
2022-03-04 18:54:25 +00:00
olly
23db11453d DownloadHelper: Add getTracksInfo
We will be migrating our track selection UI components to be
based on TracksInfo. We need DownloadHelper to expose TracksInfo
to make it compatible with such components.

PiperOrigin-RevId: 432474487
2022-03-04 18:10:45 +00:00
christosts
1023b9d55e 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
2022-03-04 17:52:46 +00:00
claincly
6ae2629c60 Add method to disable passthrough.
PiperOrigin-RevId: 432461547
2022-03-04 17:15:16 +00:00
olly
0206622370 DownloadHelper: Support multiple track selection overrides
addTrackSelectionForSingleRenderer takes a list of legacy overrides,
which are then set on the supplied parameters one at a time to run
track selection. This allows multiple overrides for a single track
type to be applied in the download use case, despite it not being
possible to place such overrides directly into a single parameters.

For new style overrides, multiple overrides for the same track type
can be placed directly into a single parameters. Therefore we'll be
able to replace use of addTrackSelectionForSingleRenderer with use
of addTrackSelection, which is a much cleaner API. For this to work,
we need to make DownloadHelper apply multiple overrides in this case.

PiperOrigin-RevId: 432459834
2022-03-04 17:06:26 +00:00
samrobinson
0316c03319 Move AndroidTestUtil run methods to a TransformerAndroidTestRunner.
This will allow for easier customisation of the additional tasks
performed by the test runner, such as calculating metrics like SSIM.

PiperOrigin-RevId: 432434850
2022-03-04 14:52:55 +00:00
christosts
8e98187a1e Misc cleanup in session tests
PiperOrigin-RevId: 432430345
2022-03-04 14:24:42 +00:00
ibaker
c2a3249f98 Remove unused constants from (Styled/Legacy)PlayerView
These were added in
b57aa34b66
and then not removed when the rest of the code was removed in
0b0277af50

PiperOrigin-RevId: 432419684
2022-03-04 13:07:27 +00:00
ibaker
a353b3332a 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
2022-03-07 11:30:48 +00:00
christosts
45d512160c 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
2022-03-07 11:30:00 +00:00
andrewlewis
a73a9e9ca5 Fix E-AC3 output capability check without sample rate
#minor-release

PiperOrigin-RevId: 432189509
2022-03-07 11:29:06 +00:00
ibaker
232f2d815d 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
2022-03-07 11:28:25 +00:00
Rakesh Kumar
f2e0953643 Updated way to create a formatBuilder
Change-Id: I2c8eb8d6ee28d8c044d71db042f3b186ea5762f3
2022-03-03 19:59:56 +05:30
olly
2d3eea1e24 DownloadHelper: Accept generic TrackSelectionParameters
DownloadHelper is in the ExoPlayer module, so there's no reason
why it can't use ExoPlayer specific track selections. That said,
we want our UI components to operate on generic
TrackSelectionParameters, and we want such UI components to be
useful for selecting tracks for download. To keep this interop,
it's necessary to have DownloadHelper accept generic
TrackSelectionParameters, or to require application code to
convert them. The first approach seems preferable!

PiperOrigin-RevId: 432158846
2022-03-03 12:17:33 +00:00
bachinger
88cedf010c Avoid NPE in onStartCommand when action factory isn't instantiated
PiperOrigin-RevId: 431969914
2022-03-03 12:15:34 +00:00
olly
6c6e256cfb TrackSelectionOverride: Remove select-all-tracks constructor
This constructor always does the wrong thing for non-adaptive groups
containing more than 1 track, because it'll incorrectly generate an
adaptive selection. Replace it with a constructor for specifying a
single track within the group instead.

PiperOrigin-RevId: 431673458
2022-03-03 12:14:42 +00:00
hschlueter
273d80c4a0 Use asset with increasing timestamps for matrix transformation test.
PiperOrigin-RevId: 431658068
2022-03-03 12:13:46 +00:00
hschlueter
c96bcbb24b Avoid duplicate logging of GL exceptions.
Only log GL exceptions in GlUtil if they aren't thrown. Otherwise,
it's up to the caller whether or not to log them to avoid logging them
twice.

PiperOrigin-RevId: 431657397
2022-03-03 12:12:52 +00:00
hschlueter
0bc9470ce5 Don't delete textures before destroying OpenGL context.
Destroying the context destroys all of OpenGL (see
https://www.khronos.org/opengl/wiki/OpenGL_Context), so deleting
textures is redundant.

PiperOrigin-RevId: 431653728
2022-03-03 12:11:56 +00:00
hschlueter
422dfe0f95 Add an instrumentation unit test for TransformationFrameProcessor.
This test tests the same cases as the FrameEditorDataProcessingTest
as currently the main FrameEditor functionality is to apply a
transformation matrix using a TransformationFrameProcessor.

PiperOrigin-RevId: 431642066
2022-03-03 12:11:00 +00:00
samrobinson
d187df9afe Restructure regression androidTests, adding a 4k60 video and test.
Test list can be structured so tests don't need to be in different
classes, cleaning up the location of new test cases.

PiperOrigin-RevId: 431492941
2022-03-01 09:47:53 +00:00
claincly
50ac89eb82 Add SSIM support to AndroidTestUtil.
PiperOrigin-RevId: 431479473
2022-03-01 09:47:11 +00:00
hschlueter
da9aa4fded Use Color helper for packing in BitmapTestUtil.
PiperOrigin-RevId: 431451974
2022-03-01 09:46:31 +00:00
olly
68c310a94a TrackSelectionParameters: Simplify disabling of track types
As evidenced by the somewhat awkward logic in PlayerControlView, the
previous design wasn't very friendly to expected usage. There will be
more usage when the track selection dialog components are migrated,
which would be similarly awkward without this change.

PiperOrigin-RevId: 431407675
2022-03-01 09:45:38 +00:00
Ian Baker
c961ea1ca7 Merge pull request #10011 from tonykwok:dev-v2
PiperOrigin-RevId: 431395359
2022-03-01 09:44:52 +00:00
bachinger
9821dd282c 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
2022-03-01 09:43:55 +00:00
bachinger
8e8c59031c 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
2022-03-01 09:42:24 +00:00
claincly
f3cc75cf58 Add SSIM helper for transcoding quality measurements.
We use SSIM to measure the transcoding quality between. SSIM is a widely used
tool that compares the luma channel between two images, and generates a score
from 0 to 1 that indicates "how similar" the two images are.

In `SsimHelper`, we decode the two videos, extract matching frames and
calculates the mean SSIM (SSIM averaged all matching frames) for both videos.
Matching frames are referred to as "comparisonFrame" in the CL, which is
selected based on the frame number and a user-set comparison interval.
For instance, if the interval is 7, then every seventh frames are compared.

We use MediaCodec/MediaExtractor to decode the video, and use ImageReader to
extract the decoded frame.

The SSIM calculation logic is a inspired by and modified from the CTS
[MSSIMMatcher](https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/uirendering/src/android/uirendering/cts/bitmapcomparers/MSSIMComparer.java;l=1?q=mssimcom)
that has some errors and extra features we don't need (like handling RGB
images).

Adds TranscodeQualityTest to ensure high quality transcoding.

PiperOrigin-RevId: 430951206
2022-03-01 09:40:52 +00:00
samrobinson
8d852f3a99 Allow the difference Bitmap to be saved to device cache.
When investigating how 'bad' a failure is, it's useful to see the diff
between input and output bitmaps.

PiperOrigin-RevId: 430917732
2022-03-01 09:39:19 +00:00
ibaker
9748695e03 Rollback of 99d2b11329
*** Original commit ***

Rollback of caf62842c4

*** Original commit ***

Rollback of c2cb22a056

*** Original commit ***

Rollback of 1521e50307

*** Original commit ***

PiperOrigin-RevId: 430905772
2022-03-01 09:36:50 +00:00
olly
5a304fdbd9 FMP4: Fix output of mixed v0 and v1 emsg samples
Issue: google/ExoPlayer#9996
#minor-release
PiperOrigin-RevId: 430773329
2022-03-01 09:35:58 +00:00
christosts
4703ac80f6 Remove experimental flag for AsynchronousMediaCodecAdapter
The AsyncronousMediaCodecAdapter should call MediaCodec.start()
on the same thread it calls MediaCodec.flush(), i.e. the playback
thread. This change removes the experimental flag that allowed
calling MediaCodec.start() from the callback thread.

The flag was flipped to true already.

PiperOrigin-RevId: 430689665
2022-03-01 09:35:04 +00:00
ibaker
d5482fe343 Don't call MediaDrm.setLogSessionId in FrameworkMediaDrm
This method throws an UnsupportedOperationException on some Android 12
devices.

PiperOrigin-RevId: 430647264
2022-03-01 09:33:05 +00:00
Rakesh Kumar
f6a7cceaaf Add support for RTSP VP8
Added VP8 RTP packet reader and added support for VP8 playback
through RTSP.

Change-Id: Ie22ab79a234f61681cf95886a6ed8104a742f056
2022-02-24 21:02:41 +05:30
ibaker
850bd69ddd Version bump to exoplayer:2.17.0 and media3:1.0.0-alpha02
#minor-release

PiperOrigin-RevId: 430456963
2022-02-23 16:46:17 +00:00
ibaker
f92ae23dd8 Version bump to exoplayer:2.17.0 and media3:1.0.0-alpha02
#minor-release

PiperOrigin-RevId: 430456963
2022-02-23 16:22:43 +00:00