11979 Commits

Author SHA1 Message Date
claincly
baa9a367e2 Improve timeout handling and allow customizing the timeout.
Previously, a SocketTimeourException is used to signal the end of the stream
that is caused by "no RTP packets received for a while". However, such
signaling is inappropriate under TransferRtpDataChannel, or FakeRtpDataChannel
in RtspPlaybackTests.

Hence, the signaling of end of stream is changed to use RESULT_END_OF_INPUT.
The RtpDataChannel implementations will Still block until a set timeout, but
will return a C.RESULT_END_OF_INPUT should a timeout occur, instead of
throwing a nested SocketTimeoutException.

This also allowed customization of the timeout amount, in
RtspMediaSource.Factory

PiperOrigin-RevId: 380981534
2021-07-16 16:12:59 +01:00
claincly
e4bd2e213f Amend release note for 46bc49a4f6.
PiperOrigin-RevId: 380766548
2021-07-16 16:12:59 +01:00
olly
90cd2a2131 Fix expansion of items within StyledPlayerView popup
Issue: #9086
PiperOrigin-RevId: 380756562
2021-07-16 16:12:59 +01:00
olly
5b8be42fa1 HLS: Fix issue where a live event doesn't transition to STATE_ENDED
The problem occurs when the primary media playlist URL switches
from one whose latest snapshot has not yet got the ended tag, to
one whose latest snapshot already has the ended tag. In this case:

- We trigger a redundant load of the ended playlist.
- When the redundant load completes,
  MediaPlaylistBundle.processLoadedPlaylist detects that the
  playlist is unchanged from the one it already has, and so
  doesn't call onPlaylistUpdated.
- PrimaryPlaylistListener.onPrimaryPlaylistRefreshed is never
  called with the new primary. Hence the externally visible primary
  is still the one that hasn't ended. HlsMediaSource therefore thinks
  the event hasn't ended, which in turn prevents the player from
  transitioning to the ended state.

This commit detects when the new primary already has the ended tag.
In this case, we call onPrimaryPlaylistRefreshed directly and remove
the unnecessary playlist load.

Issue: #9067
#minor-release
PiperOrigin-RevId: 380680532
2021-07-16 16:12:59 +01:00
olly
79f03dfba3 Fix DefaultTimeBar glitches
The glitches were introduced in:
https://github.com/google/ExoPlayer/commit/6c31e34528

The problem is that Listener.onEvents is called in a later looper iteration
than the listener methods that were previously used. This created a gap on
the main thread between the UI component dispatching a seek operation to the
player, and onEvents being called to update the progress bar's position.

At the start of this gap the progress bar is rendering the new position,
but its position member variable is still set to the old position. If the
progress bar is re-drawn by another message on the main thread within the
gap, it will briefly show the old position until onEvents is called.

There are multiple possible fixes to this, and the best one is probably to
modify ListenerSet to remove the gap. That's high risk though, so for now we
fix the flicker by always updating the progress immediately after the seek
is dispatched, in addition to when onEvents is called.

Issue: #9049
PiperOrigin-RevId: 380678388
2021-07-16 16:12:59 +01:00
olly
93f4e5ff85 Specify a root when inflating child views
#minor-release

PiperOrigin-RevId: 380655806
2021-07-16 16:12:59 +01:00
olly
8287b2529b Workaround for focus issues on API levels less than 26
Issue: #9061
PiperOrigin-RevId: 380640601
2021-07-16 16:12:58 +01:00
ibaker
de16dea006 Re-word the DataSourceContractTest javadoc
This softens the language around suppressing individual test methods.
There are some legitimate cases where this is needed, e.g.
ByteArrayDataSourceContractTest has to suppress all the tests related
to non-existent resources because it's not possible to simulate that
case.

#minor-release

PiperOrigin-RevId: 380570017
2021-07-16 16:12:58 +01:00
claincly
e2040a5893 Use a HashMap like behaviour in parsing SDP.
Some server will wrongly insert duplicated attributes. We used to treat this as
a unrecoverable error, but it is better to treat the duplicated attributes in
an "over-writable" fashion like HashMaps.

Issue: #9080,
Issue: #9014
PiperOrigin-RevId: 380547079
2021-07-16 16:12:58 +01:00
ibaker
60bbe64ab3 Simplify FileDataSourceContractTest
#minor-release

PiperOrigin-RevId: 380531272
2021-07-16 16:12:58 +01:00
ibaker
a27d9a04b8 Allow repeated DRM provisioning in DefaultDrmSessionManager
Also change to explicitly track the provisioning session, which makes
the code easier to reason about than always using the zero'th element
of the list.

PiperOrigin-RevId: 380181453
2021-07-16 16:12:58 +01:00
christosts
ed563183cd Set master playlist's channelCount only on audio renditions
PiperOrigin-RevId: 379935363
2021-07-16 16:12:58 +01:00
christosts
f3e62343fc Forward FRAME-RATE from the master playlist to renditions
Issue: #8960

