Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMA shouldOverrideUrlLoading NPEs #8447

Closed
dbrain opened this issue Jan 12, 2021 · 20 comments
Closed

IMA shouldOverrideUrlLoading NPEs #8447

dbrain opened this issue Jan 12, 2021 · 20 comments
Assignees

Comments

@dbrain
Copy link
Contributor

dbrain commented Jan 12, 2021

Issue description

We are seeing a lot of NullPointerException's in Firebase coming from IMA in our latest release, containing ExoPlayer 2.12.0 and IMA 3.21.4 (Note: ExoPlayer specifies 3.21.0, so we've bumped it slightly).

GIven it's IMA and obfuscated it's hard to work out exactly what is going wrong from our perspective. It seems like at some point the WebView is triggering a URL load, which is causing IMA to call into components it thinks should not be null, but are at that point.

I'm guessing it's some kind of lifecycle thing, maybe ExoPlayer has detached when this event occurs or hasn't attached yet. Hoping someone who has worked with the IMA code could shed some light / point me in the right direction.

Reproduction steps

I have been so far unable to reproduce this, or find a specific flow making it happen.

Link to test content

Not content specific.

Stacktraces

Note, the actual crashes have repeats of this due to the way WebViews are implemented across devices.

Crash 1

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object com.google.ads.interactivemedia.v3.api.StreamRequest.getUserRequestContext()' on a null object reference
       at com.google.ads.interactivemedia.v3.internal.amr.c(IMASDK:3)
       at com.google.ads.interactivemedia.v3.internal.aog.d(IMASDK:66)
       at com.google.ads.interactivemedia.v3.internal.aom.d(IMASDK:5)
       at com.google.ads.interactivemedia.v3.internal.aoj.shouldOverrideUrlLoading(IMASDK:2)
       at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:77)
       at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-Monochrome.aab-stable-428010123:17)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:326)
       at android.os.Looper.loop(Looper.java:165)
       at android.app.ActivityThread.main(ActivityThread.java:6810)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

Crash 2

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.ads.interactivemedia.v3.internal.and.g()' on a null object reference
       at com.google.ads.interactivemedia.v3.internal.amr.a(IMASDK:2)
       at com.google.ads.interactivemedia.v3.internal.aog.d(IMASDK:71)
       at com.google.ads.interactivemedia.v3.internal.aom.d(IMASDK:5)
       at com.google.ads.interactivemedia.v3.internal.aoj.shouldOverrideUrlLoading(IMASDK:2)
       at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:77)
       at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-Monochrome.aab-stable-428014120:17)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:326)
       at android.os.Looper.loop(Looper.java:183)
       at android.app.ActivityThread.main(ActivityThread.java:7258)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

Version of ExoPlayer being used

2.12.0 with IMA 3.21.4

Device(s) and version(s) of Android being used

Device and OS independent

@andrewlewis
Copy link
Collaborator

andrewlewis commented Jan 12, 2021

The mention of StreamRequest.getUserRequestContext() suggests that the use case is server-side ad insertion/DAI. Could you confirm whether that's expected?

If so I think this needs to be investigated by the IMA SDK team, so you could post a description of the problem here.

@dbrain
Copy link
Contributor Author

dbrain commented Jan 12, 2021

@andrewlewis Sorry, I should have clarified in the description. We do not use DAI, just plain old IMA via VAST/VMAP.

Given the IMA SDK is trying to hit a null StreamRequest, maybe it's some backup flow? Hard to tell with the obfuscated IMA code.

@andrewlewis
Copy link
Collaborator

I've asked the IMA SDK team to take a look in [internal: b/177294971] and will plan to keep this issue updated if we learn more. Thanks.

@andrewlewis
Copy link
Collaborator

There's a fix for the NullPointerException which will hopefully go into the next IMA SDK release (I'd guess this will be 3.22.1 as it just missed the 3.22.0 release -- here's the repository). Although this will fix the NPE, without details about how the error was triggered, it's hard to say what the root cause could be. With the fix, it's possible that a more informative error will be propagated to allow diagnosing what's going on.

@dbrain
Copy link
Contributor Author

dbrain commented Jan 13, 2021

Great, thanks @andrewlewis. I will update this issue when we've had a chance to roll out after the next IMA release.

@dbrain
Copy link
Contributor Author

dbrain commented Jan 13, 2021

Sorry, @andrewlewis, one thing I forgot to ask. Will it be safe to update IMA without waiting for an ExoPlayer release? Specially will ExoPlayer 2.12.2 support 3.22.0 (and 3.22.1, assuming minor fixes) without changes?

@andrewlewis
Copy link
Collaborator

Forcing the later version should be fine (I think there won't be any API incompatibilities, so it should only require the gradle change). I'd probably do a bit of manual testing anyway just to be safe.

@fpitters
Copy link

fpitters commented Mar 2, 2021

@andrewlewis do you know if this was included into 3.22.2?

I can't see anything on the changelog (https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/history)

@andrewlewis
Copy link
Collaborator

andrewlewis commented Mar 9, 2021

Sorry for the delay. The fix for the stack trace with getUserRequestContext is in 2.22 ("Fixes the error message when AdsLoader would receive an error without a valid session ID.").

Looking at the internal issue, I don't think the second crash has been diagnosed yet. I also added a note there about the crash reported in https://groups.google.com/g/ima-sdk/c/BvHHkeXvhL4, which appears to have a similar cause (missing session ID).

@andrewlewis andrewlewis reopened this Mar 9, 2021
@andrewlewis
Copy link
Collaborator

For crash 2, please could you provide an updated stack trace from a client using IMA SDK version 2.22? Thanks for the help tracking this down.

@fpitters
Copy link

fpitters commented Mar 10, 2021

Thank you for keeping track of this.

This is a report from Firebase using 3.22.2 with latest Exo 2.13.2.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider com.google.ads.interactivemedia.v3.api.AdsRequest.getContentProgressProvider()' on a null object reference
       at com.google.ads.interactivemedia.v3.internal.cw.a(cw.java:2)
       at com.google.ads.interactivemedia.v3.internal.em.e(em.java:71)
       at com.google.ads.interactivemedia.v3.internal.es.d(es.java:5)
       at com.google.ads.interactivemedia.v3.internal.ep.shouldOverrideUrlLoading(ep.java:2)
       at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:77)
       at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:15)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:326)
       at android.os.Looper.loop(Looper.java:181)
       at android.app.ActivityThread.main(ActivityThread.java:7050)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

@andrewlewis
Copy link
Collaborator

A fix has been submitted for this. I'll look out for the next IMA SDK update and hopefully we can get that into the next minor release.

@priscila225
Copy link

Nice @andrewlewis because I'm seeing this a lot on the latest crashlytics reports which are bad for the company I work for

@AlienAsRoger
Copy link

@fpitters looks like IMA SDK team has release a fix for the NPE crash https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/history
We will try to see if it's fixes our issue in production which is identical to your report.

@AlienAsRoger
Copy link

That update did not resolve the issue, we are still seeing this crash:

java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$4.done(AsyncTask.java:399)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at com.google.ads.interactivemedia.v3.internal.ea.a(ea:3)
        at com.google.ads.interactivemedia.v3.internal.dy.doInBackground(dy:2)
        at android.os.AsyncTask$3.call(AsyncTask.java:378)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

@andrewlewis
Copy link
Collaborator

andrewlewis commented Mar 19, 2021

@AlienAsRoger This crash looks like it has a different cause to the others based on the stack trace. Did you see an increase in this recently, or was it present on older versions too? The cause appears to be that BitmapFactory.decodeStream is returning null for the companion ad URL.

@AlienAsRoger
Copy link

@AlienAsRoger Did you see an increase in this recently, or was it present on older versions too?

