7701 Commits

Author SHA1 Message Date
andrewlewis
7d05f20493 Signal container MIME type for JPEGs
Before this change the `Format` on the image track output by the
`JpegExtractor` doesn't have a MIME type.

PiperOrigin-RevId: 381015819
2021-06-30 13:19:00 +01:00
aquilescanta
1a8592c5c0 Add Player.Listener.onPlayerErrorChanged
Equivalent to onPlayerError, except it's also called for null.

PiperOrigin-RevId: 381015336
2021-06-30 13:17:49 +01:00
claincly
620ab67fee 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-06-30 13:16:44 +01:00
aquilescanta
d87fdaa370 Fix the single-sample SampleStream regarding FLAG_REQUIRE_FORMAT
The current FLAG_REQUIRE_FORMAT documentation states: If an end of
stream buffer would be read were the flag not set, then behavior is
unchanged.

PiperOrigin-RevId: 380792251
2021-06-30 13:14:12 +01:00
aquilescanta
ddd6a22561 Fix EventSampleStream's implementation regarding FLAG_REQUIRE_FORMAT
The current FLAG_REQUIRE_FORMAT documentation states: If an end of
stream buffer would be read were the flag not set, then behavior is
unchanged.

PiperOrigin-RevId: 380781976
2021-06-30 13:12:44 +01:00
bachinger
b48b618bce Parse multiple BaseURL elements
After this change, multiple BaseURL elements are parsed, but the player still only uses the first BaseURL element appearing in the manifest and its corresponding availabilityTimeOffsetUs.

PiperOrigin-RevId: 380775256
2021-06-30 13:11:25 +01:00
olly
9df2e42d4d Fix expansion of items within StyledPlayerView popup
Issue: #9086
#minor-release
PiperOrigin-RevId: 380756562
2021-06-22 10:17:28 +01:00
olly
c7b3fa367b 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-06-21 23:53:59 +01:00
olly
b1dda6a02a 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
#minor-release
PiperOrigin-RevId: 380678388
2021-06-21 23:52:43 +01:00
olly
3d3ac623a6 Specify a root when inflating child views
#minor-release

PiperOrigin-RevId: 380655806
2021-06-21 22:31:52 +01:00
olly
6f686be751 Workaround for focus issues on API levels less than 26
Issue: #9061
PiperOrigin-RevId: 380640601
2021-06-21 22:30:38 +01:00
aquilescanta
81c542b6a7 Remove deprecated ParserException constructor
And replace it with factory method which includes more
context for error code assignment.

PiperOrigin-RevId: 380624625
2021-06-21 22:29:27 +01:00
bachinger
f609fecf9b Parse BaseURL element including DVB attributes in DASH manifest
This change parses the entire BaseURL element including DVB extension attributes, stores it in an instance of new BaseUrl class and puts it in a list of base URLs of the resulting Representation. The base url handling itself is still the same, which means that only the first base url is taken into account, just as before this change.

PiperOrigin-RevId: 380609495
2021-06-21 22:28:17 +01:00
claincly
46bc49a4f6 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-06-21 22:25:36 +01:00
ibaker
f8320287ef Simplify FileDataSourceContractTest
#minor-release

PiperOrigin-RevId: 380531272
2021-06-21 22:21:56 +01:00
claincly
b05e8f5090 Add RTP streaming test to playback test.
The test prepare_withSupportedTrack_playsTrackUntilEnded

- sets up the supported AAC track with the RTSP server;
- uses RtpPacketTransmitter to send RTP packets from the server to the client;
- runs the player until the playback has ended, and
- asserts on the data RTSP has received and queued to the SampleQueue.

In the test, it was necessary to create a FakeUdpDataSourceRtpDataChannel. The
reason we cannot reuse TransferRtpDataChannel is, we rely on BlockingQueue.poll
timeout to identify the end of an RTSP stream, but the time out mechanism is
unstable in Robolectric. For example, when the timeout is set to 8,000 ms, the
actual timeout occasionally happens after 2,000,000 ms (in FakeClock).

PiperOrigin-RevId: 380528710
2021-06-21 22:20:47 +01:00
ibaker
607fa8bf74 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-06-21 22:18:57 +01:00
samrobinson
775507088c Add a playlist title field to MediaMetadata.
Allows for compatibility with METADATA_KEY_COMPILATION.

PiperOrigin-RevId: 380179505
2021-06-21 22:17:25 +01:00
claincly
b8c315f448 Clean up irrelevant TODO items.
PiperOrigin-RevId: 380176846
2021-06-21 22:16:13 +01:00
aquilescanta
fc1d3dd192 Make onPlayerError take a PlaybackException
PiperOrigin-RevId: 380174672
2021-06-21 22:15:01 +01:00
aquilescanta
1ef6326385 Move documentation about the fields to the fields' javadocs
Also avoid mentioning that those fields cannot be null, since they are primitives.

PiperOrigin-RevId: 380169988
2021-06-21 22:13:51 +01:00
ibaker
043c2e7e33 Move CacheDataSourceContractTest to c.g.a.exoplayer2.upstream.cache
This is the package that CacheDataSource and CacheDataSourceTest(2) are
in.

PiperOrigin-RevId: 380156879
2021-06-21 22:12:21 +01:00
claincly
46645a9d47 Add basic playback test.
In prepare_withSupportedTrack_sendsPlayRequest(), the DESCRIBE includes two
tracks, one AAC and one MP4A-LATM. The test is run until a PLAY is sent, and
asserts on only one SETUP is sent (for AAC).