PiperOrigin-RevId: 379922704
2021-07-16 16:12:58 +01:00
ibaker
4190ff3274 Add a test for the provisioning flow to DefaultDrmSessionManagerTest
#minor-release

PiperOrigin-RevId: 379913814
2021-07-16 16:12:58 +01:00
olly
c269a62fe0 HLS: Fix issue where new init segment would not be loaded
Issue: #9004
PiperOrigin-RevId: 379516815
2021-07-16 16:12:58 +01:00
olly
08dbfd5c5a Fix issue where a trun atom could be associated with the wrong track
Note that this removes a workaround for malformed content, in which the
track_ID is set incorrectly. It's unclear there was sufficient reason to
implement that workaround, and so it's preferable to remove it, rather
than implementing the concept of unrecognized tracks, which would be
needed to keep it and to also fix this issue.

Issue: #9056
PiperOrigin-RevId: 379506261
2021-07-16 16:12:58 +01:00
ibaker
189c52bc96 Add DRM info to Format.toLogString
The Widevine H264 samples in the demo app now log this from the EventLogger:
```
[X] Track:0, id=1, mimeType=video/avc, bitrate=772315, codecs=avc1.42c01e, drm=[widevine,cenc], res=320x142, fps=24.0, supported=YES
```

And the VP9 ones log:
```
[X] Track:0, id=1, mimeType=video/x-vnd.on2.vp9, bitrate=588256, codecs=vp9, drm=[widevine], res=320x142, fps=23.809525, supported=YES
```

#minor-release

PiperOrigin-RevId: 379498332
2021-07-16 16:12:58 +01:00
Oliver Woodman
d3a0709374 Merge pull request #9023 from DolbyLaboratories:dev-v2-multicodecs
PiperOrigin-RevId: 379440699
2021-07-16 16:12:58 +01:00
Oliver Woodman
3ae4c1b07b Merge pull request #6500 from DolbyLaboratories:dev-v2-isDirectPlaybackSupported
PiperOrigin-RevId: 378895355
2021-07-16 16:12:58 +01:00
olly
9a876f7300 Fix IncorrectContextUseViolation on Android 11
Issue: #8246
PiperOrigin-RevId: 378606475
2021-07-16 16:12:58 +01:00
olly
19e3d9b8ca Bump dexmaker version
Issue: #9032
PiperOrigin-RevId: 378605169
2021-07-16 16:12:58 +01:00
aquilescanta
7b96ba0507 Bump the androidx annotation version to 1.2.0
It is the current public stable version and it brings in @DoNotInline.

PiperOrigin-RevId: 378119413
2021-07-16 16:12:52 +01:00
olly
049b6edbb3 Update PlayerNotficationManager to set PendingIntent.FLAG_IMMUTABLE on its Broadcast intent.
In Android 12 mutability flags have to be set on PendingIntents. If they
are not, and the app targets Android 12, then the app will be crashed by
the system.

PiperOrigin-RevId: 373427591
2021-07-16 15:57:38 +01:00
kimvde
227f9a3b93 PlayerNotificationManager: add setUseRewind/FastForwardAction
This is a preliminary step to deprecate ControlDispatcher.