It was present in the old version. I was thinking that they might have fixed 2 issues at once :)

icbaker pushed a commit that referenced this issue Mar 24, 2021
This brings in a fix for `NullPointerExceptions` within `WebView` callbacks in
the IMA SDK.

Issue: #8447
PiperOrigin-RevId: 363627446
marcbaechinger pushed a commit that referenced this issue Apr 9, 2021
This brings in another fix for `NullPointerExceptions` within `WebView` callbacks in the IMA SDK, related to companion ads.

Issue: #8447

#minor-release

PiperOrigin-RevId: 367591047
marcbaechinger pushed a commit that referenced this issue Apr 14, 2021
This brings in a fix for `NullPointerExceptions` within `WebView` callbacks in
the IMA SDK.

Issue: #8447
PiperOrigin-RevId: 363627446
marcbaechinger pushed a commit that referenced this issue Apr 14, 2021
This brings in another fix for `NullPointerExceptions` within `WebView` callbacks in the IMA SDK, related to companion ads.

Issue: #8447

#minor-release

PiperOrigin-RevId: 367591047
roblav96 pushed a commit to roblav96/ExoPlayer that referenced this issue Apr 17, 2021
This brings in a fix for `NullPointerExceptions` within `WebView` callbacks in
the IMA SDK.

Issue: google#8447
PiperOrigin-RevId: 363627446
roblav96 pushed a commit to roblav96/ExoPlayer that referenced this issue Apr 17, 2021
This brings in another fix for `NullPointerExceptions` within `WebView` callbacks in the IMA SDK, related to companion ads.

Issue: google#8447

#minor-release

PiperOrigin-RevId: 367591047
shenwill added a commit to shenwill/ExoPlayer that referenced this issue Apr 30, 2021
* Add buildUpon to MediaMetadata.

PiperOrigin-RevId: 364590789

* Add commands only available in SimpleExoPlayer

PiperOrigin-RevId: 364598601

* Improve commands Javadoc

PiperOrigin-RevId: 364600438

* Add 5G-NSA detection.

PiperOrigin-RevId: 364607555

* Add BundleUtil to remove androidx.core dependency

It's copied from BundleCompat in androidx.core.

PiperOrigin-RevId: 364682379

* Add missing switch case

Before this change, calling read after reaching the end of input in an Ogg file
would cause an IllegalStateException.

PiperOrigin-RevId: 364758873

* Add 5G-SA initial bitrate estimates to bandwidth meter.

PiperOrigin-RevId: 364810286

* Add command to seek to default position

PiperOrigin-RevId: 364821216

* Treat Dolby Vision as H264 in MCVR#getCodecMaxInputSize()

Issue: #8705
PiperOrigin-RevId: 364821429

* Add possibility to iterate over Commands

PiperOrigin-RevId: 364836973

* Support tts:shear in TTML parser and WebView output

* Add positions and new reasons to onPositionDiscontinuity

PiperOrigin-RevId: 364861539

* StyledPlayerControlView: Fix view measurement issue

The exo_controls_background view is supposed to fill its parent,
and so previously used match_parent to do this. However, if the
parent uses wrap_content for its own dimensions, the constraints
being specified become somewhat ambiguous. The parent is supposed
to be sizing itself to wrap its children, and one of the children
is supposed to be sizing itself to match the parent.

Intuitively for this case, you'd hope that the layout logic would
size the parent to wrap its other children, and that the
match_parent child would then fill the parent with its determined
size. That's not what happens, and instead the parent ends up
expanding to occupy all of the space available to it.

This commit sets the exo_controls_background view's dimensions
to be 0dp in the layout, to stop it from influencing the size of
the parent. It's then expanded to fill the parent in code.

Issue: #8726
#minor-release
PiperOrigin-RevId: 364868301

* Address code review comments

* Use playlist start time for target live offset

* DataSources: Remove position-out-of-range workarounds

PiperOrigin-RevId: 364871094

* Make StubExoPlayer not abstract

All Player methods should throw
NotSupportedException.
Making it abstract prevents the compiler catching
non implemented methods.

PiperOrigin-RevId: 364974387

* Move add/remove Player.Listener down of BasePlayer

The BasePlayer implementation of add/remove
Listener knows about Components.
As those are removed from the Player
interface, the implementation of those
methods needs to be moved down in Player
implementations.

This commit makes no functional change.

PiperOrigin-RevId: 364985291

* Add 5G-NSA detection for API 31+

The hacky workaround for APIs 29/30 doesn't work on API 31. Instead,
we can use the onDisplayInfoChanged callback, that is accessible from
API 31.

PiperOrigin-RevId: 364997282

* Document execution of unavailable command

PiperOrigin-RevId: 365044658

* Document that the order of cues passed to TextOutput is important

Fix WebViewSubtitleOutput to respect this (CanvasSubtitleOutput already
does).

Issue: #8704
PiperOrigin-RevId: 365534018

* Log error for TrackGroups with multiple languages or role flags.

A TrackGroup must contain the same content in all Formats (except for
the quality, encoding etc). Verify that the language and role flags
are the same and log an error if don't match. Don't throw to avoid
breaking existing use cases that just happen to work by chance.

PiperOrigin-RevId: 365539240

* Enable internal retry for recoverable codec exceptions

PiperOrigin-RevId: 365556167

* Make use of position discontinuity changes.

The extended onPositionDiscontinuity callback can be used to improve some
listener classes:
 - Listening to onTimelineChanged to detect discontinuities is no longer needed.
 - Listening to onSeekStarted is no longer needed as the start position is part
   of the onPositionDiscontinuty callback.
 - The exact old position is also useful for media time history logging.

As a side effect, removing onSeekStarted handling from PlaybackStatsListener
fixes Issue: #8675 that was caused by the special EventTime handling for
onSeekStarted.

PiperOrigin-RevId: 365558959

* Ensure callback can't access player before constructor finished.

If the player is created on a background thread (which is allowed
as the only exception to the access-on-one-thread-only rule), it
may happen that a callback on the main thread tries to access the
player before the constructor even finished. This is dangerous and
can cause exceptions due to uninitialized variables.

To solve this, we can make sure that every player access is blocked
until the constructor finished. Blocking is safe because the
constructor itself is not doing any blocking work or acquiring locks.

The thread verification method is already called on every entry
point to the player, so we can reuse the same method for checking.

PiperOrigin-RevId: 365792949

* Move @Ignore from class to methods in DashWidevineOfflineTest

PiperOrigin-RevId: 365794941

* Don't include video tracks without bitrate in adaptive selection.

This is generally not supported by our classes. A similar change for audio
was made in https://github.com/google/ExoPlayer/commit/aa2beb080c6f621264527a6147a258bdd7f0fa27.

PiperOrigin-RevId: 365795371

* Modify visibility of onQueueInputBuffer.

Aims to achieve visibility parity with MediaCodecRenderer#onQueueInputBuffer.

Allows measuring the time when the codec queue the first input buffer in the codec. Which means the Codec has been initialized and is about to start decoding.

It also allows measuring how long it takes for the Codec to render its first frame.

PiperOrigin-RevId: 365906756

* Fix DefaultExtractorInputTest.largeSkip

PiperOrigin-RevId: 365992439

* Deprecate AnalyticsListener.onSeekStarted.

The new onPositionDiscontinuity callback contains sufficient information, so
that this former workaround to obtain the position before a seek is no longer
needed.

PiperOrigin-RevId: 365993937

* Fix typo in Player#setMediaItems() Javadoc

PiperOrigin-RevId: 366015326

* [Cast] Notify media item transition only when playing period removed

