12957 Commits

Author SHA1 Message Date
bachinger
2bc65f9463 Integrate IMA SSAI samples in main demo app
PiperOrigin-RevId: 429059793
2022-02-17 14:24:02 +00:00
bachinger
d419914989 Make AdsLoader.State implement Bundleable
This allows the AdsLoader.State to be stored in savedInstanceState

#minor-release

PiperOrigin-RevId: 429057697
2022-02-17 14:24:02 +00:00
samrobinson
2ccaaaef86 Add exception information to AndroidTest analysis file.
Tested:
  Verified that the additional information is available through
  instrumentation tests, as well as via manual testing.

#mse-bug-week

PiperOrigin-RevId: 429038695
2022-02-17 14:24:02 +00:00
andrewlewis
e32dabc976 Skip tests requiring out of order muxing pre API 25
PiperOrigin-RevId: 429029496
2022-02-17 14:24:02 +00:00
bachinger
ecbd361492 Copy playback configuration when creating the content media item
#minor-release

PiperOrigin-RevId: 429006934
2022-02-17 14:24:02 +00:00
kimvde
09230a67f7 Handle player release timing out in transformer
- The resources were released twice before, which is not necessary since
  the MSG_RELEASE message is already in the internal player queue.
- The demo app was failing because the stop watch was stopped in
  onTransformationError after being reset.

#minor-release
#mse-bug-week

PiperOrigin-RevId: 428794426
2022-02-17 14:24:02 +00:00
olly
8e7ab9c811 Add TracksInfo methods for track selection UI
We need TracksInfo.hasTracksOfType to determine which tabs to
display in TrackSelectionDialog.

We need TrackGroupInfo.isAdaptiveSupported to determine whether
to allow multiple selection (check boxes) or not (radio buttons).

PiperOrigin-RevId: 428793739
2022-02-17 14:24:02 +00:00
hschlueter
82cdfc680b Split GlFrameProcessor out of FrameEditor.
The GlFrameProcessor handles everything related to the GLSL program,
the FrameEditor manages the GL context and the data flow including
the input SurfaceTexture and output EGLSurface.

This will be split up further in follow-up CLs so that
GlFrameProcessors can be chained. At this CL, there are no
functional changes intended.

PiperOrigin-RevId: 428779179
2022-02-17 14:24:02 +00:00
bachinger
1fcb4e8b0e Store ad playback state in AdsLoader for resume after backgrounding
#minor-release

PiperOrigin-RevId: 428763656
2022-02-17 14:24:02 +00:00
hschlueter
c65e5cfef8 Track presentation timestamps in FrameEditor.
PiperOrigin-RevId: 428763554
2022-02-17 14:24:02 +00:00
bachinger
0619a96fa2 Disable IMA SSAI DASH live streams for now
#minor-release

PiperOrigin-RevId: 428761508
2022-02-17 14:24:02 +00:00
huangdarwin
a08517e1d8 Transformer GL: Update TODOs.
Document some suboptimal things, and remove TODOs that were
fixed already or no longer relevant. Comment-only change.

PiperOrigin-RevId: 428749344
2022-02-17 14:24:02 +00:00
olly
daf72f518c Flatten TrackSelectionParameters
PiperOrigin-RevId: 428747243
2022-02-17 14:24:02 +00:00
bachinger
de3708ee12 Prevent adding multiple IMA SSAI media source instances to the playlist
Currently only a single instance of ImaServerSideAdInsertionMediaSource is
supported at the same time in a playlist. This change makes sure that an
attempt to add multiple instances is prevented by throwing a an exception.

#minor-release

PiperOrigin-RevId: 428743140
2022-02-17 14:24:02 +00:00
bachinger
940e934b58 Skip played server side inserted ads in a single period window
This change makes sure played server side ads are skipped in a single period
timeline. It avoids creating an ad-MediaPeriodInfo for played postrolls and
creates a content info instead. It also sets the end position for content infos
that terminate the stream before the stream is actually finished. This prevents
the player from continue playing the remaining media delivered by the
MediaPeriod.

We also make sure that the discontinuity of played ads are not reported because
there is actually no discontinuity.

#minor-release

PiperOrigin-RevId: 428734387
2022-02-17 14:24:02 +00:00
hschlueter
9ff736b192 Remove old TODO.
PiperOrigin-RevId: 428732950
2022-02-17 14:24:02 +00:00
bachinger
3b39e3bd19 Do not manipulate the duration of SSAI periods in FakeTimeline
#minor-release

PiperOrigin-RevId: 428727560
2022-02-17 14:24:02 +00:00
bachinger
13db1e739e Reset stream manager in AdsLoader.release()
This prevents a stack trace that is shown in the logs when the stream manager is
released after the activity was stopped. In this case the call to
`streamManager.destroy()` coming from `releaseSourceInternal()` of the media
source is too late and produces an error saying `Application attempted to call on
a destroyed WebView`. The error has no effect but it's nice to not have this
stack trace in the logs.

