710 Commits

Author SHA1 Message Date
krocard
9fad5f4130 Add Track selection to the Player API
This cl doesn't implement completely the API for
`ExoPlayerImpl` as
`onTrackSelectionParametersChanged` is not called.

The follow up cl adds `TrackSelectionParameters` in PlaybackInfo
to correctly propagate the change event and mask it.

Additionally `TrackSelectionParameters` is serialized as a Parcelable
for now. It is transitioned to bundleable in a follow up cl.

PiperOrigin-RevId: 392899918
2021-08-26 10:58:27 +01:00
bachinger
0848188a43 Move TrackGroupTest and TrackGroupArrayTest to lib-common
PiperOrigin-RevId: 391837747
2021-08-20 11:50:51 +01:00
kimvde
1ae879788a Fix issue caused by using ForwardingPlayer and StyledPlayerControlView
StyledPlayerControlView was checking whether the player is an ExoPlayer
instance to set the track selector. This means that, if apps were
wrapping an ExoPlayer in a ForwardingPlayer (to replace a
ControlDispatcher for example), the track selector wasn't set anymore.

#minor-release

PiperOrigin-RevId: 391776305
2021-08-20 11:49:12 +01:00
apodob
cbd6527926 Set format.sampleMimeType to TEXT_EXOPLAYER_CUES in SubtitleExtractor.
Samples are serialized using our custom CueEncoder. Information in
which format samples are encoded is needed by Renderer to decide which
decoder to use. Extractor receives Format object in the constructor and
prepares new Format object with sampleMimeType moved to codecs field
and new sampleMimeType set to "custom serialized exoplayer Cue".

PiperOrigin-RevId: 391739866
2021-08-20 11:44:06 +01:00
olly
85142be9a4 DRM refactor / cleanup
PiperOrigin-RevId: 391403236
2021-08-19 10:42:56 +01:00
krocard
cd297b048a Make Track selection objects Bundleable
Most of those objects needs to be sent to MediaControler.

`TrackSelectior.Parameters` could have stayed Parcelable,
but it needs to be `Bundleable` as it inherit from
`TrackSelectionParameters` that is and needs to be
serializable anyway for the demo app.
As a result it has also been migrated to bundleable.

PiperOrigin-RevId: 391353293
2021-08-19 10:38:51 +01:00
olly
b689fbd44e Rename DecryptionException to CryptoException
PiperOrigin-RevId: 391272611
2021-08-17 15:49:54 +01:00
andrewlewis
ce4c8e405c Add some range annotations
PiperOrigin-RevId: 391253301
2021-08-17 15:48:10 +01:00
olly
38e5864f87 Remove Player.Listener inheritance of TextOutput
PiperOrigin-RevId: 390630998
2021-08-17 15:37:29 +01:00
olly
743b33e821 Remove Player.Listener inheritance of VideoListener
NO_EXTERNAL

PiperOrigin-RevId: 390614839
2021-08-17 15:35:44 +01:00
ibaker
a44878482c Add section comments to MimeTypes.java
PiperOrigin-RevId: 390602716
2021-08-17 15:33:58 +01:00
olly
a83fe511b5 Move DecryptionException into decoder package
PiperOrigin-RevId: 390582804
2021-08-17 15:30:20 +01:00
olly
88a637bc45 Move format util classes to extractor package
PiperOrigin-RevId: 390577072
2021-08-13 11:45:37 +01:00
jaewan
149958fb07 Change return type of getMaxSeekToPreviousPosition() to long
This matches the type of all position related APIs.

PiperOrigin-RevId: 390558523
2021-08-13 11:43:52 +01:00
christosts
288fb4a8a5 Annotate deprecated methods in ForwardingPlayer
This change is needed to generate correct javadoc, otherwise
these methods appear as not deprecated.

#minor-release

PiperOrigin-RevId: 390339092
2021-08-12 16:36:23 +01:00
olly
2a6136f370 Remove Player.Listener inheritance of AudioListener
PiperOrigin-RevId: 390332263
2021-08-12 16:34:42 +01:00
olly
f7a511af2d Remove Player.Listener inheritance of MetadataOutput
PiperOrigin-RevId: 390137267
2021-08-11 17:37:24 +01:00
olly
7dffb2dc4d Migrate to Player.Listener
PiperOrigin-RevId: 390124675
2021-08-11 17:32:55 +01:00
olly
31a839c848 Move non-player specific classes to common
These will all be needed in common to break dependencies
between decoder extension modules and the core module.

PiperOrigin-RevId: 389871983
2021-08-10 15:01:42 +01:00
christosts
b4e99304c4 Bump version to 2.15.0 and tidy release notes
#minor-release

PiperOrigin-RevId: 389871495
2021-08-10 15:00:24 +01:00
ibaker
ff078cb4b5 Add explicit protected constructor to Timeline.
Timeline is already abstract, so it can only be constructed from a
subclass anyway.