PiperOrigin-RevId: 385097270
2021-07-16 11:25:42 +01:00
bachinger
78ecb10ac0 Add RepresentationHolder.selectedBaseUrl and use it for new chunks
PiperOrigin-RevId: 384968532
2021-07-16 11:24:21 +01:00
aquilescanta
99abb4e1e9 Check for TS synchronization before parsing packet from random position
#minor-release
Issue: #9100
PiperOrigin-RevId: 384962258
2021-07-16 11:22:55 +01:00
olly
7157f3c119 Move E2E DASH test into DASH package
PiperOrigin-RevId: 384912341
2021-07-15 14:47:20 +01:00
kimvde
85f3af8864 Use Player commands to enable UI buttons
PiperOrigin-RevId: 384910388
2021-07-15 14:45:44 +01:00
olly
08ac778ad6 Fix package name for UI tests
PiperOrigin-RevId: 384893655
2021-07-15 13:23:42 +01:00
olly
7edcc89421 Fix 1 ErrorProneStyle finding:
* Constructors and methods with the same name should appear sequentially with no other code in between, even when modifiers such as static or private differ between the methods. Please re-order or re-name methods.
  (see http://go/bugpattern/UngroupedOverloads)

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/media/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: 384877648
2021-07-15 13:22:18 +01:00
bachinger
f60c080500 Minor change to extractor module to avoid formatting changes
PiperOrigin-RevId: 384730845
2021-07-14 21:18:23 +01:00
samrobinson
b9ac5a145f Implement a DefaultMediaDescriptionAdapter that uses MediaMetadata.
PiperOrigin-RevId: 384681659
2021-07-14 21:16:20 +01:00
claincly
6512463280 Make network-based DataSource implementations use ErrorCode.
PiperOrigin-RevId: 384666131
2021-07-14 12:19:49 +01:00
claincly
f9f93c5a49 Handle absolute URI in RtspMediaTrack.
Issue: #9183

RFC2326 Section C.1.1 specifies that the URI to identify a track can be either
absolute (like rtsp://example.com/path) or relative (like "path"). Currently
we don't handle absolute URI, and this CL is to add the support.

Note though, we don't currently use the Content-Base or Content-Location
headers for the session URI.

PiperOrigin-RevId: 384649818
2021-07-14 12:18:31 +01:00
kimvde
ae31ebb143 Rename previous/next to seekToPrevious/NextWindow in Player
Also rename hasPrevious/Next to hasPrevious/NextWindow for consistency.

This makes it clearer what the difference between
seekToPrevious/NextWindow and seekToPrevious/Next is.

PiperOrigin-RevId: 384643373
2021-07-14 12:17:15 +01:00
olly
3670541465 Add option to disable 5G-NSA disambiguation
PiperOrigin-RevId: 384575860
2021-07-14 12:15:48 +01:00
olly
e403dda105 End ListenerSet iteration sooner
PiperOrigin-RevId: 384500287
2021-07-14 12:14:19 +01:00
olly
949f715c6b Avoid IncorrectContextUseViolation on Android 11
Applications may need to pass a non-visual context when creating
a DefaultTrackSelector (e.g., because they're audio-only or are
creating the selector in a background service).

Obtaining the default display via DisplayManager avoids the strict
mode violation that occurs when retrieving it via WindowManager.

#minor-release

PiperOrigin-RevId: 384487363
2021-07-14 12:13:06 +01:00
kimvde
58541fa1d1 Add SEEK_TO_NEXT command
PiperOrigin-RevId: 384477188
2021-07-14 12:11:46 +01:00
claincly
002874e9e9 Use DataSourceException in FileDataSource.
PiperOrigin-RevId: 384451470
2021-07-14 12:10:20 +01:00
aquilescanta
72b416c617 Remove ExoPlaybackException factory method that doesn't take errorCode
PiperOrigin-RevId: 384442821
2021-07-14 12:08:53 +01:00
aquilescanta
cdaf3e4e99 Move DRM error code assignment into DefaultDrmSession
PiperOrigin-RevId: 384280087
2021-07-13 10:10:24 +01:00
kimvde
8451be1b0b Add SEEK_TO_PREVIOUS command
PiperOrigin-RevId: 384257929
2021-07-13 10:09:06 +01:00
ibaker
1058997e38 Explicitly override all non-deprecated methods in Player.Listener
Most of the super-interfaces are deprecated, but the intention is that
only the types are deprecated and the methods themselves shouldn't be.
In order to reflect this in javadoc we override all the methods in
`Player.Listener` in order to 'cancel' the deprecation.

This change deliberately doesn't override methods that are explicitly
deprecated with documented replacements (like
`Player.EventListener#onPlayerStateChanged`) - these should contine to
be marked as deprecated in javadoc.

PiperOrigin-RevId: 384253725
2021-07-13 10:07:54 +01:00
aquilescanta
6c37c3c2f4 Add ERROR_CODE_DRM_LICENSE_EXPIRED for KeysExpiredException
The errorCode assignment will be done in a following CL.

PiperOrigin-RevId: 384230228
2021-07-13 10:05:20 +01:00
olly
822f6282f1 The sound, vibrate and ticker will only be played once
Android doc:https://developer.android.com/reference/android/app/Notification.Builder#setOnlyAlertOnce(boolean)

PiperOrigin-RevId: 384227580
2021-07-13 10:04:11 +01:00
claincly
ca28d6a041 Move TYPE definition out from DataSourceException.
The types (open/close/read) does not provide extra information about the thrown
playback exception, and they are not utilized at higher levels.

PiperOrigin-RevId: 384219870
2021-07-13 10:03:01 +01:00
kimvde
d84e19a302 Rename COMMAND_GET_MEDIA_ITEMS to COMMAND_GET_TIMELINE
This is more descriptive.

PiperOrigin-RevId: 383887927
2021-07-13 10:01:46 +01:00
kimvde
7031c4398d Re-order next and previous commands
This is consistent with seek back and forward commands.

PiperOrigin-RevId: 383867710
2021-07-13 10:00:31 +01:00
kimvde
bc0f3935d6 Re-order seekBack and seekForward in Player
This is more consistent with other Player methods like previous and
next.

PiperOrigin-RevId: 383832298
2021-07-13 09:59:14 +01:00