PiperOrigin-RevId: 428574231
2022-02-17 14:23:57 +00:00
bachinger
b15c5634e6 Make AdsLoader.addMediaSourceResources package private.
#minor-release

PiperOrigin-RevId: 428565444
2022-02-17 11:57:54 +00:00
andrewlewis
fd2093956f Fix debug frame showing through player on old devices
PiperOrigin-RevId: 428524300
2022-02-17 11:54:28 +00:00
olly
c90745d956 Add getFormat and length to TrackGroupInfo
PiperOrigin-RevId: 428520090
2022-02-17 11:51:07 +00:00
hschlueter
11f1ebb347 Add glClear call before drawing.
PiperOrigin-RevId: 428492031
2022-02-17 11:47:45 +00:00
bachinger
3a7f73f1e2 Seek to start position when reusing the last used shared period
The last used shared media period is reused after all media periods have been
released. In case the sample streams are already filled up, they need to be
reset or they download samples from the current position up to the seek
position. This causes long buffering states or load stuck exceptions.

A seek when reusing the shared period takes care for reseting the period or
internally seeks to the current position in the already available samples.

#minor-release

PiperOrigin-RevId: 428484187
2022-02-17 11:44:22 +00:00
tonihei
7907f4e047 Make usage of live minDurationForQualityIncrease more consistent
We have two ways to choose the minDurationForQualityIncreaseMs value in
AdaptiveTrackSelection: use the configured value for non-live or when
enough buffered data is available, or use a fraction of the available
duration to allow switching when playing close to the live edge.

The decision point when to use which value isn't quite consistent because
we compare against availableDurationUs before making the adjustments. This
means there is range of values where no up-switching is possible despite
perfect buffering. Fix this by choosing the minimum of both values.

Issue: google/ExoPlayer#9784

#minor-release

PiperOrigin-RevId: 428474332
2022-02-17 11:41:01 +00:00
bachinger
1e66483b3e Use content timeline to get ad group index and ad index in ad group
The timeline used to map ad groups to periods needs to report the original content period duration without subtracting the serverside inserted ad duration. When marking played ads in onPositionDiscontinuity, the public timeline has been used which crashed the app when the ads media source is playing on a window index different to zero (in a playlist).

#minor-release

PiperOrigin-RevId: 428465833
2022-02-17 11:37:38 +00:00
olly
b6317837e2 Rewrite AnalyticsCollector to use new track APIs
PiperOrigin-RevId: 428455848
2022-02-17 11:34:08 +00:00
andrewlewis
748e2a5ff8 Improve transformer activity layout
On Samsung S21 with light theme the debug labels weren't showing up because the player view was visible (with a black background) while the transformation was in progress, matching the debug label text color. Hide the player view until the transformation is complete to fix this.

Also tweak the layout slightly to add space between the card border and the labels.

#mse-bug-week

PiperOrigin-RevId: 428455824
2022-02-17 11:30:42 +00:00
krocard
1087b2f6f6 Do not reference AnalyticsCollector in common constructor
This prevents it to be stripped by R8 if a custom one is
passed.

#minor-release

PiperOrigin-RevId: 428034999
2022-02-17 11:27:07 +00:00
hschlueter
b3f92a8f5b Add helpers for FBOs in GlUtil.
FBOs will be used in follow-up CLs to chain multiple GL
shader programs in Transformer.

PiperOrigin-RevId: 428016050
2022-02-17 11:23:42 +00:00
bachinger
a7b0202712 Resolve media period ids in multi-period windows
Ignorable ad periods are skipped to resolve the media period id with the
ad playback state of the resulting period. In case of a change in the period
position un-played ad periods are rolled forward to be played.

PiperOrigin-RevId: 428011116
2022-02-17 11:16:56 +00:00
tonihei
00dbb780f1 Add some missing thread verifications
This adds some missing calls to verifyApplicationThread to
ExoPlayerImpl.

Now all public methods start with this call, except listener
registrations because registration after construction on a background
thread is allowed and supported.

PiperOrigin-RevId: 428009498
2022-02-17 11:13:31 +00:00
tonihei
8be677a426 Stop using SimpleExoPlayer for tests
The class is deprecated and all tests should preferably use the
non-deprecated code paths.

PiperOrigin-RevId: 428007986
2022-02-17 11:10:02 +00:00
tonihei
8792711d03 Set character limit for accessability strings to NONE
They are not normally displayed in any size-restricted UI element and don't
need a character limit.

#minor-release

PiperOrigin-RevId: 427998164
2022-02-17 11:06:41 +00:00
krocard
e5f2e44c29 Split AnalyticsCollector in interface and default Impl
This will allow R8 to strip out the implementation
if it is not needed for an app.

#minor-release