PiperOrigin-RevId: 389827960
2021-08-10 14:53:23 +01:00
olly
700ec93994 Move DeviceInfo into root package
PiperOrigin-RevId: 389681733
2021-08-09 20:11:23 +01:00
olly
e2ffb5e11b Remove DeviceListener
PiperOrigin-RevId: 389640670
2021-08-09 20:06:05 +01:00
ibaker
db1fe8041b Remove @DoNotInstrument from test classes
This isn't needed now we've updated to Robolectric 4.6

Follow-up to 0df0df9aee

PiperOrigin-RevId: 389616471
2021-08-09 20:02:05 +01:00
olly
0097a79c2d Add ability to disable Surface.setFrameRate calls
Adding a CHANGE_FRAME_RATE_STRATEGY_ALWAYS strategy is
omitted from this commit, since adding it is more complicated
than just plumbing it through and leaving everything else
unchanged. Specifically, VideoFrameReleaseTimeHelper would
need updating to behave differently when such a strategy is
enabled. It currently calls setFrameRate in cases such as
pausing, seeking and re-buffering, on the assumption that
changes to the underlying display refresh rate will only be
made if they can be done seamlessly. For a mode in which
this will not be the case, it makes more sense to stick to
the content frame-rate when these events occur. It may also
make sense to only use explicit content frame-rate values,
and not those inferred from individual frame timestamps.
Finally, for adaptive content containing a mix of frame-rates,
it makes sense to use the maximal frame-rate across all
variants, and to avoid calling setFrameRate on switches from
one variant to another.

Applications that know the frame-rate of their content can
set ExoPlayer's strategy to CHANGE_FRAME_RATE_STRATEGY_OFF and
then use setFrameRate directly on the output surface. Note that
this is likely to be a better option for apps than anything we
could implement in ExoPlayer, because the application layer
most likely knows the frame-rate of the content earlier than
ExoPlayer does (e.g., to perform the disruptive mode switch
at the same time as an activity transition).

Adding CHANGE_FRAME_RATE_STRATEGY_ALWAYS will be deferred
until there's clear demand for it. In the meantime, we'll
recommend the alternative approach above.

PiperOrigin-RevId: 389610965
2021-08-09 19:59:16 +01:00
christosts
d698e96a57 Fix bug in Timeline.getRemovedAdGroupCount()
#minor-release

PiperOrigin-RevId: 389174519
2021-08-06 16:02:43 +01:00
apodob
a5e772f91f Move SubtitleDecoder to common
This CL moves SubtitleDecoder and all its dependencies
to common in order to enable using it in extractor
module while implementing SubtitleExtractor.

PiperOrigin-RevId: 388979021
2021-08-06 16:00:03 +01:00
apodob
281fc84d15 Add CueDecoder and CueEncoder.
This CL introduces two classes:
* CueEncoder - encodes list of Cue object into byte array.
* CueDecoder - decodes byte array into list of Cue objects.

This two classes are necessary in order to push Cues through SampleQueue. This classes are meant to be used by subtitle Extractor.

PiperOrigin-RevId: 388932088
2021-08-06 15:58:45 +01:00
olly
8525ef70ba Remove SDK_INT codename checks for R and S
These API levels have both been finalized. We're also calling methods
from these API levels directly, which may not exist if a device is
running a non-finalized R or S release.

PiperOrigin-RevId: 388903410
2021-08-06 15:53:08 +01:00
olly
9dcfd90ef7 Cleanup some deprecated constants
PiperOrigin-RevId: 388893920
2021-08-05 12:33:28 +01:00
sungsoo
a533d8190a Add a method to distinguish whether a player can be set by MediaSession
PiperOrigin-RevId: 388835913
2021-08-05 12:28:34 +01:00
aquilescanta
7375fe3105 Simplify network-related error codes
This change removes ERROR_CODE_IO_NETWORK_UNAVAILABLE,
ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED, and ERROR_CODE_IO_DNS_FAILED
in favor of keeping only ERROR_CODE_IO_NETWORK_CONNECTION_FAILED.

PiperOrigin-RevId: 388715972
2021-08-04 18:47:32 +01:00
christosts
07c49cdad8 Change how AnalyticsCollector releases listeners
The AnalyticsCollector releases listeners lazily so that listener
callbacks triggered on the application looper after
SimpleExoPlayer.release() are still handled. The change in ListenerSet
to post the onEvents callback on the front of the application looper
changed (correctly) how onEvents are propagated, however this made
the AnalyticsCollector deliver onEvents with out-of-order EventTimes.

This change fixes AnalyticsCollector to trigger onPlayerReleased() and
the matching onEvents() event in the correct order.

#minor-release

PiperOrigin-RevId: 388668739
2021-08-04 18:37:16 +01:00
olly
4013612194 HLS: Avoid stuck-buffering issues
Issue: #8850
Issue: #9153
#minor-release
PiperOrigin-RevId: 388257563
2021-08-02 19:20:57 +01:00
olly
f726212180 Simplify TimestampAdjuster logic
- Use timestampOffsetUs == C.TIME_UNSET directly as the way of
  determining whether the adjuster has determined the offset,
  rather than relying on lastSampleTimestampUs checks for this.