When playback transitions automatically, the timeline may have changed because the cast device learned about the duration of the next media item and includes this in the new media status that is sent to the CastPlayer. In such a case we need to make sure that we don't report a media item transition with reason PLAYLIST_CHANGED but for reason AUTO.

PiperOrigin-RevId: 366025323

* Add test for emsg near to end of DASH period

The dumped output should include metadata, but doesn't because of
Issue: #8710. The fix is in a follow-up change.
PiperOrigin-RevId: 366028303

* Switch tests to use SimpleExoPlayer

PiperOrigin-RevId: 366033200

* Use Metadata.Entry.toString in PlaybackOutput test logging if possible

Add an allowlist of Metadata.Entry implementations with stable toString
overrides.

PiperOrigin-RevId: 366037505

* Update instructions for GMaven releasing

Issue: #5246

#minor-release

PiperOrigin-RevId: 366041182

* Release all PlaybackStatsListener session when timeline becomes empty.

Currently they are only released when the timeline becomes non-empty
again or the player is released.

Issue: #8778
PiperOrigin-RevId: 366041625

* Use outputStreamEnded for MetadataRenderer#isEnded

Issue: #8710
#minor-release
PiperOrigin-RevId: 366051836

* Delete unused surfacecapturer package

PiperOrigin-RevId: 366131005

* Add back jcenter() to repositories

The buildscript entry is required by
com.android.tools.build:gradle:4.0.1.

For other projects, it appears that org.checkerframework is
in jcenter.

Without this change building with gradlew is broken, at least.

#minor-release

PiperOrigin-RevId: 366222799

* Ensure constructor condition is unblocked even for unchecked exceptions

The condition is meant to be unblocked whenever the constructor is
left. This should include unchecked exceptions (that may be thrown
due to bugs in the dependent components, or user-inhected factories)

PiperOrigin-RevId: 366235361

* Add getMediaMetadata to Player and SimpleExoPlayer.

PiperOrigin-RevId: 366240390

* Ffmpeg extension: Wait for channel count and sample rate

When playing TrueHD streams, it's possible that the first decoded
buffer is empty, and that the channel count and sample rate are
still unknown. To correct for this, defer determining the format
until a buffer that will actually be output from the decoder has
been obtained, and only then query the channel count and sample
rate.

Issue: #8616
#minor-release
PiperOrigin-RevId: 366246245

* HLS: Set initial SampleQueue start times

This ensures BUFFER_FLAG_DECODE_ONLY is set on samples that are
before the playback start position, in the case that the queue
is created after the start position is set.

#minor-release

PiperOrigin-RevId: 366249188

* Fix SimpleExoPlayer documentation

I've removed the "by default" statements, since this now depends on how
the builder was configured.

PiperOrigin-RevId: 366249995

* Re-strip StableApiCandidate

PiperOrigin-RevId: 366255289

* Add isBlacklisted method to ExoTrackSelection interface.

Make BaseTrackSelection blacklist and isBlacklisted methods non-final.

PiperOrigin-RevId: 366256521

* HLS: Fix incorrect handling of byte ranges for EXT-X-MAP tags

Issue: #8783
#minor-release
PiperOrigin-RevId: 366265419

* Populate MediaMetadata title from IcyInfo and TextInformationFrame.

PiperOrigin-RevId: 366272937

* Suppress warnings in preparation for Checker Framework 3.12.0 upgrade.

LSC: go/checker-lsc

Tested:
    Sample tests for this CL passed, but some tests failed during the TGP run. Test failures are believed to be unrelated to this CL
PiperOrigin-RevId: 366804637

* Make ExoPlaybackException Bundleable

PiperOrigin-RevId: 366938045

* Remove pipelining from MetadataRenderer

This reverts
<unknown commit>

Which was a temporary workaround for Issue: #1874

Also add a loop to ensure we process as many metadata items as
applicable in each render() call.

PiperOrigin-RevId: 366965504

* StyledPlayerView: Fix layout issues

- Take centerControls padding into account to prevent switching to
  minimal mode too soon
- Disable clipping to padding to avoid the edges of controls from
  being clipped as the view gets smaller

Issue: #8763
PiperOrigin-RevId: 366966298

* Fix some dependencies

PiperOrigin-RevId: 366972832

* Call new onPositionDiscontinuity callback in CastPlayer

PiperOrigin-RevId: 367020270

* Fix 1 ErrorProneStyle finding:
* @Nullable is not a TYPE_USE annotation, so should appear before any modifiers and after Javadocs.
  (see go/java-style#s4.8.5-annotations)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Suggest a fix on the CL (go/how-to-suggest-fix).
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/exoplayer/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/exoplayer/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

PiperOrigin-RevId: 367053059

* Add Period.isPlaceholder to fix preparation issues for concatenation.

We added a source that allows mixed placeholder and non-placeholder
periods, but have no way to denote that in the Timeline because the
placeholder flag only exists on Window level. This causes a bug if
the first item in a concatenation has a window-period offset and the
player can't detect whether it's still a placeholder or not.

Adding this flag to Period allows the player to detect this reliably.
In addition we need to make sure that re-resolving pending positions
only happens for the first placeholder period where the window-offset
can actually change. As all subsequent periods have to start at position
0, so they don't need to be re-resolved (and shouldn't).

PiperOrigin-RevId: 367171518

* Remove unnecessary @Nullable in exception message

PiperOrigin-RevId: 367204382

* Convergence: Continue decoupling UI from Core

Move CaptionStyleCompat to the UI module, where it's used

PiperOrigin-RevId: 367223891

* Reduce the diff between different versions of GTS tests

This means there are fewer changes required when exporting these tests
as part of the GTS suite run by device manufacturers.

PiperOrigin-RevId: 367230977

* Add missing default implementations to Player.Listener

PiperOrigin-RevId: 367238434

* Package VideoDecoderGLSurfaceView a little more nicely

The main change here is that VideoDecoderGLSurfaceView now implements
VideoDecoderOutputBufferRenderer directly. This avoids SimpleExoPlayer
having to cast to VideoDecoderGLSurfaceView, which will be necessary
if VideoDecoderGLSurfaceView is moved to the UI module. Instead, the
player can cast directly to VideoDecoderOutputBufferRenderer, which
could be moved to the Common module.

The renderer is also moved to be an inner class, since it's not used
anywhere else and since doing this makes it a little easier to move
things around.

PiperOrigin-RevId: 367398147

* Convergence: Continue decoupling UI from Core

Move AdsLoader inner classes that are also required by
the UI module into common.

PiperOrigin-RevId: 367414679

* Upgrade IMA SDK dependency to 3.23.0

This brings in another fix for `NullPointerExceptions` within `WebView` callbacks in the IMA SDK, related to companion ads.

Issue: #8447

#minor-release

PiperOrigin-RevId: 367591047

* Remove warning suppression.

This was added in https://github.com/google/ExoPlayer/commit/9609af3c23383f2fd5571662d271c3013875705d as part of a LSC.

The RequiresNonNull annotation doesn't work anymore (it doesn't
recognize the outer class member and instead tries to find
the same variable on the inner class). So instead of suppressing
the warning of the non-fulfilled precondition, we can just
check the non-nullness directly and remove the precondition.

PiperOrigin-RevId: 367593941

* Fix errors when generating javadoc

PiperOrigin-RevId: 367596648

* Make SsaDecoder robust against absent Format items

Suggested in a comment on PR Issue: #8615

PiperOrigin-RevId: 359522217

* Use a debug signature config for demo apps' release variant

PiperOrigin-RevId: 359724874

* Lint and test artifacts for Maven publication

Issue: #5246
PiperOrigin-RevId: 360132205

* Fix scrubber not reappearing correctly in some cases

Issue: #8646
PiperOrigin-RevId: 360184586

* Fall back from DTS HD to DTS

#minor-release