PiperOrigin-RevId: 427983730
2022-02-17 11:03:17 +00:00
huangdarwin
cacec8e02f Transformer GL: Implement auto-scaling to preserve input frame.
PiperOrigin-RevId: 427982223
2022-02-17 10:59:51 +00:00
kimvde
af647ed4a8 Remove Transformer deprecated methods that were never released
#minor-release

PiperOrigin-RevId: 427965501
2022-02-17 10:56:27 +00:00
huangdarwin
1ddfe194bf Rollback of 2848240a8c
*** Original commit ***

Update gradle wrapper

To fix transformer demo + Nexus emulator bug.

#minor-release

***

PiperOrigin-RevId: 427952642
2022-02-17 10:53:02 +00:00
tonihei
4b794e57ca Make ExoPlayerImpl an ExoPlayer implementation
All the functionality of SimpleExoPlayer has moved to ExoPlayerImpl.
Hence, ExoPlayerImpl can fulfil its own name and become an ExoPlayer
implementation. As a result, ExoPlayer.Builder can return ExoPlayerImpl
directly without using SimpleExoPlayer at all.

#minor-release

PiperOrigin-RevId: 427947028
2022-02-17 10:49:23 +00:00
olly
9f586d2bba Trim CodecDelay/PreSkip In New OpusDecoder Instances By Default
PiperOrigin-RevId: 427819209
2022-02-17 10:45:52 +00:00
olly
d5cb100762 Fix Sample Size For Supplemental Data In MatroskaExtractor
For when a track is both encrypted and has supplemental data, the sample size will be equal to `block sample size - encryption data size`.

PiperOrigin-RevId: 427807612
2022-02-17 10:42:28 +00:00
claincly
2a187cbf56 Disable setting profile/level for API level < 24.
We have seen devices running on API21/23 fail transcoding because of setting
encoding profile/level.

Some devices (ale-123/nexus 7) on API21 returns ENOSYS (Function not
implemented) when being configured with a profile setting. (although API21
introduced the capability of setting encoding profile)

Some devices (nexus 5) on API23 fails configuration with a specific parameter
set, despite advertising support for it.

Not setting the baseline profile has no effect on encoding, because when not
set, the encoding will pick a suitable profile to use. Since baseline is
the lowest possible profile, the auto-picked value can't be worse than
baseline.

Ref: b/218696352
PiperOrigin-RevId: 427792124
2022-02-17 10:39:04 +00:00
claincly
b66af2027c Add logging for exceptions thrown while configuring MediaCodec.
PiperOrigin-RevId: 427728320
2022-02-17 10:35:39 +00:00
claincly
3540b9d701 Fix the logic to get the max supported encoding level.
On some Android devices, the return value of

```
MediaCodecInfo.getCapabilitiesForType(mimeType).profileLevels
```

contains one entry for each encoding profile, like <profile, maxSupportedLevel>

but on some other devices, there are multiple entries for the same profile,

like <HIGH_PROFILE, LEVEL1>, <HIGH_PROFILE, LEVEL2>, <HIGH_PROFILE, LEVEL3>,
where we need to iterate through all the entries and find the max.

PiperOrigin-RevId: 427727030
2022-02-17 10:32:14 +00:00
tonihei
be19f0384c Add missing Javadoc for AudioAttributes.
#minor-release

PiperOrigin-RevId: 427712140
2022-02-17 10:28:34 +00:00
tonihei
643c426d86 Add documentation for server-side ad insertion.
PiperOrigin-RevId: 427679101
2022-02-17 10:25:04 +00:00
krocard
173787e8ce Fix DefaultAudioTrackBufferSizeProvider test
And move them in separate top level classes so that presubmit runs them.

#minor-release

PiperOrigin-RevId: 427482430
2022-02-17 10:21:17 +00:00
tonihei
36ef3328d9 Add missing events to AnalyticsListener.
And also add a test that all Player.Listener events are forwarded
to AnalyticsListener.

The AnalyticsCollector also needlessly implemented
Video/AudioRendererEventListener, which is not needed because all of
the equivalent methods are called directly and never through the
interface.

#minor-release

PiperOrigin-RevId: 427478000
2022-02-17 10:17:50 +00:00
olly
fd1e89dfa9 Fix incorrect parameter name
PiperOrigin-RevId: 427474975
2022-02-17 10:14:12 +00:00
kimvde
2f1eb816b7 Transformer: format test analysis file to JSON
PiperOrigin-RevId: 427469350
2022-02-17 10:10:33 +00:00
tonihei
1e2345cffe Simplify StreamRequest.Builder to an Uri Builder and make it public
Right now, the option to build an IMA DAI URI programmatically is still
package-private. To simplify the process, we can remove the StreamRequest
wrapper and directly provide an URI builder.

The same class can provide some package-private helper methods to parse the
created URI.

#minor-release

PiperOrigin-RevId: 427445326
2022-02-17 10:07:01 +00:00