- Remove comment referring to lastSampleTimestampUs as holding
  the "adjusted PTS". Its value may not have originated from a PTS
  timestamp. It's also confusing to refer to it as "adjusted"
  given timestampOffsetUs has not been applied to it.
- Fix PassthroughSectionPayloadReader to make sure it'll never
  output a sample with an unset timestamp.

#minor-release

PiperOrigin-RevId: 388226180
2021-08-02 19:19:28 +01:00
olly
181838168c Fix resetting TimestampAdjuster with DO_NOT_OFFSET
Prior to this change, an initalized TimestampAdjuster that's then
reset with DO_NOT_OFFSET would incorrectly continue to apply the
offset.

Also add a test case for this issue, and for some other simple use
cases.

#minor-release

PiperOrigin-RevId: 388182645
2021-08-02 19:16:15 +01:00
claincly
0bf40f8978 Fix some ErrorCode assigning cases.
DefaultHttpDataSource and OkHttpDataSource can share the same error code
assigning logic.

Fixes CronetDataSource's handling of closed connection.

PiperOrigin-RevId: 387791679
2021-08-02 10:59:30 +01:00
claincly
df49f90b7f Simplify the error code handling.
PiperOrigin-RevId: 387786273
2021-08-02 10:58:11 +01:00
aquilescanta
e65bcefad1 Reorder DataSourceException constructors and accept nullable parameters
This CL doesn't introduce functional changes.

PiperOrigin-RevId: 387613057
2021-07-29 21:12:30 +01:00
andrewlewis
337d5aa9b6 Fix parameter names on overridden methods
The dokka javadoc generation tool complains when parameter names don't match between a method and its override. This change updates occurrences where there is currently a mismatch.

PiperOrigin-RevId: 387367509
2021-07-29 21:09:30 +01:00
andrewlewis
9c27cfcda7 Fix parameter names on overridden methods
The dokka javadoc generation tool complains when parameter names don't match between a method and its override. This change updates occurrences where there is currently a mismatch.

Notable renamings that might be controversial:
- `onPlaybackStateChanged(int state)` to `onPlaybackStateChanged(int playbackState)` affected a lot of lines but seems more consistent with other '-Changed' methods.
- `handleMessage(int messageType, Object payload)` to `handleMessage(int messageType, Object message)`
- `ExtractorInput` and `DataSource` inherit `DataReader` which had `read(byte[] target, ...`, while data sources normally called the first parameter `buffer`. I have standardized these all to use `buffer` even though it looks out of place in the `ExtractorInput` interface (which has more `read` methods with `target`).

PiperOrigin-RevId: 387290360
2021-07-28 09:15:29 +01:00
ibaker
41fe5aa1e3 Throw IllegalStateException from Util.gzip() instead of AssertionError
The documentation on ByteArrayOutputStream and GZIPOutputStream isn't
completely clear that an IOException will *never* happen, so
AssertionError seems a bit strong - but it seems very unlikely, so we
just use IllegalStateException instead.

#minor-release

PiperOrigin-RevId: 387169297
2021-07-28 09:14:09 +01:00
aquilescanta
1aa76b5fdc Rename error code IO_BAD_HTTP_REQUEST to IO_INVALID_HTTP_CONTENT_TYPE
In order to avoid confusion with HTTP 400 Bad request.

PiperOrigin-RevId: 387145057
2021-07-27 18:57:50 +01:00
aquilescanta
0df62a4f20 Add ERROR_CODE_FAILED_RUNTIME_CHECK for failed checks
PiperOrigin-RevId: 387143625
2021-07-27 18:56:25 +01:00
bachinger
7941b8726f Merge pull request #9219 from DolbyLaboratories:dev-v2-eac3-codec-comment
PiperOrigin-RevId: 387090075
2021-07-27 18:53:18 +01:00
aquilescanta
d4975415f9 Remove calls to initCause
In favor of setting the cause in the constructor, which allows
some code simplifications.

PiperOrigin-RevId: 387062636
2021-07-27 12:30:19 +01:00
claincly
cdf26a01cf Remove error code inference in DataSourceException.
The inference is used when nesting DataSourceExceptions. It is removed because
nesting does not add additional value in surfacing the exceptions, and it is
better to assign an error code at the throw site (in the "leaf" or the bottom
most data source).

PiperOrigin-RevId: 386919118
2021-07-27 12:26:07 +01:00
kim-vde
8e29e76b51 Merge pull request #9163 from ProtoScott:feature/dtsx_codec_updates
PiperOrigin-RevId: 386428758
2021-07-23 14:12:29 +01:00
kimvde
72cf9c3815 Deprecate ControlDispatcher and DefaultControlDispatcher
PiperOrigin-RevId: 386401066
2021-07-23 14:11:00 +01:00
ybai001
5c95a59060 Update E-AC3-JOC Codec String Name and Comment 2021-07-23 12:00:22 +08:00