PiperOrigin-RevId: 360384540

* Link to callback in Player getters' Javadoc

PiperOrigin-RevId: 360398175

* Merge pull request #8546 from TadejZupancic:dev-v2

PiperOrigin-RevId: 360433358

* Reset playback speed when live speed control becomes unused

Issue: #8664
#minor-release
PiperOrigin-RevId: 360877086

* Merge pull request #8662 from joakimzhang:dev-v2

PiperOrigin-RevId: 361029604

* Fix onPositionDiscontinuity event in CastPlayer

- Avoid having two onPositionDiscontinuity events (seek and transition)
  sent after a seek to another media item.
- Avoid triggering an onPositionDiscontinuity event after a timeline
  change.

#minor-release

PiperOrigin-RevId: 361092914

* Merge pull request #8677 from dlafayet:ttml

PiperOrigin-RevId: 361106701

* Use correct period-window offset for initial prepare position.

MaskingMediaSource needs to resolve the prepare position set for a MaskingPeriod
while the source was still unprepared to the first actual prepare position.

It currently assumes that the period-window offset and the default position is
zero. This assumption is correct when a PlaceholderTimeline is used, but it
may not be true if the real timeline is already known (e.g. when re-preparing
a live stream after a playback error).

Fix this by using the known timeline at the time of the preparation.
Also:
 - Update a test that should have caught this to use lazy re-preparation.
 - Change the demo app code to use the recommended way to restart playback
   after a BehindLiveWindowException.

Issue: #8675
PiperOrigin-RevId: 361604191

* Merge pull request #8654 from abeljim:dev-v2-8435-bolditalic

PiperOrigin-RevId: 361767801

* Pass the end position of a stream to TextRenderer when marking it final

In a period transition we pass the start time of the next period, for
the final period we pass the duration of the period or timeline, if
known.

This means sideloaded subtitles now respect the end point of
ClippingMediaSource and ensures that content subtitles aren't
incorrectly displayed over mid-roll ads.

When transitioning back into the subtitled content the subtitles still
appear slightly before the video transitions, meaning the first subtitle
of the content is shown with the last few frames of the ad. Resolving
this in a way that doesn't break anything else requires a deeper
investigation.

Issue: #5317
Issue: #8456
#minor-release
PiperOrigin-RevId: 361797118

* Deflake ClippedPlaybackTest

PiperOrigin-RevId: 362298115

* Fallback to inferred file types when sniffing fails

If none of the extractors successfully sniff the content then we will fall back
to inferred file types in the following order:
- Webvtt if the media comes from a SUBTITLE EXT-X-MEDIA.
- The type of media declared in the HTTP "Content-Type" header.
- The type of the media according to the file extension.
- Transport stream.

Issue: #8700
PiperOrigin-RevId: 362519769

* Merge duplicate UI and Text release notes sections

PiperOrigin-RevId: 362079362

* Don't update the ad group count when releasing ImaAdsLoader

`ImaAdsLoader` clears its `AdPlaybackState` when it's released but this could
cause `AdsMediaSource` to look up information in the ad playback state that is
no longer in bounds.

Issue: #8693

PiperOrigin-RevId: 362556286

* Fix CEA-708 priority

According to the spec (section 8.4.2), high numeric values represent low
priorities, so we need to flip this sort.

Issue: #8704
#minor-release
PiperOrigin-RevId: 362558370

* HLS: Allow audio variants to initialize the timestamp adjuster

This makes HLS playback less liable to become stuck if discontinuity
tags are inserted at different times across media playlists.

Issue: #8700
Issue: #8372
PiperOrigin-RevId: 362903428

* Replace timeline reference equality checks in FakeMediaSource

#minor-release

PiperOrigin-RevId: 363141851

* Upgrade IMA SDK dependency to 3.22.3

This brings in a fix for `NullPointerExceptions` within `WebView` callbacks in
the IMA SDK.

Issue: #8447
PiperOrigin-RevId: 363627446

* Avoid invalid extractors in DefaultHlsExtractorFactory

This change fixes playback of playlists where segments have the
extension and Content-Type of JPEG pictures (although in reality)
they are transport streams. File inferrence before this change will
cause an exception when assuming the inferred file type is one of
the allowed HLS containers.

#minor-release
Issue: #8733
PiperOrigin-RevId: 363641277

* JpegExtractor: read GContainer and GContainerItem XMP prefixes

#minor-release

PiperOrigin-RevId: 363859522

* Add 'once' to list of devices that need SetOutputSurfaceWorkaround

Issue: #8718
PiperOrigin-RevId: 363869093

* Fix typo in styled player control view javadoc

#minor-release

PiperOrigin-RevId: 363915106

* Merge pull request #8653 from dlafayet:textemphasis

PiperOrigin-RevId: 364363882

* JpegExtractor: support JFIF segment preceding Exif segment

#minor-release

PiperOrigin-RevId: 364561115

* Add missing switch case

Before this change, calling read after reaching the end of input in an Ogg file
would cause an IllegalStateException.

PiperOrigin-RevId: 364758873

* Merge pull request #8749 from romanofranz:patch-1

PiperOrigin-RevId: 364779790

* Treat Dolby Vision as H264 in MCVR#getCodecMaxInputSize()

Issue: #8705
PiperOrigin-RevId: 364821429

* Simplify handling of playback speed in StyledPlayerControlView

PiperOrigin-RevId: 360404403

* StyledPlayerControlView: Fix view measurement issue

The exo_controls_background view is supposed to fill its parent,
and so previously used match_parent to do this. However, if the
parent uses wrap_content for its own dimensions, the constraints
being specified become somewhat ambiguous. The parent is supposed
to be sizing itself to wrap its children, and one of the children
is supposed to be sizing itself to match the parent.

Intuitively for this case, you'd hope that the layout logic would
size the parent to wrap its other children, and that the
match_parent child would then fill the parent with its determined
size. That's not what happens, and instead the parent ends up
expanding to occupy all of the space available to it.

This commit sets the exo_controls_background view's dimensions
to be 0dp in the layout, to stop it from influencing the size of
the parent. It's then expanded to fill the parent in code.

Issue: #8726
#minor-release
PiperOrigin-RevId: 364868301

* Merge pull request #8720 from dlafayet:tts-shear-block

PiperOrigin-RevId: 365998615

* Update instructions for GMaven releasing

Issue: #5246

PiperOrigin-RevId: 366041182

* Improve tests to use output surfaces more realistically

Prior to this change, there were some unrealistic quirks in
our Robolectric tests. For example, onRenderedFirstFrame would
be called when using FakeVideoRenderer, despite no output to
render the frame to ever being set. This change improves the
realism of these tests. These changes are required for some
improvements being made to how outputs are set on video
renderers.

PiperOrigin-RevId: 367652169

* Use Metadata.Entry.toString in PlaybackOutput test logging if possible

Add an allowlist of Metadata.Entry implementations with stable toString
overrides.

PiperOrigin-RevId: 366037505

* Add back jcenter() to repositories

The buildscript entry is required by
com.android.tools.build:gradle:4.0.1.

For other projects, it appears that org.checkerframework is
in jcenter.

Without this change building with gradlew is broken, at least.

#minor-release

PiperOrigin-RevId: 366222799

* Release all PlaybackStatsListener session when timeline becomes empty.

Currently they are only released when the timeline becomes non-empty
again or the player is released.

Issue: #8778
PiperOrigin-RevId: 366041625

* Use outputStreamEnded for MetadataRenderer#isEnded

Issue: #8710
PiperOrigin-RevId: 366051836

* Ffmpeg extension: Wait for channel count and sample rate

When playing TrueHD streams, it's possible that the first decoded
buffer is empty, and that the channel count and sample rate are
still unknown. To correct for this, defer determining the format
until a buffer that will actually be output from the decoder has
been obtained, and only then query the channel count and sample
rate.

Issue: #8616
#minor-release
PiperOrigin-RevId: 366246245

* HLS: Set initial SampleQueue start times

This ensures BUFFER_FLAG_DECODE_ONLY is set on samples that are
before the playback start position, in the case that the queue
is created after the start position is set.

#minor-release

PiperOrigin-RevId: 366249188

* Fix SimpleExoPlayer documentation

I've removed the "by default" statements, since this now depends on how
the builder was configured.

PiperOrigin-RevId: 366249995

* HLS: Fix incorrect handling of byte ranges for EXT-X-MAP tags

Issue: #8783
#minor-release
PiperOrigin-RevId: 366265419

* StyledPlayerView: Fix layout issues

- Take centerControls padding into account to prevent switching to
  minimal mode too soon
- Disable clipping to padding to avoid the edges of controls from
  being clipped as the view gets smaller

Issue: #8763
PiperOrigin-RevId: 366966298

* Upgrade IMA SDK dependency to 3.23.0

This brings in another fix for `NullPointerExceptions` within `WebView` callbacks in the IMA SDK, related to companion ads.

Issue: #8447

#minor-release

PiperOrigin-RevId: 367591047

* Deprecate LoopingMediaSource.

There is no use case left where we couldn't use a better
alternative (either looping in the player, using the Player
playlist API, or ConcatenatingMediaSource for advanced cases)

PiperOrigin-RevId: 367990981

* Include aidl output directory to generate javadoc

PiperOrigin-RevId: 367992096

* Adds test cases for iframe only with EXT-X-MAP

Adds a unit test case to cover EXT-X-MAP with byterange attribute.

* Merge pull request #8764 from uvjustin:dev-v2

PiperOrigin-RevId: 367994410

* Remove unused resources from deprecated GVR module

PiperOrigin-RevId: 368014991

* Remove obsolete cronet file references

The cronet extension now uses gradle dependencies.

PiperOrigin-RevId: 368195878

* Core/UI decoupling: Remove setUseSensorRotation from views

Other properties of SphericalGLSurfaceView (e.g., setDefaultStereoMode)
are not plumbed through the PlayerView components, and it doesn't scale
to plumb through all properties of all of the SurfaceView types.

Applications can instead do:

```
((SphericalGLSurfaceView) playerView.getVideoSurfaceView())
    .setUseSensorRotation(useSensorRotation);
```

PiperOrigin-RevId: 368196537

* Pause and resume GLSurfaceView instances in player views

This is the right thing to do, as per the GLSurfaceView documentation.
This adds (previously omitted) calls to VideoDecoderGLSurfaceView.

PiperOrigin-RevId: 368202523

* Clarify documentation on C.SELECTION_FLAG_FORCED

Issue: #8755
PiperOrigin-RevId: 368204094

* Use MediaItem.DEFAULT_MEDIA_ID as default media ID

PiperOrigin-RevId: 368204261

* Ensure minDurationToRetainAfterDiscard >= minDurationForQualityIncrease

If this condition isn't true, the player may enter a cycle of discarding
and reloading the same format. As minDurationToRetainAfterDiscard is a
parameter likely left at its default, and minDurationForQualityIncrease
is likely adjusted more often, we correct the value in the problematic
case and log a warning instead of asserting it outright to prevent
unnecessary app breakages.

Issue: #8807
PiperOrigin-RevId: 368207417

* Switch DashManifestParser to use Ascii.equalsIgnoreCase

String.equalsIgnoreCase depends on the device locale and is discouraged.

#minor-release

PiperOrigin-RevId: 368211677

* Parse DASH forced_subtitle role

#minor-release

Issue: #8781
PiperOrigin-RevId: 368212289

* Use a single message for setting video renderer outputs

Previously, we had separate MSG_SET_SURFACE and
MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER messages for
setting different types of supported output. Use of these
constants to switch between outputs during use of a player
was confusing because not all video renderers support both
message types.

To switch from VideoDecoderOutputBufferRenderer to a Surface,
it was sufficient just to send MSG_SET_SURFACE, since all
video renderers support this and clear any other output that
might be set. Conversely, to switch in the opposite direction,
just sending a MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER was
not sufficient, because not all video renderers handle this
message to clear any previous output. Hence it was necessary to
explicitly clear a previously set surface using a separate
MSG_SET_SURFACE message. Passing two messages to switch the
output may prevent renderers from implementing the output switch
efficiently.

This change passes all outputs using a single message type, and
requires that all renderers treat unsupported outputs as though
null were passed (i.e., they clear any existing output). There
are some other miscellaneous improvements:

1. Non-surface outputs are now passed to onRenderedFirstFrame.
   This fixes a bug in SimpleExoPlayer's onRenderedFirstFrame,
   where previously it could not correctly equality check the
   output corresponding to the event to its current output in
   the VideoDecoderOutputBufferRenderer case.
2. Fix SimpleExoPlayer to report surface size changes for the
   VideoDecoderOutputBufferRenderer case. Even though the
   surface is rendered to indirectly in this case, we can still
   query (and listen to changes to) the surface's size.

PiperOrigin-RevId: 368215850

* Upgrade JUnit to 4.13.2

PiperOrigin-RevId: 368226576

* Bump version to 2.13.3

PiperOrigin-RevId: 368235728

* Switch DashManifestParser to use Ascii.equalsIgnoreCase

String.equalsIgnoreCase depends on the device locale and is discouraged.

#minor-release

PiperOrigin-RevId: 368211677

* Parse DASH forced_subtitle role

#minor-release

Issue: #8781
PiperOrigin-RevId: 368212289

* Bump version to 2.13.3

PiperOrigin-RevId: 368235728

* Fix bottom-cropped text in WebView output

Use unitless numbers for WebView line-height values

See
https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#prefer_unitless_numbers_for_line-height_values

* Add mediaId to PlaybackStateCompat extras

It provides a way to associate PlaybackState with the current media
item.

Startblock:
  <unknown commit> is submitted
PiperOrigin-RevId: 368354775

* Fix typo in Player#isPlaying() Javadoc

PiperOrigin-RevId: 368383121

* Update internal codebase location for flac extension

PiperOrigin-RevId: 368388742

* fix release notes

* Mention publishing to Google Maven at top of release notes.

* Remove release notes item about publication intructions

* Move AudioComponent to ExoPlayer leaving key methods in Player

PiperOrigin-RevId: 368413660

* Update to Gradle plugin 4.1

Some usage of += had to be changed to use .add
because GString can be implitly converted to String
and back, but it is not the case for List<GString>
and List<String>.

PiperOrigin-RevId: 368416727

* Move MetadataComponent from Player to ExoPlayer

PiperOrigin-RevId: 368418142

* Replace Util.toLowerInvariant() with Ascii.toLowerCase()

Even when fixed to the US locale (and thus avoiding surprising behaviour
in e.g. Turkish locale with "i" and "I") there are unexpected behaviours
when upper and lower casing non-ASCII characters.

For example it's sometimes not symmetric, e.g.:
"ẞ".toLowerCase() -> "ß"
"ß".toUpperCase() -> "SS"

In all the ExoPlayer usages we are either dealing with known-ASCII
strings (e.g. MIME types) or comparing against ASCII constant strings
anyway, so it seems easier to just use Guava's ASCII-only class in these
cases.

This change also includes some null-twiddling, because
Util.toLowerInvariant() is null tolerant, while Ascii.toLowerCase() is
not. Most of the usages were already non-null, and it was easy enough to
change the remaining ones to be so by simple reordering of statements.

I'll make an equivalent change for Util.toUpperInvariant() next.

