11606 Commits

Author SHA1 Message Date
aquilescanta
22b126cac3 Assign ERROR_CODE_IO_NO_PERMISSION to ErrnoException (EACCES)
PiperOrigin-RevId: 378134423
2021-06-08 16:38:44 +01:00
aquilescanta
14d101bbc4 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-06-08 13:06:05 +01:00
kimvde
e4263c4a67 Add fast forward and rewind methods to Player
PiperOrigin-RevId: 378104210
2021-06-08 13:04:56 +01:00
claincly
d0dc72fb6a 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-08 13:03:51 +01:00
olly
4b30cca914 Update @SuppressWarnings annotations for go/nullness diagnostics
in preparation for upgrading the version of the Checker Framework in google3.

More information: go/checker-3110-lsc

PiperOrigin-RevId: 377925828
2021-06-08 13:02:47 +01:00
olly
71fb7411ce Notify the client when ExoPlayer fallbacks to a different codec.
PiperOrigin-RevId: 377602447
2021-06-08 13:01:44 +01:00
claincly
efdd55fad5 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.

#minor-release

PiperOrigin-RevId: 377544439
2021-06-08 13:00:38 +01:00
aquilescanta
4e85184955 Make PlayerView depend on PlaybackException
PiperOrigin-RevId: 377542206
2021-06-08 12:59:38 +01:00
claincly
95c0c5caa5 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-08 12:58:39 +01:00
aquilescanta
146648ce22 Make MediaSessionConnector depend on PlaybackException
PiperOrigin-RevId: 377529353
2021-06-08 12:57:38 +01:00
christosts
fd4cfcdd67 AsynchronousMediaCodecAdapter cleanup
After refactoring MediaCodecAdapter.Factory to create configured and
started MediaCodecAdapters in a single operation, the
AsynchronousMediaCodecAdapter does not need to have separate methods to
configure and start, so they are merged. The CONFIGURED state is
removed.

PiperOrigin-RevId: 377519117
2021-06-08 12:56:39 +01:00
aquilescanta
29eeff9ff7 Assign error codes to FileDataSourceExceptions
PiperOrigin-RevId: 377481210
2021-06-08 12:54:31 +01:00
aquilescanta
536f7c8dbe Make StyledPlayerView depend on PlaybackException
PiperOrigin-RevId: 377480089
2021-06-08 12:53:22 +01:00
claincly
cc3cd702ff Add factory method to for using TCP streaming.
#minor-release

PiperOrigin-RevId: 377476603
2021-06-08 12:52:21 +01:00
claincly
69f9e23268 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-08 12:51:15 +01:00
olly
b56b769faa Update @SuppressWarnings annotations for go/nullness diagnostics
in preparation for upgrading the version of the Checker Framework in google3.

More information: go/checker-3110-lsc

PiperOrigin-RevId: 377374612
2021-06-08 12:50:09 +01:00
bachinger
80927843cb Remove VpxOutputBuffer from vp9 decoder extension
PiperOrigin-RevId: 377346438
2021-06-08 12:48:57 +01:00
ybai001
c299ccf7e4 DD+JOC track can't be selected if there are multi tracks in manifest file
DD+JOC track can't be selected if there are multi tracks in manifest file.
2021-06-07 22:15:54 +08:00
ybai001
1389b4a19f
Merge pull request #21 from google/dev-v2
Dev v2 on June 7th 2021
2021-06-07 21:48:00 +08: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
Dean Wheatley
cb1084f498 Use isDirectPlaybackSupported in AudioCapabilities
For Q devices and higher, use AudioTrack.isDirectPlaybackSupported
for determining AudioCapabilities.
2021-06-07 20:59:31 +10:00
olly
5c0bd14aa9 Fix version number 2021-06-06 23:43:20 +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
olly
29bb552b57 Align README and helloworld documentation
#minor-release

PiperOrigin-RevId: 377269770
2021-06-06 23:38:17 +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
ibaker
2ab0e1dc36 Keep secure MediaCodec instances when disabling the renderer
A renderer is disabled (without being reset) in two situations:
* When transitioning into a period that starts with a discontinuity
* When stopping the player with setForegroundMode(true)

Before this change the behaviour of `MediaCodecRenderer` when disabled
(but not reset) depended on whether the content being decoded had an
associated `DrmSession`:
* For content without an associated DRM session the MediaCodec instance
  was kept alive.
* For content with an associated DRM session, the MediaCodec instance
  was released. This was to prevent the DRM session from staying alive
  and continuing to make license refresh network requests while the
  player was stopped in 'foreground mode'.

This change removes the second bullet, and keeps MediaCodec instances
alive in both the secure and insecure case. This will result in the
DRM machinery making occasional license refresh network requests (at
a frequency defined by the license policy) while the player is stopped
and in 'foreground mode'. This network usage is considered to be a
'limited resource' as described by the `ExoPlayer#setForegroundMode`
javadoc.

This means that switches between secure content (or between secure and
clear content when `MediaItem.drmConfiguration.sessionForClearTypes`
indicates a secure decoder should be used for clear content) should
keep the same video decoder, thus avoiding the 'black flash' that occurs
on some devices when switching the surface away from a secure decoder.

Issue: #8842

#minor-release

PiperOrigin-RevId: 376825501
2021-06-06 23:37:54 +01:00
ibaker
037f24a003 Ensure DefaultDrmSessions keep working if their manager is released
This change introduces a third 'state' for `DefaultDrmSessionManager`:
It's been fully released (prepareCount == 0) but at least one of its
sessions is still active.

In this state new acquisitions are rejected (`(pre)acquireSession()`
calls will fail) but the machinery to support the existing sessions
(ExoMediaDrm and MediaDrmHandler) is kept until they're all released.

This change will allow us to remove the TODO in MediaCodecRenderer
that resolves Issue: #8842.

PiperOrigin-RevId: 376193952
2021-06-06 23:37:47 +01:00
ibaker
fd25d2f5ea Add a test for handling of DRM key refresh events
In a follow-up change I will add an additional test to ensure these
events continue to be correctly handled when DefaultDrmSessionManager
has prepareCount==0 but a non-null ExoMediaDrm instance.

PiperOrigin-RevId: 376190225
2021-06-06 23:37:39 +01:00
olly
10e96c99e5 Fix incorrect re-use of non-secure DummySurface with secure decoder
Issue: #8776
PiperOrigin-RevId: 376186877
2021-06-06 23:37:25 +01:00
ibaker
5cec2a761f Cleanup the MediaItem.Builder javadoc for 'conditional' setters
Many of the setters are ignored unless others are set - this change:
* Lists these conditions exhaustively.
* Uses more concise language to avoid overshadowing the main details
  of what the setter sets.
* Tweaks the language from 'is ignored' to 'shouldn't be called', to
  open up the future possibility of throwing an error if these are
  called without the 'required' setter also being present (see
  Issue: #8957).

#minor-release

PiperOrigin-RevId: 376162385
2021-06-06 23:36:55 +01:00
ibaker
6ec0044cd5 Fix docs on MediaItem.Builder#setDrmUuid
The docs on setLicenseUri say it's optional, and it has been since
379cd8a04f
(which should have changed this javadoc too)

#minor-release

PiperOrigin-RevId: 376139158
2021-06-06 23:36:39 +01:00
claincly
f2e476bd71 Support basic and digest authentication.
Authentication sequence in RTSP:

- Server replies "Unauthorized" to our DESCRIBE request, and includes the
  necessary information (i.e. realm, digest nonce, etc) in WWW-Authenticate
  header

- After `RtspClient` receives the response, we

  - Parse the WWW-Authenticate header, stores the auth info. The info is saved
    for all further RTSP requests (that all need to carry authorization headers)
  - send the second DESCRIBE request with the Authorization header.

#minor-release

PiperOrigin-RevId: 376116302
2021-06-06 23:35:12 +01:00
olly
68eb7eb8df Fix StyledPlayerView detachment
Issue: #8985
#minor-release
PiperOrigin-RevId: 375913914
2021-06-06 23:35:02 +01:00
claincly
f49c14479e Rename RtspMessageChannel.openSocket() to open().
The method openSocket in RtspMessageChannel does not actually open a socket.
The 'open' term refers more to opening the message channel.

#minor-release

PiperOrigin-RevId: 375908999
2021-06-06 23:34:57 +01:00
claincly
b10f4363b9 Remove the default RTSP message handling off playback thread.
The callbacks received RTSP messages and RTSP sending errors are now invoked
directly from RtspMessageChannel's internal threads. It's up to the handler
implementation to decide which thread to handle the messages.

#minor-release

PiperOrigin-RevId: 375908282
2021-06-06 23:34:52 +01:00
claincly
3e50a5a950 Move RTP packet forwarding off playback thread.
Previously, RTSP interleaved binary data is posted onto the playback thread
for handling, the playback thread then adds the received data to a queue.
A loader thread will later dequeue the data and process it.

In this CL, the binary data is sent through a separate listener, on
RtspMessageChannel's RTSP receiving thread.

#minor-release

PiperOrigin-RevId: 375907609
2021-06-06 23:34:45 +01:00
claincly
088ad91017 Allow RtspHeaders to take multiple header values under the same name.
Some RTSP servers will offer multiple WWW-Authenticate options. We wanted to
be able to pick them up.

#minor-release

PiperOrigin-RevId: 375907276
2021-06-06 23:34:40 +01:00
ibaker
99d3773eb9 Throw from (pre)acquireSession if the DrmSessionManager isn't prepared
Currently acquireSession() fails with an NPE from
checkNotNull(exoMediaDrm). A follow-up change will result in exoMediaDrm
sometimes being non-null while prepareCount==0 (and in this case we
still want acquireSession() to fail).

preacquireSession() doesn't currently fail in a way the caller can
observe - the same NPE is thrown, but asynchronously and it doesn't
propagate out of the background thread. Throwing directly seems
preferable since it's a clear bug to be trying to preacquire sessions
from an unprepared/released manager.

PiperOrigin-RevId: 375906450
2021-06-06 23:34:32 +01:00
samrobinson
50cae4b944 Add year to MediaMetadata.
#minor-release

PiperOrigin-RevId: 375674759
2021-06-06 23:34:25 +01:00
Oliver Woodman
69394e6fb5 Merge pull request #8943 from dlafayet:embeddedstyle2
PiperOrigin-RevId: 375484765
2021-06-06 23:34:17 +01:00
ibaker
55f50e24eb Defensively copy potentially mutable text in Cue constructor
Without this the Cue isn't deeply immutable, which can be a bit
surprising.

PiperOrigin-RevId: 375477571
2021-06-06 23:33:59 +01:00
ibaker
b87a4c04e0 Don't restore DRM keys before releasing them
PiperOrigin-RevId: 375436117
2021-06-06 23:32:01 +01:00
samrobinson
81b8bb671c Add an extras bundle to MediaMetadata.
#minor-release

PiperOrigin-RevId: 375435339
2021-06-06 23:31:29 +01:00
samrobinson
ae400176b2 Add a mediaType field to MediaMetadata.
#minor-release

PiperOrigin-RevId: 375097412
2021-06-06 23:31:23 +01:00
krocard
7a6a9b0d48 Add to realease note DefaultDrmSessionEventListener's rename.
Its absence seems to have caused
https://github.com/google/ExoPlayer/issues/8969.

#minor-release

PiperOrigin-RevId: 375058222
2021-06-06 23:31:16 +01:00
olly
95ea818b66 Replace internal dependencies on monolithic module
PiperOrigin-RevId: 375054051
2021-06-06 23:31:09 +01:00
tonihei
6d6efed6d4 Fix issue where getFirstSampleIndex was called on spliced in chunks.
We need to avoid reading and skipping into preload chunks as they
may need to be discarded. The current code iterates over all chunks,
but this can be simplified by just checking the last chunk knowing
that the preload chunk must always be the last one.

As a result, we avoid calling getFirstSampleIndex on all chunks. This
is a bug since the method is not allowed to be called for chunks
that have been spliced in. This still leaves the smaller issue of
potentially calling this method for spliced-in preload chunks, which
will be solved separately.

Issue: #8937

PiperOrigin-RevId: 375053638
2021-06-06 23:30:59 +01:00
tonihei
10c19afa35 Don't allow spliced-in preload chunks.
Preload chunks may still need to be discarded. However, we don't
currently support discarding spliced-in chunks. Thus, we need to
avoid loadng a preload chunk that needs to be spliced-in.

Issue: #8937

#minor-release

PiperOrigin-RevId: 374851661
2021-06-06 23:30:03 +01:00