7568 Commits

Author SHA1 Message Date
ibaker
c65b3d5edc Bump version to 2.14.2 and tidy release notes
PiperOrigin-RevId: 385996618
2021-07-21 15:48:18 +01:00
bachinger
f8278da75d Add flag to SinglePeriodTimeline to suppress projection
Issue: #9037
#minor-release
PiperOrigin-RevId: 385630065
2021-07-20 09:18:16 +01:00
ibaker
dbebd279c4 Avoid DefaultDrmSessionManager releasing too many session references
Before this fix, if DefaultDrmSessionManager.release() was called while
there was at least one 'external' session reference still active (i.e.
session.referenceCount > 1) then the manager will release it's reference
immediately but when the session's reference count subsequently drops to
1 (due to external references being released) the manager will schedule
a task to release its internal reference *again*.

This change fixes the problem by only scheduling the timed release if
the manager is unreleased. This ensures that the internal references
are only released once.

Issue: #9193

PiperOrigin-RevId: 385580741
2021-07-20 09:18:16 +01:00
aquilescanta
9cd6b50595 Check for TS synchronization before parsing packet from random position
#minor-release
Issue: #9100
PiperOrigin-RevId: 384962258
2021-07-20 09:18:16 +01:00
claincly
d4c62f386f 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-20 09:18:16 +01:00
olly
0f3818efcc 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-20 09:18:16 +01:00
ibaker
a47eb8a08a 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-20 09:17:58 +01:00
olly
c7d34d768d 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-16 16:12:59 +01:00
kimvde
d587420650 Add support for MP4 H263 atom type
#minor-release
Issue:#9158
PiperOrigin-RevId: 383660258
2021-07-16 16:12:59 +01:00
ibaker
17c6092335 Clarify the thread requirements of a SurfaceView or SurfaceHolder
Issue: #9005
PiperOrigin-RevId: 382765045
2021-07-16 16:12:59 +01:00
ibaker
278593f0c8 Use the content URI as well as mediaId for the auto-generated ad ID
MediaItem.mediaId used to default to the content URI, but this changed:
cc26a92e07

Before the mediaId change linked above, a playlist of different content
all with the same ad URI would play the ads for every item. After the
change the ad would only play once (because mediaId == "" for every
item, so they're all the same). This change restores roughly the
original behaviour by always considering both mediaId and the content
URI.

Issue: #9106
PiperOrigin-RevId: 382763618
2021-07-16 16:12:59 +01:00
ibaker
306b2e6d2e Don't propagate attrs into child SubtitleOutput from SubtitleView
PiperOrigin-RevId: 382763308
2021-07-16 16:12:59 +01:00
ibaker
3430912581 Encode emsg duration & ID as int64 instead of uint32
The serialization scheme used here is custom, it doesn't need
to be compatible with emsg-v0 or emsg-v1 (since
97183ef558).

This means that C.TIME_UNSET will propagate correctly through the
serialization.

Issue: #9123
PiperOrigin-RevId: 382762873
2021-07-16 16:12:59 +01:00
ibaker
f5d8efbf40 Add @Deprecated to SEP methods that override deprecated methods
Without this annotation it seems that `SimpleExoPlayer` effectively
'un-deprecates' the method, specifically:
* A usage of these methods isn't flagged by Android Studio if the
  declared type is `SimpleExoPlayer` (up-casting to e.g.
  `ExoPlayer.VideoComponent` results in the warning showing up).
* The `SimpleExoPlayer` javadoc doesn't mention this method is
  deprecated:
  https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/SimpleExoPlayer.html#addVideoListener(com.google.android.exoplayer2.video.VideoListener)
* The Metalava API output for `SimpleExoPlayer` doesn't show these
  methods as deprecated.

PiperOrigin-RevId: 382756174
2021-07-16 16:12:59 +01:00
aquilescanta
d699fb5dd9 Add info about trick-playness to the Format log string
PiperOrigin-RevId: 382139109
2021-07-16 16:12:59 +01:00
kimvde
e272e3b1c8 Improve support for Ogg truncated content
Issue:#7608
PiperOrigin-RevId: 382081687
2021-07-16 16:12:59 +01:00
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
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
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
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
Oliver Woodman
9be1d3f583 Fix build error in RTSP tests 2021-06-10 18:06:46 +01:00
olly
5e88837ecc Bump version to 2.14.1 and tidy release notes
PiperOrigin-RevId: 378665771
2021-06-10 17:51:02 +01:00
olly
c779d83fcd Register RTSP module
PiperOrigin-RevId: 377106891
2021-06-10 12:57:05 +01:00
Oliver Woodman
ba01d4d4a8 Fix import 2021-06-10 12:52:56 +01:00
claincly
a5fda46f78 Move RtspClient creation into RtspPeriod.
RtspMediaSource uses the timeline update paradigm from ProgressiveMediaPeriod.

PiperOrigin-RevId: 378150758
2021-06-10 12:49:32 +01:00
claincly
d64bbb449e Fix TCP retry bug when some RTSP tracks are not selected.
The size of rtspLoaderWrappers must match the number of tracks exposed by the
RTSP session (a track is exposed if its media description entry appears in
DESCRIBE's SDP response).

When retrying with TCP, the old code will start loading all exposed RTSP
tracks, regardless of whether they are selected.
The fixed code will only start loading selected tracks.

#minor-release

PiperOrigin-RevId: 377931030
2021-06-10 12:48:41 +01:00
claincly
e1a071b33b Propagate duplicated keys error in SDP better.
The current code does not catch the IAE thrown when building a MediaDescription
or SessionDescription. This CL catches the IAE and propagates it as a
ParserException.

Issue: #9014.

PiperOrigin-RevId: 377544439
2021-06-10 12:48:22 +01:00
claincly
64533c7947 Allow TCP retry when using authentication.
The old version's retry logic will not work if using authentication.
Specifically, we use the same authentication parameters from the previous
session, and the RTSP server will reject such parameter.

In this fix, we reset the authentication info on retry. Further, we retry the
last request on receiving a 401 Unauthorized, rather than sending out another
DESCRIBE request.

#minor-release

PiperOrigin-RevId: 377539711
2021-06-10 12:45:17 +01:00
claincly
74ff9f21f0 Add factory method to for using TCP streaming.
#minor-release

PiperOrigin-RevId: 377476603
2021-06-10 12:45:00 +01:00
claincly
c15acdf0db Allow reading RTSP message body by Content-Length.
Related to Issue: #8941.

RTSP message body's format is not regulated by the RTSP spec, meaning it can
use either CRLF or LF as its line terminator. The old code assumes every line
ends with CRLF (RTSP message and the message body); the new code will rely on
the Content-Length information to receive the bytes for the message body.

#minor-release

PiperOrigin-RevId: 377475565
2021-06-10 12:44:30 +01:00
tonihei
4d3b98c212 Fix start position for non-precise startOffset and user-set liveOffset
Also added test cases covering this.

PiperOrigin-RevId: 374218514
2021-06-07 13:45:15 +01:00
Oliver Woodman
52ee246edb Merge pull request #8767 from uvjustin:hls-start-from-independent-part
PiperOrigin-RevId: 373343326
2021-06-07 13:44:24 +01:00
andrewlewis
a83e4a7ab8 Fix texture transformation in gldemo
`SurfaceTexture` provides a transform matrix with each buffer. Previously
gldemo ignored this but it is important to apply it to have the video render
properly.

The transformation matrix from the surface texture includes flipping so this
change removes the hard-coded flipping from `a_texcoord`.

Issue: #8992

#minor-release

PiperOrigin-RevId: 377271389
2021-06-06 23:38:22 +01:00
claincly
3cf28171a2 Fallback to generate profile-level-id using H264 SPS if it's missing
Related to: Issue: #9010

Profile-level-id (Format.codecs) can be generated from SPS if SDP does not
include it.

#minor-release

PiperOrigin-RevId: 377251211
2021-06-06 23:38:11 +01:00
claincly
027baa556a Allow RtspServer read a RTP dump file.
#minor-release

PiperOrigin-RevId: 377001305
2021-06-06 23:38:02 +01:00