In prepare_noSupportedTrack_throwsPreparationError(), the DESCRIBE includes one
track: one MP4A-LATM. This format is not supported at the moment, so the player
will throw out an error, on which we assert.
PiperOrigin-RevId: 380131458
2021-06-21 22:10:04 +01:00
samrobinson
9c12d08531 Do not check the validity of dates in MediaMetadata.
PiperOrigin-RevId: 380009757
2021-06-21 22:08:51 +01:00
samrobinson
259f0f67a3 Add genre to MediaMetadata.
PiperOrigin-RevId: 380000589
2021-06-21 22:07:39 +01:00
samrobinson
d1aacc5f3b Add release date and recording date fields to MediaMetadata.
PiperOrigin-RevId: 379962022
2021-06-21 22:06:29 +01:00
christosts
d4ca29d748 Set master playlist's channelCount only on audio renditions
PiperOrigin-RevId: 379935363
2021-06-21 22:04:04 +01:00
christosts
b5a464cbcc Forward FRAME-RATE from the master playlist to renditions
Issue: #8960

#minor-release

PiperOrigin-RevId: 379922704
2021-06-21 22:02:51 +01:00
ibaker
0f23fddeef Add a test for the provisioning flow to DefaultDrmSessionManagerTest
#minor-release

PiperOrigin-RevId: 379913814
2021-06-21 22:01:38 +01:00
kimvde
56e97783eb Simplify DefaultControlDispatcher by using Player methods
PiperOrigin-RevId: 379732136
2021-06-21 21:59:14 +01:00
olly
63f12f0216 Remove obsolete Checker Framework suppression strings
More information: go/checker-3130-lsc

Tested:
    TAP for global presubmit queue passed after automated deflaking of failures: http://mondo/deflaker/run/ff80a4f9-d5d7-47ac-9560-63372e1ff624 http://mondo/deflaker/run/ca3ce61f-2af8-4fa7-b6e4-c98b5c4d950c
    http://test/OCL:379405669:BASE:379421861:1623763190392:bd2d256a
PiperOrigin-RevId: 379623080
2021-06-21 21:57:56 +01:00
olly
a3dbd61239 Remove obsolete Checker Framework suppression strings
More information: go/checker-3130-lsc

Tested:
    Some test failures are present, but the CL author has decided to mail the change anyway
PiperOrigin-RevId: 379622938
2021-06-21 21:56:37 +01:00
olly
2536222fbd HLS: Fix issue where new init segment would not be loaded
Issue: #9004
#minor-release
PiperOrigin-RevId: 379516815
2021-06-15 18:48:21 +01:00
olly
4e8895d5cb 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
#minor-release
PiperOrigin-RevId: 379506261
2021-06-15 18:45:21 +01:00
ibaker
391ad7dbb9 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-06-15 18:43:46 +01:00
kimvde
912acacbe1 Add onFastForward/RewindIncrementChanged to Player
PiperOrigin-RevId: 379497408
2021-06-15 18:42:19 +01:00
samrobinson
7d81f20f92 Add disc fields to MediaMetadata.
PiperOrigin-RevId: 379469182
2021-06-15 18:40:46 +01:00
Oliver Woodman
f90d0a26a4 Merge pull request #9023 from DolbyLaboratories:dev-v2-multicodecs
PiperOrigin-RevId: 379440699
2021-06-15 18:39:14 +01:00
olly
0b97f08955 Suppress warnings in preparation for Checker Framework 3.13.0 upgrade.
LSC: go/checker-lsc

Tested:
    TAP train for global presubmit queue
    http://test/OCL:379220771:BASE:379219228:1623675799153:ea986c7c
PiperOrigin-RevId: 379284240
2021-06-15 18:34:39 +01:00
claincly
8cc1328d89 Allow customizing the RtspServer using RtspServerResponseProvider.
PiperOrigin-RevId: 379282201
2021-06-15 18:31:58 +01:00
jinpark
581e543d39 Add toBundle(boolean excludeMediaItems) to Timeline.
Add MediaItem.EMPTY.

PiperOrigin-RevId: 379273172
2021-06-15 18:30:32 +01:00
gyumin
8777146e33 Fix forwarding onPlaybackSuppressionReasonChanged
PiperOrigin-RevId: 379264658
2021-06-15 18:29:09 +01:00
aquilescanta
5f1921f531 Make Player.getPlayerError return a PlaybackException
PiperOrigin-RevId: 378899373
2021-06-15 18:27:48 +01:00
Oliver Woodman
5f77bf0469 Merge pull request #6500 from DolbyLaboratories:dev-v2-isDirectPlaybackSupported
PiperOrigin-RevId: 378895355
2021-06-15 18:26:27 +01:00
samrobinson
19629513af Populate MediaMetadata artwork from PictureFrame.
PiperOrigin-RevId: 378889901
2021-06-15 18:25:17 +01:00
kimvde
aeeef65430 Add onAvailableCommandsChanged to AnalyticsListener
PiperOrigin-RevId: 378886637
2021-06-15 18:24:06 +01:00
aquilescanta
c62e444c13 Make PlaybackException be able to de-serialize subclasses
Otherwise, Player clients would not be able to benefit from
PlaybackException subclasses, like ExoPlaybackException.

PiperOrigin-RevId: 378873767
2021-06-15 18:22:51 +01:00
samrobinson
b511ed3b37 Add more MediaMetadata fields.
Added composer, conductor and writer.

PiperOrigin-RevId: 378844760
2021-06-11 12:26:37 +01:00
samrobinson
22f05e549a Populate MediaMetadata from VorbisComment.
PiperOrigin-RevId: 378844617
2021-06-11 12:25:39 +01:00
kimvde
53d67daaef Add available commands to fast forward and rewind
PiperOrigin-RevId: 378842286
2021-06-11 12:24:37 +01:00