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

Fix PGS subtitles rendered with border and no fill color #1006

Open
wants to merge 389 commits into
base: main
Choose a base branch
from

Conversation

SimonHung
Copy link

bug: moneytoo/Player#413
sample file: https://drive.google.com/file/d/1DLc9gVfyOUh65tWNOIWi2RdhNP6FMi_h

because '0' means it's an index to the palette table, not an RGBA value = 0

claincly and others added 30 commits June 12, 2023 09:15
PiperOrigin-RevId: 538796466
(cherry picked from commit a7cff4e)
This change is for Android 12 and below, where the buttons are derived from the actions added with the notification. From Android 13 (https://developer.android.com/about/versions/13/behavior-changes-13#playback-controls), the system derives media controls from `PlaybackState` actions.

When adding the actions onto the notification, the logic will iterate all the command buttons. The `COMMAND_KEY_CONPACT_VIEW_INDEX` extra will be checked for each button. If that extra is set for the three buttons on the compact view, then the customized buttons and their order will be used. Otherwise, the compact view will be "seekPrev" (if any), "play/pause" (if any), "seekNext" (if any) buttons (in such order).

Issue: androidx#410
PiperOrigin-RevId: 538797874
(cherry picked from commit 2e2f193)
#minor-release

PiperOrigin-RevId: 538804347
(cherry picked from commit 276f2f1)
#minor-release

PiperOrigin-RevId: 538809105
(cherry picked from commit 28b8fb7)
#minor-release

PiperOrigin-RevId: 538927855
(cherry picked from commit a67ce06)
Add support for including Common Media Client Data (CMCD) in the outgoing requests of adaptive streaming formats DASH, HLS, and SmoothStreaming.

API structure and API methods:
   *   CMCD logging is disabled by default, use `MediaSource.Factory.setCmcdConfigurationFactory(CmcdConfiguration.Factory cmcdConfigurationFactory)` to enable it.
   *   All keys are enabled by default, override `CmcdConfiguration.RequestConfig.isKeyAllowed(String key)` to filter out which keys are logged.
   *  Override `CmcdConfiguration.RequestConfig.getCustomData()` to enable custom key logging.

NOTE: Only the following fields have been implemented: `br`, `bl`, `cid`, `rtp`, and `sid`.

Issue: google/ExoPlayer#8699

#minor-release

PiperOrigin-RevId: 539021056
(cherry picked from commit b55ddf1)
When the source is prepared again after stop, the period uid
is calculated by subtracting the `firstPeriodId` from the
period uid that is passed in to `createPeriod`. When this
happens after stop, the uid from the old period uid that
is still stored and has the value of the last played uid.

Hence the `firstPeriodId` must not be reset when released.

Issue: google/ExoPlayer#10838
PiperOrigin-RevId: 539028570
(cherry picked from commit 319854d)
PiperOrigin-RevId: 539036285
(cherry picked from commit a66f08b)
In case the player is reset while a live stream is playing, the current
period needs to be a placeholder. This makes sure that the default start
position is used when the first live timeline arrives after re-preparing.

#minor-release

PiperOrigin-RevId: 539044360
(cherry picked from commit 71153a4)
PiperOrigin-RevId: 539100987
(cherry picked from commit edf3043)
This change addresses the case when the user joins the live stream
on an ad period but the metadata for the ad period is not emitted.
This results in inserting a partial ad group.

In this case the ad group duration is longer than the partial ad
group. If now the partial ad group ends at the period before the
last period of the window (unknown duration), the splitting algorithm
didn't recognize that the ad group already ended and made the last
period wrongly an ad period.

This change handles this edge case by counting the mapped ads in
the partial ad group to detect this situation and stops splitting.

#minor-release

PiperOrigin-RevId: 539102785
(cherry picked from commit cd604e7)
Add `HlsMediaSource.Factory.setTimestampAdjusterInitializationTimeoutMs(long)` to set the timeout for the loading thread to wait for the `TimestampAdjuster` to initialize. If the initialization doesn't complete before the timeout, a `PlaybackException` is thrown to avoid the playback endless stalling. The timeout is set to zero by default.

This can avoid HLS playback endlessly stalls when manifest has missing discontinuities. According to the HLS spec, all variants and renditions have discontinuities at the same points in time. If not, the one with discontinuities will have a new `TimestampAdjuster` not shared by the others. When the loading thread of that variant is waiting for the other threads to initialize the timestamp and hits the timeout, the playback will stall.

Issue: androidx#323

#minor-release

PiperOrigin-RevId: 539108886
(cherry picked from commit db3e662)
*** Original commit ***

Add a timer to end a video stream prematurely in ExtTexMgr

***

This has been submitting for more than 1.5hrs. "This presubmit is running slowly because you have been throttled by Build Queue due to using too much of your Product Area's quota."

adding NO_SQ as this is a pure rollback

PiperOrigin-RevId: 539135970
(cherry picked from commit 5c29abb)
Issue: androidx#452
#minor-release
PiperOrigin-RevId: 539613535
(cherry picked from commit c2f78db)
Removed unreleased changes in this cherry-pick.

PiperOrigin-RevId: 539606230
(cherry picked from commit 49b893f)
#minor-release

PiperOrigin-RevId: 539632164
(cherry picked from commit 4bceb64)
This was recommended in robolectric/robolectric#8187 (comment)

PiperOrigin-RevId: 539691757
(cherry picked from commit 959e974)
…lBase`

Currently, the implementation of `MediaControllerImplBase` differs from `ExoPlayerImpl`. The listeners of the former are notified of player error changes only in `onPlayerInfoChanged` and not `updatePlayerInfo` (masking method). Whereas `ExoPlayerImpl` has one unified method - `updatePlaybackInfo` - which sends the events to all the available listeners.

This change fixes the lack of 2 particular callbacks - `onPlayerErrorChanged` and `onPlayerError`, however, there might be more differences. Ideally, there should be a unified method for oldPlayerInfo/newPlayerInfo comparison-update-notify-listeners flow.

Issue: androidx#449

#minor-release

PiperOrigin-RevId: 539961618
(cherry picked from commit 4b5a457)
PiperOrigin-RevId: 540220141
(cherry picked from commit c76680a)
Previously `AsynchronousMediaCodecCallback.mediaCodecException` was
cleared when flushing completed. This behaviour was changed in
androidx@aeff51c
so now the exception is not cleared.

The result after that commit was that we would **only** suppress/ignore
the expression if a flush was currently pending, and we would throw it
both before and after the flush. This doesn't really make sense, so this
commit changes the behaviour to also throw the exception during the
flush.

This commit also corrects the assertion in
`flush_withPendingError_resetsError` and deflakes it so that it
consistently passes. The previous version of this test, although the
assertion was incorrect, would often pass because the
`dequeueInputBuffer` call would happen while the `flush` was still
pending, so the exception was suppressed.

#minor-release

PiperOrigin-RevId: 540237228
(cherry picked from commit 248d1d9)
#minor-release

PiperOrigin-RevId: 540274932
(cherry picked from commit 3d674fa)
#minor-release

PiperOrigin-RevId: 540309118
(cherry picked from commit cf21add)
These comments reflect the parameter names of the constructor that
we're reflectively calling, but errorprone complains that they don't
match the parameter names of `Constructor.newInstance`.

PiperOrigin-RevId: 540348118
(cherry picked from commit 567890d)
Current behaviour causes an app to crash if it receives an unrecognized repeat mode send over the wire. In order to avoid the crash, a sensible default had to be chosen.

For `Player.RepeatMode`, it is `Player.REPEAT_MODE_OFF`, which is the same value we use as default when unbundling `PlayerInfo`.

For `PlaybackStateCompat.RepeatMode`, it is `PlaybackStateCompat.REPEAT_MODE_NONE`, which is what we use in the no-arg `LegacyPlayerInfo` constructor.

Issue: androidx#448

#minor-release

PiperOrigin-RevId: 540563792
(cherry picked from commit 501da10)
Additionally, two existing methods to `buildDataSpec` in `DashUtil` have been deprecated, while a new method has been added that allows the inclusion of `httpRequestHeaders`.

Issue: google/ExoPlayer#8699

#minor-release

PiperOrigin-RevId: 540594444
(cherry picked from commit 52878b2)
Instead of providing `playbackDurationUs` and `loadPositionUs` individually, which are used to calculate the buffer duration for CMCD logging, we can directly pass the pre-calculated `bufferedDurationUs` available in the `getNextChunk` method of the chunk source classes.

Issue: google/ExoPlayer#8699

#minor-release

PiperOrigin-RevId: 540630112
(cherry picked from commit be9b057)
…dition

PiperOrigin-RevId: 540875285
(cherry picked from commit af69d58)
PiperOrigin-RevId: 541640959
(cherry picked from commit 8d8c514)
Some events may arrive after the playlist is cleared (e.g. load
cancellation). In this case, the DefaultPlaybackSessionManager may
create a new session for the already removed item.

We already have checks in place that ignore events with old
windowSequenceNumbers, but these checks only work if the current
session is set (i.e. the playlist is non-empty). The fix is to add
the same check for empty playlists by keeping note of the last
removed window sequence number.

PiperOrigin-RevId: 541870812
(cherry picked from commit e0191dd)
PiperOrigin-RevId: 541892788
(cherry picked from commit b9cc70d)
Copybara-Service and others added 21 commits January 9, 2024 12:11
PiperOrigin-RevId: 590142275
(cherry picked from commit 27f437b)
Issue: androidx#876

#minor-release

PiperOrigin-RevId: 590215918
(cherry picked from commit 5580b78)
PiperOrigin-RevId: 590234505
(cherry picked from commit f465efe)
#minor-release

PiperOrigin-RevId: 590586491
(cherry picked from commit 9a76616)
PiperOrigin-RevId: 590862514
(cherry picked from commit ab296ef)
When broadcasting a notifyChildrenChanged event, the task for legacy
controllers was sent to the broadcasting callback. This would
technically work, but because the subscription list is maintained
with specific controllers, the broadcast controller isn't subscribed
and hence the call wasn't executed.

This change calls the overloaded method for a specific controller
for each connected controller. Making sure (only) subscribed
controllers are notified.

Issue: androidx#644
PiperOrigin-RevId: 590904037
(cherry picked from commit 4974f96)
The timestamp adjuster also estimates the number of wraparounds
of the 90Khz TS timestamp. It does that by assuming that a new
timestamp is always close to the previous one (in either direction).

This logic doesn't always work for duration estimates because the
timestamp at the end of the media is not close to the one at the
beginning and it may also never be less than the one at the beginning.

This can be fixed by introducing a new estimation model that assumes
the new timestamp is strictly greater than the previous one without
making the assumption that it has to be close to it.

Issue: androidx#855

#minor-release

PiperOrigin-RevId: 590936953
(cherry picked from commit 0157878)
When track is changed during playback, `playbackPositionUs` may be in middle of a chunk and `loadPositionUs` should be the start of that chunk. In this situation `loadPositionUs` can be less than the current `playbackPositionUs`, resulting into negative `bufferedDurationUs`. It translates to having no buffer and hence we should send `0` for `bufferedDurationUs` when creating new instances of `CmcdData.Factory`.

Issue: androidx#888

#minor-release

PiperOrigin-RevId: 591099785
(cherry picked from commit 7f6596b)
PiperOrigin-RevId: 592182371
(cherry picked from commit 0b8a9a2)
While investigating Issue: androidx#887 I naively assumed the CEA-608
captions were in a TS file, but they're actually in an MP4 (which is
possibly obvious given DASH only supports MP4). This change includes
container info in the `EventLogger` `tracks` output.

PiperOrigin-RevId: 592192752
(cherry picked from commit 6853ffc)
PiperOrigin-RevId: 592871532
(cherry picked from commit 966b517)
PiperOrigin-RevId: 592916187
(cherry picked from commit 1845a4a)
When the 'when' timer of the notification is disabled
`DefaultMediaNotificationProvider` may set `C.TIME_UNSET`
as the time. Users reported problems on some devices with
this and the docs ask for an event time that probably
shouldn't be a negative number.

This change sets `0L` instead of `C.TIME_UNSET` when the
timer is disabled.

Issue: androidx#903

#minor-release

PiperOrigin-RevId: 594451074
(cherry picked from commit 426bc94)
PiperOrigin-RevId: 595650068
(cherry picked from commit 8eda9f2)
When the media notification controller is requested for a session
with `getConnectedControllerForSession` and the `Future` is not null
but not yet completed, the `Future` was returned either way. This was
reported as creating a race condition between the notification
being requested for update the very first time, and the media
notification controller having completed connecting to the session.

Returning null from `getConnectedControllerForSession` when the
`Future` is available but not yet done fixes the problem. This is
safe because for the case when a notification update is dropped,
the media notification controller will trigger the update as soon
as the connection completes.

Issue: androidx#917
#minor-release
PiperOrigin-RevId: 595699929
(cherry picked from commit 5c50b27)
These methods sound similar, but have different behaviour. This change
tries to make the distinction clearer, and sign-post from one to the
other.

#minor-release

Issue: androidx#910
PiperOrigin-RevId: 595701540
(cherry picked from commit 95e7429)
PiperOrigin-RevId: 596916027
(cherry picked from commit 324e1be)
Fix merge error with ffmpeg_jni.cc where cherry-pick process included code from nonselected commit.
Fix "subtitles rendered with border and no fill color" problem:
moneytoo/Player#413

because '0' means it's an index to the palette table, not an RGBA value of 0
Copy link

google-cla bot commented Jan 19, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@tonihei
Copy link
Collaborator

tonihei commented Jan 22, 2024

Thanks for the PR! Could you check the whether you signed the CLA (see robo comment above)? Otherwise we can't look into this pull request I'm afraid.

@SimonHung
Copy link
Author

OK, I have signed the CLA

@icbaker
Copy link
Collaborator

icbaker commented Jan 22, 2024

Can you please check again? The CLA check is still failing, suggesting that it can't match up the email address on your commit with the CLA submission you made.

@icbaker
Copy link
Collaborator

icbaker commented Jan 22, 2024

Please also update this to merge into the main branch, rather than release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet