1663 Commits

Author SHA1 Message Date
tofunmi
feb83c2d59 Update translations
PiperOrigin-RevId: 529069808
(cherry picked from commit bba760f6e5ae8ba6db2cd2e45163698223335c2a)
2023-05-15 16:32:38 +01:00
michaelkatz
841bdc6efe Add UTF-16 encoded subtitle support to SsaDecoder
Issue: androidx/media#319
PiperOrigin-RevId: 527891646
(cherry picked from commit 06ac2f7990f0cdf691365cc304fade522c983761)
2023-05-15 16:32:36 +01:00
bachinger
179e35b3d1 Add JavaDoc to some undocumented methods and move them
PiperOrigin-RevId: 527870443
(cherry picked from commit 336d4b386f9691fff419728d901d0d6ee7a2ebf8)
2023-05-15 16:29:03 +01:00
tonihei
40ef64ac3a Fix leaks of media session service.
References to the service are kept from MediaSessionStub
and from a long-delayed Handler messages in ConnectionTimeoutHandler.

Remove strong references from these places by making the timeout
handler static and ensuring ConnectedControllersManager only keeps
a weak reference to the service (as it's part of MediaSessionStub).

Issue: androidx/media#346
PiperOrigin-RevId: 527543396
(cherry picked from commit 8c262d6c072304ed9f16feca64b70a18645cc908)
2023-05-15 16:28:57 +01:00
bachinger
3406334ee8 Allow MediaLibraryService to reject the resumption notification
To reliably reject the System UI playback resumption notification on
all API levels (specifically API 30), the backward compatibility layer
needs to return `null` for the library root.

This is not possible in the Media3 implementation. This change allows
an app to return a `LibraryResult.ofError(RESULT_ERROR_NOT_SUPPORTED)`
that then is translated to return null by the backwards compatibility
layer.

Issue: androidx/media#355
Issue: androidx/media#167
Issue: androidx/media#27

See https://developer.android.com/guide/topics/media/media-controls#mediabrowserservice_implementation

PiperOrigin-RevId: 527276529
(cherry picked from commit 7938978b5165a9cbb63a6ee1fe5209934e996c6e)
2023-05-15 16:27:46 +01:00
Ian Baker
31492031c1 Merge pull request #313 from pengbins:fix_ts_h265reader_parse_sps
PiperOrigin-RevId: 527259619
(cherry picked from commit fab134f0b3194349aaac702f4c582ee20356b1dc)
2023-05-15 16:26:20 +01:00
ibaker
20924724fc Ensure DrmSessionManager.setPlayer() is called before prepare()
`prepare()` now logs a warning if it's called before `setPlayer()`
because it's not possible to tell if it's being called on the wrong
thread (since 3480a27994).

This change finds all the places one is called immediately after the
other and flips the order to be more correct.

Issue: androidx/media#350

#minor-release

PiperOrigin-RevId: 526582294
(cherry picked from commit 6aacbc6bbb11a5a55ec812cc93e0bb1b6810749e)
2023-05-15 16:14:45 +01:00
tonihei
3f5d777f38 Clarify threading requirement for MediaController.releaseFuture
And remove unnecessary check for isDone.

Issue: androidx/media#345
PiperOrigin-RevId: 525999615
(cherry picked from commit 186f3d5c7767e65cc823846b045282c05ed30da5)
2023-05-15 16:14:45 +01:00
tonihei
0f6a1eb6b8 Update available commands when MediaSessionCompat actions change
This is a bug currently, where commands are created once but never
updated again if the actions in MediaSessionCompat are changed.

PiperOrigin-RevId: 525999084
(cherry picked from commit 79fab6783e07ea594410be347c8a3d6e1124707d)
2023-05-15 16:14:40 +01:00
michaelkatz
eee226ea40 Render last frame even if have not read BUFFER_FLAG_END_OF_STREAM
If the limited number of input buffers causes reading of all samples except the last one conveying end of stream, then the last frame will not be rendered.

PiperOrigin-RevId: 525974445
(cherry picked from commit affbb7c57e73eb4f4f654f224c477fdd2e3ac9f2)
2023-05-15 16:10:51 +01:00
tonihei
fa972d9c1f Fix thread access when creating notifications for media sessions
The sessions may have different application threads for their players,
and the service with its notification provider runs on the main thread.
To ensure everything runs on the correct thread, this change labels
methods where needed and fixes thread access in some places.

Issue: androidx/media#318
PiperOrigin-RevId: 524849598
(cherry picked from commit ffa3743069408cf794cd48e8608df749e09d719e)
2023-04-18 17:05:28 +01:00
tonihei
8c5c58ec7e Remove unnecessary check for currentMediaItem in legacy session stub
This check was a leftover from when the metadata was generated from
the MediaItem only. Since we moved to the actual MediaMetadata fields,
the check is completely unnecessary and prevents accessing metadata
when the GET_CURRENT_MEDIA_ITEM command is not available.

PiperOrigin-RevId: 524837587
(cherry picked from commit e0bb23d4634421ede8827948a3ddae9c5d4a9089)
2023-04-18 15:19:27 +01:00
ibaker
d5a81c5c41 Use @link instead of @value
Dackka doesn't support `@value`

PiperOrigin-RevId: 524309695
(cherry picked from commit b834e49f9ff1b3777e5b69c609b9eed83e9e6a5f)
2023-04-18 15:18:39 +01:00
tonihei
3b2b8d528d Ensure TrackSelectionParameters overrides match existing groups
The overrides specified by a MediaController may not use the exact
same TrackGroup instances as known to the Player because the groups
have been bundled to and from the controller. This bundling may
alter the instance slightly depending on the version used on each
side of the communication and the fields set (e.g. Format.metadata
is not supported for bundling).

This issue can be solved by creating unique track group ids for
each group on the session side before bundling. On the way back,
the groups in the track selection parameters can be mapped backed
to their original instances based on this id.

Issue: androidx/media#296
PiperOrigin-RevId: 523986626
(cherry picked from commit 1c557e2fd18c77243474af2f8c99fa6ea061b38a)
2023-04-18 15:17:40 +01:00
rohks
ba6ccee802 Update colr box values to be overridden by bitstream boxes
#minor-release

PiperOrigin-RevId: 523983688
(cherry picked from commit 596a7c7033ba061b48ac4edd5647c6d2fb813a2d)
2023-04-18 15:16:49 +01:00
rohks
ade8831166 Bump version numbers to Media3 1.0.1 and ExoPlayer 2.18.6
#minor-release

PiperOrigin-RevId: 523959161
(cherry picked from commit e033dbac03bfa0eb2aa13f855360fafe9f1bd488)
2023-04-18 15:16:49 +01:00
bachinger
eb322b7c2e Precedence for app provided media button receiver
This change selects the best suited media button receiver
component and pending intent when creating the legacy
session. This is important to ensure that a service can
be started with a media button event from BT headsets
after the app has been terminated.

The `MediaSessionLegacyStub` selects the best suited
receiver to be passed to the `MediaSessionCompat`
constructor.

1. When the app has declared a broadcast receiver for
 `ACTION_MEDIA_BUTTON` in the manifest, this broadcast
 receiver is used.
2. When the session is housed in a service, the service
 component is used as a fallback.
3. As a last resort a receiver is created at runtime.

When the `MediaSessionLegacyStub` is released, the media
button receiver is removed unless the app has provided a
media button receiver in the manifest. In this case we
assume the app supports resuming when the BT play intent
arrives at `MediaSessionService.onStartCommand`.

Issue: androidx/media#167
Issue: androidx/media#27
Issue: androidx/media#314
PiperOrigin-RevId: 523638051
(cherry picked from commit e54a9343980c7f6c44ddf0edbb938dd5f6b11193)
2023-04-18 15:16:46 +01:00
tonihei
93605303ad Update available commands when setting a new player in MediaSession
PiperOrigin-RevId: 523633865
(cherry picked from commit ae875648a72b08f24c1e41cc5822fc24265dfd9b)
2023-04-18 15:00:09 +01:00
christosts
abc9d8ceda Change format logged when AudioSink throws InitializationException
Change what format is logged from MediaCodecAudioRenderer when
AudioSink throws InitializationException. We printed the
AudioSink's format, which most of the times is audio/raw (PCM)
and not the renderer's format. With this change both formats are
logged.

#minor-release

Issue: google/ExoPlayer#11066
PiperOrigin-RevId: 523456840
(cherry picked from commit baf1aa1cdbe626097c7fa310047edac7033f2ffe)
2023-04-18 14:59:20 +01:00
tonihei
5d11aa95ef Implement missing broadcastCustomCommand to legacy controller
And also mention a few restrictions regarding legacy components
in Javadoc.

Issue: androidx/media#293
PiperOrigin-RevId: 522005562
(cherry picked from commit 502969a42b2ba07ada555a38841c7c65baeaa594)
2023-04-18 14:58:24 +01:00
tonihei
86cc91687c Allow duplicated MediaItems in a legacy session
MediaItems are not meant to be unique in a playlist. If a legacy
session publishes multiple items that get converted to equal MediaItems,
the current code fails because we look up queue ids in a Map (that
doesn't allow duplicate entries).

Fix this by storing a simple list of items with additional data.

Issue: androidx/media#290
PiperOrigin-RevId: 521993802
(cherry picked from commit 219967c5a3ff8d8957a07e39c04ea27b657cab92)
2023-04-18 14:57:31 +01:00
rohks
10e2dfd2fa Remove Javadoc TODO from README of decoder extensions
As most classes are used via interface only and people depending on it locally can always find the Javadoc in Android Studio directly, we don't plan to add Javadocs for these extensions module in developer.android.com.

PiperOrigin-RevId: 521993756
(cherry picked from commit e4cb583af2feb607ec5c2c201c22cbd661e454a8)
2023-04-18 14:56:46 +01:00
tonihei
654a6786a6 Improve check for invalid connection request
The check currently relies on the default value of 0 returned if the
Bundle doesn't define a pid. But in some cases, like Robolectric unit tests,
0 is a possible pid. The check can be improved by directly asserting that
the value is defined.

PiperOrigin-RevId: 521414649
(cherry picked from commit 694d690bc03a34e112afc6cca58eb2761a25402a)
2023-04-18 14:56:46 +01:00
ibaker
3480a27994 Add warning logs if DefaultDrmSessionManager is used on wrong thread
Issue: google/ExoPlayer#11008
PiperOrigin-RevId: 520864579
(cherry picked from commit 7ca966842185dd6f07563f28058d78537b916731)
2023-04-18 14:56:46 +01:00
ibaker
10342507f7 Temporarily use exoplayer2-hosted SVGs in media3 javadoc
The media3-hosted versions of these SVGs were removed due to a change in
the way the reference docs are generated. While work on getting them
hosted on developer.android.com, this change simply links to the
(identical) exoplayer2 versions in order to fix the media3 docs.

#minor-release

PiperOrigin-RevId: 520647905
(cherry picked from commit 2e4f49fef741c21f47590d3a818b6ed43d94fc04)
2023-04-18 14:56:45 +01:00
tonihei
d07fcc3457 Remove remaining references to exoplayer.dev
PiperOrigin-RevId: 520314781
(cherry picked from commit 6952771e2f0637e91e27ed8851dc5b2a5a199afe)
2023-04-18 14:56:45 +01:00
ibaker
66b1282517 Post OfflineLicenseHelper interactions to its internal handler thread
`DefaultDrmSession(Manager)` expect most of their methods to be called
on the 'playback thread'. There isn't a playback thread in the case of
`OfflineLicenseHelper`, but in that case it's the thread backing
`DefaultDrmSessionManager.playbackLooper`, which is `OfflineLicenseHelper.handlerThread`.

PiperOrigin-RevId: 520053006
(cherry picked from commit 376bddef4720e07d18afeff0c591f03bf72149f7)
2023-04-18 14:56:45 +01:00
tonihei
56dd0f761d Handle output format changes for empty sample streams correctly
When MediaCodecRenderer is given an empty sample stream, it puts
its output format change tracking in a bad state where we never
process future stream changes because we are waiting for a sample
that doesn't exist.

We can fix this by:
 - Looping the pending output stream changes to see if we processed
   more than one change at once (this fixes the tracking for empty
   sample streams that are not the first in the queue).
 - Checking if none of the previous streams queued any samples in
   onStreamChanged to handle this in the same way as the case
   where we already output all samples (this fixes the problem when
   the empty sample stream comes first in the queue).
 - Also calling onProcessedStreamChange for the case above, which
   was missing previously.

#minor-release

PiperOrigin-RevId: 519226637
(cherry picked from commit b9790e69d7649d3399b9b1f920aa417ba4cc38c1)
2023-04-18 14:56:45 +01:00
Tianyi Feng
690ac23a20 Merge pull request #11051 from TiVo:p-fix-for-issue-11050
PiperOrigin-RevId: 518953648
(cherry picked from commit dc3481fca7f1a20f0e3d4b7da4df2bd2701861de)
2023-04-18 14:56:41 +01:00
michaelkatz
eea37031d1 Retry RTSP Setup with TCP if response with UDP is UnsupportedTransport
If RTSP Setup Request with UDP receives HTTP Error Status 461 UnsupportedTransport, then client will retry with TCP.

Issue: google/ExoPlayer#11069
PiperOrigin-RevId: 518807829
(cherry picked from commit ecf4d8b89193e8e3bb3ad3dbc9c7983fd26765ae)
2023-04-18 14:55:46 +01:00
Rohit Singh
b70b320c49 Merge pull request #11064 from haixia-meta:release-v2
PiperOrigin-RevId: 517128752
(cherry picked from commit 0e3f407e0ec482eecd65b070fbec2d0fe91e255d)
2023-04-18 14:54:34 +01:00
rohks
65d4202f6e Add support to fetch ColorInfo from hvcc box in AtomParsers
#minor-release

PiperOrigin-RevId: 517086016
(cherry picked from commit 8a5fcf82d32268c81b641951d4d270875cbcc62a)
2023-04-18 14:54:34 +01:00
Rohit Singh
60e0546bea Merge pull request #11061 from cedricxperi:dts-udts-support
PiperOrigin-RevId: 517067549
(cherry picked from commit 49d85d625c42177aaf0d6413ba7ee0ae7b4d580e)
2023-04-18 14:54:34 +01:00
tonihei
a94fb21dcb Make DefaultDashChunkSource more robust against empty segment timelines
Segment timelines are technically allowed to be empty, but not all places
add the necessary checks.

Issue: google/ExoPlayer#11014
PiperOrigin-RevId: 514722205
(cherry picked from commit 788132b9dc9f5dd9aa46f413b16f43433c9c7702)
2023-04-18 14:54:30 +01:00
ibaker
4666d57b12 Ensure ForwardingPlayer users do listener registration correctly
The `@CallSuper` annotation should help catch cases where subclasses are
calling `delegate.addListener` instead of `super.addListener` but it
will also (unintentionally) prevent subclasses from either completely
no-opping the listener registration, or implementing it themselves in a
very custom way. I think that's probably OK, since these cases are
probably unusual, and they should be able to suppress the warning/error.

Issue: androidx/media#258

#minor-release

PiperOrigin-RevId: 513848402
(cherry picked from commit 5d23a92923324ecab338d14e865bcc26316aab00)
2023-04-18 14:49:09 +01:00
rohks
2ca9050134 Add media3 guide entries in README files
PiperOrigin-RevId: 520650881
(cherry picked from commit 766e7d7d35f20b91a2c72635ac13b10ad9d22dac)
2023-03-31 13:36:24 +01:00
rohks
d1d16659a6 Fix javadoc links in media README files
Also fixed the javadoc link in devsite and removed javadoc links from decoder extensions as it is not published yet on developer.android.com.

#minor-release

PiperOrigin-RevId: 520636868
(cherry picked from commit 6a928805d4b0f52f5f07b1f7cd75e2a7357e9397)
2023-03-31 13:35:43 +01:00
tonihei
dd2008b9ed Bump version numbers to Media3 1.0.0 and ExoPlayer 2.18.5
#minor-release

PiperOrigin-RevId: 516514583
(cherry picked from commit 137b40b76fe4f4d92ac02fbe56eb459693d80e2f)
2023-03-14 16:20:09 +00:00
tonihei
687362e6fe Document that custom commands can only be sent if they are defined
Custom commands from controller to session are blocked if they are
not listed in the available session command list. This isn't well
documented in the Javadoc currently.

#minor-release

PiperOrigin-RevId: 514733568
(cherry picked from commit 20669fca275554698c9176250005055b230485b3)
2023-03-14 16:19:24 +00:00
ibaker
14b0dcb957 Add missing @param tags
Dackka generates a warning if a method has at least one `@param` tag,
but not all of them are documented.

PiperOrigin-RevId: 513873453
(cherry picked from commit cb7d565fd47fc0b818ec0d5c7529e19df44022b5)
2023-03-14 16:19:20 +00:00
tonihei
7958737655 Fix lint-baseline.xml for latest UI translations
#minor-release

PiperOrigin-RevId: 513533248
(cherry picked from commit 8498e4b4445ae88665c6cdbc4e47e8e6ca7b7303)
2023-03-02 17:58:04 +00:00
bachinger
d47675f017 Fix some JavaDoc in the Media3 session module
#minor-release

PiperOrigin-RevId: 513501046
(cherry picked from commit 6042bec18a4b30449a20d1e858bac799cc6d18c3)
2023-03-02 13:52:12 +00:00
tonihei
67fd41a49d Bump version numbers to Media3 1.0.0-rc02 and ExoPlayer 2.18.4
#minor-release

PiperOrigin-RevId: 513488487
(cherry picked from commit cd753bd7b8c3206b509949e851f515ca465e4c89)
2023-03-02 13:52:12 +00:00
tonihei
dbf737de08 Merge pull request #255 from mayurk2:use_edts_offset_if_it_is_for_entire_file
PiperOrigin-RevId: 513213229
(cherry picked from commit 17499cefcc1b27d90ecdf136bd3b2e4856ddcaf1)
2023-03-02 09:44:16 +00:00
ibaker
ddd5e9bc19 Remove @see tags with <a> tags
These are not supported by Dackka

#minor-release

PiperOrigin-RevId: 513176533
(cherry picked from commit c07cf3dc414b562652cdd4f3b0e91f80493a2c40)
2023-03-02 09:44:16 +00:00
christosts
7d6a359a85 Minor change in ForwardingPlayer javadoc
#minor-release

PiperOrigin-RevId: 512897269
(cherry picked from commit 42fae152d0ad381c8bbb0858f596770529f11f40)
2023-03-02 09:44:16 +00:00
tonihei
ee4ac61640 Update translations
#minor-release

PiperOrigin-RevId: 512890813
(cherry picked from commit a7faa5bfd8c82e22c7d99378cf78f31a57274db2)
2023-03-02 09:44:16 +00:00
tonihei
b44fb574b5 Ensure getPlaybackHeadPosition isn't called if not needed
Once the value returned from AudioTimestampPoller advances, we
only need getPlaybackHeadPosition to sample sync params and
verify the returned timestamp. Both of these happen less often
and we can avoid calling getPlaybackHeadPosition if we don't
actually need it.

PiperOrigin-RevId: 512882170
(cherry picked from commit 408b4449ff75e29a9bda7adc1b530b993fc47814)
2023-03-02 09:44:16 +00:00
tonihei
f690ebdf46 Fix some playback parameter signalling problems.
Playback parameter signalling can be quite complex because
 (a) the renderer clock often has a delay before it realizes
     that it doesn't support a previously set speed and
 (b) the speed set on media clock sometimes intentionally
     differs from the one surfaced to the user, e.g. during
     live speed adjustment or when overriding ad playback
     speed to 1.0f.

This change fixes two problems related to this signalling:
 1. When resetting the media clock speed at a period transition,
    we don't currently tell the renderers that this happened.
 2. When a delayed speed change update from the media clock is
    pending and the renderer for this media clock is disabled
    before the change can be handled, the pending update becomes
    stale but it still applied later and overrides any other valid
    speed set in the meantime.

Both edge cases are also covered by extended or new player tests.

Issue: google/ExoPlayer#10882

PiperOrigin-RevId: 512658918
(cherry picked from commit e79b47ccff39363543c514937aef517a855994f0)
2023-03-02 09:44:13 +00:00
tianyifeng
ad428004fd Update notification play/pause button with matching player state
Issue: androidx/media#192
PiperOrigin-RevId: 508649684
(cherry picked from commit e1d12fc395d9f9edb28755a5b1026e26b378e005)
2023-03-02 09:42:55 +00:00