11299 Commits

Author SHA1 Message Date
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
Ian Baker
b2333c86c1
Merge pull request #9045 from google/dev-v2-r2.14.1
r2.14.1
2021-06-14 12:23:15 +01:00
olly
c1b7c47abf Update Javadoc for 2.14.1
#minor-release

PiperOrigin-RevId: 378844770
2021-06-11 12:30:31 +01:00
olly
8ab282bd61 Fix search links in generated Javadoc
#minor-release

PiperOrigin-RevId: 373351014
2021-06-10 18:32:27 +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
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