PiperOrigin-RevId: 368419813

* Core/UI decoupling: Remove SphericalGLSurfaceView cast

PiperOrigin-RevId: 368420961

* Move TextComponent to ExoPlayer

PiperOrigin-RevId: 368428647

* Move DeviceComponent in ExoPlayer

PiperOrigin-RevId: 368437660

* Core/UI decoupling: Replace SingleTapListener with OnClickListener

PiperOrigin-RevId: 368448442

* Make PositionInfo Bundleable

PiperOrigin-RevId: 368453894

* Tweak discontinuity reason definitions for remote players

Discontinuity reasons may not be precisely obtained for remote
player. 'Remote Player' means that playback is owned by another
app or device and the same playback can be controller by other
clients simultaneously. The MediaController is an example.
If the remote playback doesn't provide discontinuity reason, then
player cannot differentiate between automatic playback transition
and seekTo() from another client.

This CL tweaks the discontinuity reason definitions, so reasons
can be obtained without remote playback's support.
This doesn't effect the local Players, such as SimpleExoPlayer.

PiperOrigin-RevId: 368579577

* Update internal codebase location for av1 extension

PiperOrigin-RevId: 368585664

* Fix 1 ErrorProneStyle finding:
* The Google Java Style Guide requires that each switch statement includes a default statement group, even if it contains no code. (This requirement is lifted for any switch statement that covers all values of an enum.)
  (see http://go/bugpattern/MissingDefault)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Suggest a fix on the CL (go/how-to-suggest-fix).
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/exoplayer/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/exoplayer/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

PiperOrigin-RevId: 368586454

* Add experimentalSetForegroundModeTimeoutMs on SimpleExoPlayer

This is necessary to migrate apps which are using
ExoPlayer.Builder.experimentalSetForegroundModeTimeoutMs
from ExoPlayerImpl to SimpleExoPlayer.

PiperOrigin-RevId: 368657557

* Fix typo

PiperOrigin-RevId: 368789636

* Replace Util.toUpperInvariant() with Ascii.toUpperCase()

Even when fixed to the US locale (and thus avoiding surprising behaviour
in e.g. Turkish locale with "i" and "I") there are unexpected behaviours
when upper and lower casing non-ASCII characters.

For example it's sometimes not symmetric, e.g.:
"ẞ".toLowerCase() -> "ß"
"ß".toUpperCase() -> "SS"

In all the ExoPlayer usages we are either dealing with known-ASCII
strings (e.g. MIME types) or comparing against ASCII constant strings
anyway, so it seems easier to just use Guava's ASCII-only class in these
cases.

Util.toUpperInvariant() is null-tolerant, while Ascii.toLowercase() is
not. Most usages in this change are clearly non-null. The BandwidthMeter
usages aren't annotated @Nullable, but the current code *would* work if
countryCode was null in both cases. These methods will now throw NPE if
they're passed null.

PiperOrigin-RevId: 368816287

* Refactor SEP prepare to clarify that it is equivalent to EPI prepare.

Before this change:
- SimpleExoPlayer.prepare(mediaSource) ended up calling
  ExoPlayerImpl.setMediaSourcesInternal() with startWindowIndex=0 and
  resetToDefaultPosition=false.
- ExoPlayerImpl.prepare(mediaSource) ended up calling
  ExoPlayerImpl.setMediaSourcesInternal() with
  startWindowIndex=C.INDEX_UNSET and resetToDefaultPosition=true.

This was functionaly equivalent but a bit confusing.

#minor-release

PiperOrigin-RevId: 368818143

* Make surfaceView non-clickable

PiperOrigin-RevId: 368818853

* Update release notes

PiperOrigin-RevId: 368822503

* Add missing checks to ExoPlayer Builders

PiperOrigin-RevId: 368851903

* Remove mocking executor in `CronetDataSourceTest`

Other tests in this file already use `Executors.newSingleThreadExecutor` so do the same for the ones that currently use `mockExecutor`.

PiperOrigin-RevId: 368859470

* Move VideoComponent in ExoPlayer

VideoFrameMetadataListener and CameraMotionListener are still part
of the Player interface as a good way to break the UI dependency
on them has not yet been finalised.

PiperOrigin-RevId: 368863829

* Fix 1 ErrorProneFragileCode finding, REQUIRING THOROUGH REVIEW:
* Prefer instanceof to getClass when implementing Object#equals.
  (see http://go/bugpattern/EqualsGetClass)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Suggest a fix on the CL (go/how-to-suggest-fix).
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneFragileCode if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/exoplayer/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/exoplayer/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

PiperOrigin-RevId: 369180513

* Rollback of https://github.com/google/ExoPlayer/commit/cdebf6c68b0f76360d78114dcb47c58e63b354a7

*** Original commit ***

Move VideoComponent in ExoPlayer

VideoFrameMetadataListener and CameraMotionListener are still part
of the Player interface as a good way to break the UI dependency
on them has not yet been finalised.

***

PiperOrigin-RevId: 369194309

* Make ProgramInformation final.

This was likely an oversight when first importing #4930.

PiperOrigin-RevId: 369199775

* MediaCodecAdapter.Factory creates a started Adapter.

This change moves the responsibility of creating, configuring and starting the MediaCodec from the MediaCodecRender to the MediaCodecAdapter.Factory.

This move allows ExoPlayer's client to decide how and when codecs are created and/or reused.

To allow the move, this CL replaces MediaCodecRenderer.ConfigureCodec with MediaCodecRenderer.getCodecConfiguration

PiperOrigin-RevId: 369273887

* Misc cleanup / clarification for bandwidth improvements

PiperOrigin-RevId: 369315524

* Fix broken subtitles in StyledPlayerView

PlayerView is not affected.

PiperOrigin-RevId: 369401563

* Rollforward of Move VideoComponent to ExoPlayer

The original cl has been fixed by not implementing
VideoListener but Player.Listener in
StyledPlayerView.

VideoFrameMetadataListener and CameraMotionListener are still part
of the Player interface as a good way to break the UI dependency
on them has not yet been finalised.

PiperOrigin-RevId: 369417682

* Remove deprecated DefaultMediaSourceEventListener

PiperOrigin-RevId: 369425007

* Add gh-pages to main dev branch

* Move extensions/cronet to libraries/datasource_cronet

See go/media-apis-codebase-google3.

PiperOrigin-RevId: 369425137

* Prevent creation of new sessions if the Timeline is empty.

We currently create sessions based on the placeholder window
index. This shouldn't be needed as we now set a non-empty
timeline as soon as the first MediaItem is added to the playlist.

Once this check is part of the session manager, we can also remove
the equivalent workarounds from the various code integrations.

PiperOrigin-RevId: 369432853

* Correct Javadoc location

PiperOrigin-RevId: 369433627

* Add gh-pages to main release branch

* Move gh-pages to top level

* Move gh-pages to required directory

* Move gh-pages to required directory

* Delete gh-pages for now

* Read-add gh-pages

* Remove CNAME

* Add CNAME

* Deprecate setThrowWhenUsingWrongThread.

This method shouldn't be used anymore since the thread enforcement
is the default already. We still keep it for now to ease the transition
for apps that use ExoPlayer on multiple threads and want to temporarily
disable the enforcement while the threading problems are fixed.

PiperOrigin-RevId: 369440789

* Remove most deprecated ExoPlayerFactory methods

PiperOrigin-RevId: 369442687

* Update internal codebase location for vp9 extension

PiperOrigin-RevId: 369443204

* Adds Format to MediaCodecAdapter.Configuration.

PiperOrigin-RevId: 369444747

* Rollback of https://github.com/google/ExoPlayer/commit/e60609e34447553474cdfc86b2dee5462316b10c

*** Original commit ***

Prevent creation of new sessions if the Timeline is empty.

We currently create sessions based on the placeholder window
index. This shouldn't be needed as we now set a non-empty
timeline as soon as the first MediaItem is added to the playlist.

Once this check is part of the session manager, we can also remove
the equivalent workarounds from the various code integrations.

***

PiperOrigin-RevId: 369452067

* Mark AdaptiveTrackSelection.AdaptationCheckpoint as public

The protected visibility causes problems in Kotlin (Issue: #8830) and
also prevents a subclass of AdaptiveTrackSelection.Factory that isn't
nested inside a subclass of AdaptiveTrackSelection (in both Java and
Kotlin).

#minor-release

PiperOrigin-RevId: 369468841

* DASH: Avoid rounding error in getSegmentCount

Issue: #8804
PiperOrigin-RevId: 369484117

* Move extensions/opus to libraries/decoder_opus

See go/media-apis-codebase-google3.

PiperOrigin-RevId: 369603286

* Remove CNAME

* Rollback of https://github.com/google/ExoPlayer/commit/09096d6fbf5532728ab675d2d1ccefc3daa0bb03

*** Original commit ***

Rollback of https://github.com/google/ExoPlayer/commit/e60609e34447553474cdfc86b2dee5462316b10c

*** Original commit ***

Prevent creation of new sessions if the Timeline is empty.

We currently create sessions based on the placeholder window
index. This shouldn't be needed as we now set a non-empty
timeline as soon as the first MediaItem...

***

PiperOrigin-RevId: 369609523

* Update internal codebase location for extractor module

PiperOrigin-RevId: 369609585

* Move docs to correct folder for GitHub Pages

* Remove more deprecated methods from ExoPlayerFactory

PiperOrigin-RevId: 369615413

* Remove some long deprecated methods

PiperOrigin-RevId: 369626542

* Core/UI decoupling: Move spherical back to core

A subsequent change will make the UI module access
SphericalGLSurfaceView and VideoDecoderGLSurfaceView
using reflection, now we're at the point where we only
need to reflect the constructors.

PiperOrigin-RevId: 369630102

* Remove deprecated ExtractorMediaSource

PiperOrigin-RevId: 369635363

* Re-format some javadoc

PiperOrigin-RevId: 369642047

* Remove spurious blank lines introduced in https://github.com/google/ExoPlayer/commit/dafea4e40fb5eba91597cf16cab06140ebaaaff4

PiperOrigin-RevId: 369648457

* Fix in-page anchor link on exoplayer.dev troubleshooting page

Also consolidate the threading warning info with the same info on the
hello world page and update the version that the
setThrowsWhenUsingWrongThread() method will be removed in.

PiperOrigin-RevId: 369657759

* Update MediaMetadata from static and dynamic metadata.

PiperOrigin-RevId: 369671127

* Restore DeleteLocalRef usage

Issue: #8845
PiperOrigin-RevId: 369685031

* initial commit for underline and strikeout

* Added SSA test file

* Create CNAME

* Remove deprecated ExoPlayerFactory

PiperOrigin-RevId: 369934240

* Fix 4 ErrorProneStyle findings:
* @Encoding is not a TYPE_USE annotation, so should appear before any modifiers and after Javadocs.
  (see go/java-style#s4.8.5-annotations) (2 times)
* @Nullable is not a TYPE_USE annotation, so should appear before any modifiers and after Javadocs.
  (see go/java-style#s4.8.5-annotations) (2 times)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Suggest a fix on the CL (go/how-to-suggest-fix).
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/exoplayer/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/media/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

PiperOrigin-RevId: 370048160

* Add Player.getAvailableCommands()

Add method getAvailableCommands() in Player interface to return
the available commands. Method isCommandAvailable() moved to
BasePlayer since it can be implelented by calling
getAvailableCommands().

PiperOrigin-RevId: 370059328

* Fix 1 ErrorProneStyle finding:
* @Nullable is not a TYPE_USE annotation, so should appear before any modifiers and after Javadocs.
  (see go/java-style#s4.8.5-annotations)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Suggest a fix on the CL (go/how-to-suggest-fix).
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/exoplayer/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/media/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

PiperOrigin-RevId: 370377751

* Add thread names to the 'player accessed on wrong thread' message

This will help app developers identify which thread is being used and
which is expected.

PiperOrigin-RevId: 370409697

* Update MediaSourceFactory javadoc

Remove references to deprecated methods. I didn't replace the DRM info
with references to non-deprecated methods because I'm not sure it
belongs at class level. The methods themselves are already documented
in detail.

PiperOrigin-RevId: 370421087

* DebugMediaCodecVideoRenderer clean-up

After refactoring MediaCodecRenderer's configureCodec() to
getMediaCodecConfiguration(), there was some state initialization left
in DebugMediaCodecVideoRenderer's configureCodec(). This is now moved
inside DebugMediaCodecVideoRenderer.onCodecInitialized().

PiperOrigin-RevId: 370430193

* CronetDataSource: fix overflow bug

There is a bug when CronetDataSource opens an asset with a length
bigger that Integer.MAX_INT  (2147483647 bytes, ~2GB). In read(),
`bytesRemaining` is cast to int, which overflows and evaluates to a
negative number, causing `bytesRead` to be negative too.

PiperOrigin-RevId: 370434368

* Change String MediaMetadata.title to CharSequence trackTitle.

PiperOrigin-RevId: 370439509

* MediaCodecRenderer: do not call protected methods from constructor

MediaCodecRenderer is calling its protected methods
resetCodecStateForRelease() and resetCodecStateForFlush() from its
constructor. Classess that override the methods (eg.
DebugMediaCodecVideoRenderer) need to checks if the methods
are called from the superclass constructor thus their members are not
initialized yet.

With this change, the MCR constructor does not call the two
methods and sets the respective state directly on its fields.

PiperOrigin-RevId: 370445978

* DebugMediaCodecVideoRenderer: expect output format change after flush

The DebugMediaCodecVideoRenderer expects the MediaCodec to return an
output format change after the MediaCodecRenderer detects an input
format change, but the DebugMediaCodecVideoRenderer resets its state
after flushing MediaCodec. This does not cover the following case: an
input format change is detected when queueing sample with timestamp X
and before the respective output buffer is dequeued, the player seeks
back to X. After seeking back to X, the MCR does not trigger an input
format change for X again, and MediaCodec (correctly) returns an output
format change before dequeueing output X.

This commit is changing DebugMediaCodecVideoRenderer to keep expecting
an output format change after a flush, is one a format pending output.
Such an an edge-case is addressed already in MediaCodecRenderer.

PiperOrigin-RevId: 370482506

* Add missing removeDrmEventListener calls.

We remove other source related listeners if a MediaSource is
removed from the playlist or the player/source is released.
This isn't currently done for the DRM listener.

#minor-release

PiperOrigin-RevId: 370482571

* Remove release command for symmetry with Player construction

Release is a life cycle operation that should only be called when
the player is no longer needed. It's linked to the player lifecycle
and thus very different from prepare/stop.
As a result, it should not be in the same command.

Additionally it's not clear if remote players will ever need to call release,
as the player creator is best candidate to release it.

As a result the release operation doesn't have a use case for a command.
A release command can be added later if a need is identified.

PiperOrigin-RevId: 370649214

* Add ForwardingPlayer

The ForwardingPlayer implements the Player interface and forwards all
operations to another Player instance. Apps will be able to override
methods of ForwardinPlayer in order to modify and/or suppress specific
Player funcionalities.

This commit introduces the ForwardingPlayer which simply forwards all
Player operations to another Player instance. In follow-up changes,
the ForwardingPlayer will be extended so that it eventually reaches the
feature-set offered by ControlDispatcher.

PiperOrigin-RevId: 370653167

* Publish ExoPlayer's support for RTSP.

Allow ExoPlayer to open URIs starting with rtsp://

PiperOrigin-RevId: 370653248

* Fix reference to file in LINT.ThenChange tag

PiperOrigin-RevId: 370660058

* Fix that loadingFinished is never set to true.

Previously loadingFinished will never be set to true because it started in
false, and we are and'ing it with `canceled`.

#minor-release

PiperOrigin-RevId: 370662456

* Relax session timing requirement.

Some RTSP servers do not include the RANGE attribute for live contents.

#minor-release

PiperOrigin-RevId: 370662587

* Misc ad handling improvements.

1. Clarify intention of getAdGroupIndexForPositionUs and
   getAdGroupIndexAfterPositionUs. Both methods are used for very
   specific but different purposes and encode the logic of which
   ads should be played at which time, so it's helpful to clarify
   this in the documentation as well.
2. Change one usage getAdGroupIndexForPositionUs to use the already
   existing nextAdGroupIndex. This is also more in line with the
   intended usage as clarified in step 1.
3. Update MediaPeriodQueueTest for updateQueuedPeriods to only
   look for duration changes in future periods, not in the
   current one, because that's not handled MediaPeriodQueue for ads
   and the test is just passing by chance now. Also remove wrong
   advancePlaying() calls that are already implicitly included in
   the preceding enqueueNext() call.
4. Fix a minor bug where post-roll ads are not checked whether they
   are played already before using them as the next ad group. Also
   added a test covering this case.

#minor-release

PiperOrigin-RevId: 370664131

* Allow the extractor deplete the reordering queue as much as possible.

#minor-release

PiperOrigin-RevId: 370673852

* Add initial code for PlaybackException

Deferred the addition of error codes to ease the review process.

PiperOrigin-RevId: 370687238

* Move the ownership of MediaMetadata to ExoPlayerImpl.

Add the onMediaMetadataChanged event to onEvents.

PiperOrigin-RevId: 370738521

* Add @DoNotInstrument to Flac extension test

PiperOrigin-RevId: 370739641

* Add @DoNotInstrument to Opus extension test

PiperOrigin-RevId: 370740311

* Remove AutoClosable implementation of PlayerCommandQueue

PiperOrigin-RevId: 370875532

* Fix flaky DRM assertion in AnalyticsCollectorTest

Session pre-fetching caused this ordering assertion to no longer be
always true. It should have been removed in
https://github.com/google/ExoPlayer/commit/795ddfee40cba83eba8e9f39da01fba2f1f8775c

#minor-release

PiperOrigin-RevId: 370880530

* Add track artist, album artist and album title to MediaMetadata.

#minor-release

PiperOrigin-RevId: 370881618

* SSA: Add a test with a present but empty "Style" line

PiperOrigin-RevId: 370897451

* Simplify boolean ternary statements in SsaStyle

PiperOrigin-RevId: 370902227

* Move Rating class to library-common

Rating class should be in the same module as MediaMetadata.

Tested:
  $ ./gradlew --stacktrace :exo-library-common:tDUT
  $ ./gradlew --stacktrace :media2-session:tDUT
  $ ./gradlew --stacktrace :media2-session-vct-current:cAT
PiperOrigin-RevId: 370902917

* Reformat some javadoc

PiperOrigin-RevId: 371068549

* Add get video size

Move VideoSize in the common module and have the Player return it.

`Listener` and `AnalyticsListener` `onVideoSizeChanged` are updated
with the old method deprecated.

`VideoRendererEventListener.onVideoSizeChanged` was also migrated to
`VideoSize` but the old method is removed, not deprecated.
This is because:
 - apps calling/listening to this method is a rare and niche use-case.
 - it would introduce hard to diagnostic issues where if only the caller
   or the callee is updated to use the new method, the event will be lost.
   This doesn't occur with the other 2 listeners as the caller is always
   in ExoPlayer library and was updated to call both the old and new methods.

VideoSize is used everywhere except in `Format` as this would lead to
too much refactoring and backward compatibility breakage for little gain.

#minor-release

PiperOrigin-RevId: 371087419

* Avoid NPEs when checking the current thread in SimpleExoPlayer

Before, Looper.myLooper().getThread() could throw an NPE if the current
thread didn't have any looper.

#minor-release

PiperOrigin-RevId: 371097485

* Remove deprecated CastPlayer methods

PiperOrigin-RevId: 371102614

* Update internal codebase location for common module

PiperOrigin-RevId: 371109726

* Make copybara remove the LINT.IfChange tag

PiperOrigin-RevId: 371135534

* Override available commands in ForwardingPlayer

This change adds an API in the ForwardingPlayer to disable commands.
This is affecting what Player.isCommandAvailable() returns as
well as what is being advertised from the
EventListener.onAvailableCommandsChanged() callback.

For the callback case, the ForwardingPlayer needs to intercept the
callback. It does so by wrapping registered EventListener and Listener
instances, which resulted in some boiler-plate code. In addition, there
is logic on the wrapped listeners to avoid triggering a queued callback
if all listeners have been removed in the meantime. This includes the
case where new listeners are added while callbacks scheduled for the
removed listeners are still pending.

PiperOrigin-RevId: 371139703

* Remove deprecated PlaybackPreparer

PiperOrigin-RevId: 371170769

Co-authored-by: samrobinson <samrobinson@google.com>
Co-authored-by: kimvde <kimvde@google.com>
Co-authored-by: tonihei <tonihei@google.com>
Co-authored-by: gyumin <gyumin@google.com>
Co-authored-by: aquilescanta <aquilescanta@google.com>
Co-authored-by: Ian Baker <ibaker@google.com>
Co-authored-by: Denise LaFayette <dlafayette@netflix.com>
Co-authored-by: bachinger <bachinger@google.com>
Co-authored-by: olly <olly@google.com>
Co-authored-by: Justin Wong <46082645+uvjustin@users.noreply.github.com>
Co-authored-by: krocard <krocard@google.com>
Co-authored-by: jaewan <jaewan@google.com>
Co-authored-by: andrewlewis <andrewlewis@google.com>
Co-authored-by: marcbaechinger <marc.baechinger@gmail.com>
Co-authored-by: Steve Mayhew <mayhew.steve@gmail.com>
Co-authored-by: Abel Jimenez <abelj1@uci.edu>
Co-authored-by: christosts <christosts@google.com>
Co-authored-by: claincly <claincly@google.com>
@atrope
Copy link

atrope commented May 6, 2021

This is still happening with latest version


java.lang.NullPointerException: 
  at com.google.ads.interactivemedia.v3.internal.amy.a (Unknown Source:16)
  at com.google.ads.interactivemedia.v3.internal.aon.d (Unknown Source:1494)
  at com.google.ads.interactivemedia.v3.internal.aot.d (Unknown Source:57)
  at com.google.ads.interactivemedia.v3.internal.aoq.shouldOverrideUrlLoading (Unknown Source:12)
  at android.webkit.WebViewClient.shouldOverrideUrlLoading (WebViewClient.java:77)
  at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading (chromium-Monochrome.aab-stable-443009123:14)
  at android.os.MessageQueue.nativePollOnce (Native Method)
  at android.os.MessageQueue.next (MessageQueue.java:326)
  at android.os.Looper.loop (Looper.java:181)
  at android.app.ActivityThread.main (ActivityThread.java:7091)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)

@tonihei
Copy link
Collaborator

tonihei commented May 11, 2021

@atrope Which version of ExoPlayer (or other related components like IMA extension) are you using?

@atrope
Copy link

atrope commented May 11, 2021

@tonihei we are using ExoPlayer 2.13.3

@google google locked and limited conversation to collaborators Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants