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

onPositionDiscontinuity is not getting called when AdGroup is reached. #8456

Closed
sravan1213 opened this issue Jan 13, 2021 · 20 comments
Closed
Assignees
Labels

Comments

@sravan1213
Copy link
Contributor

sravan1213 commented Jan 13, 2021

onPositionDiscontinuity is not getting called when AdGroup. This is happening for content where subtitles are side loaded.

  1. Side load subtitle for a media with midroll ads
  2. Wait for the midroll position to hit
  3. Observe player state remains unchanged. Ad UI wont appear and even trackers are not fired. The entire ad behavior get messed up.

used following assets to test.
content - https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8
subtitle url to sideload - https://bitdash-a.akamaihd.net/content/sintel/hls/subtitles_en.vtt (same subtitle from content)

video_bugreport_demoPatch.zip

@sravan1213
Copy link
Contributor Author

@andrewlewis can you please check this or provide some pointers to where to look at ?

Thanks in advance.

@vinodkputta
Copy link

@ojw28 @andrewlewis We are facing this issue on the production app. Can someone please help us to fix this issue?

Thanks.

@andrewlewis
Copy link
Collaborator

Sorry for the delay getting to this. I added this sample to the demo app samples list:

{
  "name": "Issue #8456",
  "uri": "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8",
  "ad_tag_uri": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostoptimizedpodbumper&cmsid=496&vid=short_onecue&correlator=",
  "subtitle_uri": "https://bitdash-a.akamaihd.net/content/sintel/hls/subtitles_en.vtt",
  "subtitle_mime_type": "text/vtt",
  "subtitle_language": "en"
},

... replicating the "MIDROLL test" item from the patch in the linked archive, but it played correctly in the demo app using the latest dev-v2 version. Please could you try doing the same and checking whether the ad UI shows for you? Note: I didn't apply the cookie-related parts of the patch but I'm not sure how those could be related.

@sravan1213
Copy link
Contributor Author

Thanks for the reply @andrewlewis

Have you checked the video I attached to repro the issue ?
We have to select side loaded subtitles from text tracks. I was able to reproduce 100% on 2.12.2 & 2.12.3

Cookie is not related to this issue :)

I'll check on dev branch and let you know. Thanks.

@sravan1213
Copy link
Contributor Author

@andrewlewis I am able to reproduce on dev-v2 branch as well. Repro rate is 100%

Let me know if you need more details.
Make sure you select the side loaded subtitle is selected before mid roll hits.
And let the ad play as user is watching. Do not seek.

@sravan1213
Copy link
Contributor Author

@andrewlewis were you able to reproduce this ??

@sravan1213
Copy link
Contributor Author

@andrewlewis I've done some debugging, when side-loaded subtitle is enabled,
renderer.isEnded() is always return false for text track causing this issue. I'm not able to figure out why is this happening.

@hyl0376
Copy link

hyl0376 commented Feb 22, 2021

I also reproduced this issue in 2.13.1 demo app.
The weird thing is that 'https://storage.googleapis.com/exoplayer-test-media-1/webvtt/numeric-lines.vtt' works fine but 'https://bitdash-a.akamaihd.net/content/sintel/hls/subtitles_en.vtt' doesn't.
sample setting :

      {
        "name": "subtitle pre-mid-post",
        "uri": "https://content.jwplatform.com/manifests/vM7nH0Kl.m3u8",    // not matter
        "ad_tag_uri": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=",    // VMAP pre-, mid- and post-rolls, single ads
        "subtitle_uri": "https://bitdash-a.akamaihd.net/content/sintel/hls/subtitles_en.vtt",
        "subtitle_mime_type": "text/vtt",
        "subtitle_language": "en"
      }

reproduction step :

  1. pre-roll play
  2. before mid-roll play (15s), click 'SELECT TRACKS' at the top left and select text track 'Auto' to 'english' (have to change in 'SELECT TRACKS', not in controller)
  3. wait for the mid-roll play (not seeking to or over mid-roll)
  4. mid-roll play with no overlay and controller is still enabled (no onPositionDiscontinuity() event)

I faced the same problem and it's very critical.
Please take a look.

@ojw28 ojw28 assigned icbaker and unassigned andrewlewis Feb 22, 2021
@icbaker
Copy link
Collaborator

icbaker commented Feb 22, 2021

I can reproduce what you're seeing using the instructions in #8456 (comment).

I believe this happens because the subtitles aren't correctly 'ended' when transitioning into the ad period. I'm not sure exactly why that is yet, I'm going to investigate further. It's likely related to the fact that sideloaded subtitles generally don't work correctly with ClippingMediaPeriod (which is used by midroll ad insertion): #5317

However even with that limitation the current behaviour is unexpected.

The weird thing is that 'https://storage.googleapis.com/exoplayer-test-media-1/webvtt/numeric-lines.vtt' works fine but 'https://bitdash-a.akamaihd.net/content/sintel/hls/subtitles_en.vtt' doesn't.

I think this is because numeric-lines.vtt is short, so playback of the subtitle content is fully completed before the midroll appears.

I tried another experiment with subtitle content both before, during and after the midroll and I found the subtitles just keep playing throughout the ad. This means the subtitles after the midroll are completely out of sync with the content (by the duration of the midroll). It's also unrelated to the content being streamed over HLS - it reproduces the same with progressive mp4 content:

      {
        "name": "subtitles before and after mid-roll (progressive)",
        "uri": "https://storage.googleapis.com/exoplayer-test-media-1/gen-3/screens/dash-vod-single-segment/video-avc-baseline-480.mp4",
        "ad_tag_uri": "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=",
        "subtitle_uri": "https://storage.googleapis.com/exoplayer-test-media-1/ssa/test-subs-position.ass",
        "subtitle_mime_type": "text/x-ssa",
        "subtitle_language": "en"
      }

@icbaker icbaker added bug and removed question labels Feb 22, 2021
@icbaker
Copy link
Collaborator

icbaker commented Feb 22, 2021

I can also reproduce the same problem without using ads, just by concatenating a clipped MergingMediaSource with subtitles and a ProgressiveMediaSource:

DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(this);
String videoUri =
    "https://storage.googleapis.com/exoplayer-test-media-1/gen-3/screens/dash-vod-single-segment/video-avc-baseline-480.mp4";
String subtitlesUri =
    "https://storage.googleapis.com/exoplayer-test-media-1/ssa/test-subs-position.ass";
MergingMediaSource mergingMediaSource =
    new MergingMediaSource(
        new ProgressiveMediaSource.Factory(dataSourceFactory)
            .createMediaSource(MediaItem.fromUri(videoUri)),
        new SingleSampleMediaSource.Factory(dataSourceFactory)
            .createMediaSource(
                new MediaItem.Subtitle(
                    Uri.parse(subtitlesUri),
                    MimeTypes.TEXT_SSA,
                    "en",
                    C.SELECTION_FLAG_DEFAULT),
                C.TIME_UNSET));
ConcatenatingMediaSource concatenatingMediaSource =
    new ConcatenatingMediaSource(
        new ClippingMediaSource(
            mergingMediaSource, /* startPositionUs= */ 0, /* endPositionUs= */ 5_000_000),
        new ProgressiveMediaSource.Factory(dataSourceFactory)
            .createMediaSource(MediaItem.fromUri("https://html5demos.com/assets/dizzy.mp4")),
        new ClippingMediaSource(
            mergingMediaSource,
            /* startPositionUs= */ 5_000_000,
            /* endPositionUs= */ C.TIME_END_OF_SOURCE));
player.setMediaSource(concatenatingMediaSource);

At 5 seconds the second video starts playing, but the subtitles continue to be rendered on top of it. This is unexpected. At the end of the second video, it seems to pause and the subtitles continue to render until the subtitles are complete, at which point the first video plays again (starting from 5s in) with subtitles.

@nishantkp
Copy link

We are also facing this issue with the production app. Do you have an ETA for this one?

@sravan1213
Copy link
Contributor Author

@icbaker do we have any eta on this.

Apologies for bugging. Thanks in advance.

@icbaker
Copy link
Collaborator

icbaker commented Mar 3, 2021

I have a fix for this in review - when it's submitted it will appear linked to this issue.

icbaker added a commit that referenced this issue Mar 12, 2021
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
@icbaker icbaker closed this as completed Mar 12, 2021
@nishantkp
Copy link

hi @icbaker, do you have an ETA for the upcoming release?

@icbaker
Copy link
Collaborator

icbaker commented Mar 30, 2021

This fix will be included in the 2.14.0 release, which is tentatively scheduled for the beginning of May. It is likely to also be included in future 2.13.X minor releases, if we do any.

@hyl0376
Copy link

hyl0376 commented Mar 31, 2021

Hi @icbaker, could you release it earlier?
This issue is critical to our product release schedule and May is too late.

@nishantkp
Copy link

I agree with @hyl0376, if it is possible to do a minor release, it would be great since is May is too late.

@icbaker
Copy link
Collaborator

icbaker commented Apr 7, 2021

If you need this change more urgently than the next ExoPlayer release you can depend on a local copy of the library: https://github.com/google/ExoPlayer/blob/dev-v2/README.md#locally

Then you can either use the dev-v2 branch at tip-of-tree, or create your own local branch that cherrypicks the commit above on top of 2.13.2.

marcbaechinger pushed a commit that referenced this issue Apr 14, 2021
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
@icbaker
Copy link
Collaborator

icbaker commented Apr 14, 2021

This fix is included in the 2.13.3 release that was just published.

@nishantkp
Copy link

Thank you so much @icbaker

roblav96 pushed a commit to roblav96/ExoPlayer that referenced this issue Apr 17, 2021
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: google#5317
Issue: google#8456
#minor-release
PiperOrigin-RevId: 361797118
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>
@google google locked and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants