7516 Commits

Author SHA1 Message Date
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
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
claincly
5fc6b2ff9d Define the default RTSP character set.
#minor-release

PiperOrigin-RevId: 374433331
2021-06-06 23:29:53 +01:00
samrobinson
941a71ae28 Add track number & total to MediaMetadata
#minor-release

PiperOrigin-RevId: 374235979
2021-06-06 23:28:41 +01:00
samrobinson
6bba218e72 Add an artwork field to MediaMetadata
#minor-release

PiperOrigin-RevId: 373410795
2021-06-06 23:28:08 +01:00
olly
795594f862 Update avcLevelToMaxFrameSize for AVCLevel6, 61 and 62
PiperOrigin-RevId: 374161340
2021-06-06 23:23:33 +01:00
kim-vde
cfe2811091 Merge pull request #8860 from KeiMurayamaS:dev-v2-add-mpegh-parser
PiperOrigin-RevId: 373142159
2021-06-06 23:15:12 +01:00
olly
34428b699a Minor translation updates
#minor-release

PiperOrigin-RevId: 373543587
2021-05-13 11:08:06 +01:00
claincly
d608254ab0 Remove RTSP message logging.
#minor-release

PiperOrigin-RevId: 373336127
2021-05-12 13:02:54 +01:00
claincly
77008e16fe Allow RTSP streaming using TCP.
NAT will block off incoming UDP connection because the router has no knowledge
of the necessary port mapping (the mapping is never set up because UDP is
connectionless).

The end result is, the UDP socket to receive RTP data will timeout. After the
`SocketTimeoutException` is caught, the following takes place to try streaming
with TCP (or, RTP over RTSP).

- `RtspClient` sends TEARDOWN to tear down the current session.
- `RtspClient` re-connect to the RTSP server.
- `RtspMediaPeriod` cancels all loading `RtpDataLoadables` (that are using UDP)
- `RtspMediaPeriod` constructs new `RtpDataLoadables` that use
    `TransferRtpDataChannel`, and starts loading.
- Once the `RtpDataLoadables` are up and running, we are ready to receive.
  `RtspClient` sends the SETUP requests.

- The rest of the flow is unchanged.

#minor-release

PiperOrigin-RevId: 373310774
2021-05-12 13:02:48 +01:00
kim-vde
ef61fa5244 Merge pull request #8894 from cdongieux:fix/issue-8847
PiperOrigin-RevId: 373128118
2021-05-12 13:01:18 +01:00
claincly
0ea6c8998d Enable reading interleaved message in RtspMessageChannel.
RTSP interleaving enables RTP packets to be sent using RTSP's TCP connection.
The interleaving RTSP messages contain binary data only and always start with a
'$'. Normal RTSP messages contain line breaks (CRLFs) that indicate complete
lines.

#minor-release

PiperOrigin-RevId: 372990181
2021-05-10 23:50:18 +01:00
olly
923ba5138b Include RTSP module in gradle project
#minor-release

PiperOrigin-RevId: 372981022
2021-05-10 23:50:13 +01:00
tonihei
d55c68807e Remove reference to deprecated Player.EventListener.
PiperOrigin-RevId: 372925409
2021-05-10 23:49:46 +01:00
olly
eb195eff36 Fix Javadoc references to deprecated EventListener
#minor-release

PiperOrigin-RevId: 372919342
2021-05-10 23:49:20 +01:00
olly
2ff4e5a657 Clean up RtspMediaSource.Factory
- Don't deprecate methods not deprecated in the base class and that
  could one day be useful.
- Better document deprecation of other methods.

#minor-release

PiperOrigin-RevId: 372919080
2021-05-10 23:49:15 +01:00
olly
90fc24c900 Bump version to 2.14.0 and tidy release notes
PiperOrigin-RevId: 372910834
2021-05-10 23:49:01 +01:00
ibaker
207825fbec Swallow exceptions in TestContentProvider when writing to a pipe fails
The existing code results in flaky tests, where sometimes the write
fails (with "EPIPE (broken pipe)") and the exception propagates out
and causes the test to never complete and time out.

Swallowing the exception resolves this flakiness.

#minor-release

PiperOrigin-RevId: 372909415
2021-05-10 23:47:52 +01:00
kimvde
2145261dda Deprecate ExoPlayer.Builder.
Apps should migrate from ExoPlayerImpl to SimpleExoPlayer.

#minor-release

PiperOrigin-RevId: 372562923
2021-05-10 23:47:44 +01:00
samrobinson
e295a15d2d Add javadoc to the MediaMetadata setters.
#minor-release

PiperOrigin-RevId: 372549185
2021-05-10 23:47:37 +01:00
samrobinson
1c8f91c130 Rename MediaMetadata trackTitle and trackArtist to title and artist.
#minor-release

PiperOrigin-RevId: 372537414
2021-05-07 14:59:09 +01:00
samrobinson
07cd8d101d Add fields to MediaMetadata requested by MediaAPIs
#minor-release

PiperOrigin-RevId: 372448985
2021-05-07 11:00:53 +01:00
bachinger
31897af14b Avoid media item transitions for auto discontinuities when ads involved
#minor-release

PiperOrigin-RevId: 372433555
2021-05-07 11:00:23 +01:00
samrobinson
c97956ea29 Use getters in Rating subclasses rather than direct field access.
#minor-release

PiperOrigin-RevId: 372368685
2021-05-07 10:59:51 +01:00
gyumin
3be50b26a0 Revise javadoc for Rating classes
PiperOrigin-RevId: 371625281
2021-05-07 10:59:05 +01:00
jaewan
54440261b0 Move Rating class to library-common
Rating class should be in the same module as MediaMetadata.

Tested:
  $ ./gradlew --stacktrace :exo-library-common:tDUT
  $ ./gradlew --stacktrace :media2-session:tDUT
  $ ./gradlew --stacktrace :media2-session-vct-current:cAT
PiperOrigin-RevId: 370902917
2021-05-07 10:52:40 +01:00
tonihei
309fd20a11 Clarify timebase of media times in MediaLoadData.
Also fix unncessary adjustment done in ClippingMediaSource.

#minor-release

PiperOrigin-RevId: 372080724
2021-05-06 13:46:31 +01:00
olly
bfcf8736cd Use correct Log class
#minor-release

PiperOrigin-RevId: 372314890
2021-05-06 13:44:28 +01:00
tonihei
1a06f3c855 Add missing isPlaceholder forwarding in SinglePeriodAdTimeline
Also make future similar issues less likely by adding isPlaceholder
to the set method of Period (in case forwarding Timeline
implementations use this instead of just updating values selectively)

#minor-release

PiperOrigin-RevId: 372138523
2021-05-06 13:43:47 +01:00
krocard
002ee4de26 Deprecate EventListener in favor of Listener
#minor-release

PiperOrigin-RevId: 371348520
2021-05-04 11:25:52 +01:00
claincly
762d19b090 Flatten packages within the RTSP package.
#minor-release

PiperOrigin-RevId: 371337762
2021-05-04 11:25:11 +01:00
claincly
a64c6e80ed Introduce RtpDataChannel interface.
#minor-release

PiperOrigin-RevId: 371326814
2021-05-04 11:24:53 +01:00
claincly
3ddf73fdcf Allow retry opening RTP ports.
In RtpDataLoadable.load, the second UDP data source is opened on the port we
specify. If the port is already in use, a BindException is thrown.

#minor-release

PiperOrigin-RevId: 371319522
2021-05-04 11:24:33 +01:00