248 Commits

Author SHA1 Message Date
olly
49699d398d Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:45:48 +01:00
olly
7dd4c736c3 Fix extension renderer test names
PiperOrigin-RevId: 330409635
2020-09-09 09:45:27 +01:00
ibaker
f0ae8afd80 Separate the dump files from the test assets
This allows us to more easily create different dumps derived from the
same assets.

This moves media/source files from `assets/` to `assets/media/` and
dump files from `assets/` to `assets/extractordumps/` and
`assets/audiosinkdumps/` as appropriate. I intend to add
`assets/playbackdumps/` in a future CL.

PiperOrigin-RevId: 326986283
2020-08-17 16:13:53 +01:00
ibaker
da4d55635c Create a DumpFileAsserts from the dumpfile logic in FakeExtractorOutput
Also use it to replace the same logic in CapturingAudioSink

PiperOrigin-RevId: 325969455
2020-08-17 16:08:24 +01:00
olly
4d03d30890 Audio extension decoders: Pass decoder to getOutputFormat
It seems generally useful to have access to the decoder in
getOutputFormat. We're currently working around lack of access
by using member variables in the concrete audio extension
renderers. In the case of the Ffmpeg extension, holding a
reference to the decoder is preventing it from being garbage
collected when the decoder is released by the base class.

PiperOrigin-RevId: 324799670
2020-08-07 19:00:18 +01:00
aquilescanta
684994fe61 Remove Renderer references to Format.drmInitData
PiperOrigin-RevId: 323392470
2020-07-28 00:00:27 +01:00
ibaker
fda3b3d8ec Use static imports for methods that make sense without their class name
PiperOrigin-RevId: 323349585
2020-07-27 23:59:52 +01:00
ibaker
ce2e6e2fd6 Hide ParsableByteArray#data behind a getter
This allows us to enforce the limit because the array can only be
reassigned through reset(byte[]) or reset(byte[], int) (which update
the limit)

PiperOrigin-RevId: 323339960
2020-07-27 23:59:34 +01:00
olly
6d92eebe51 Revert Format back to only containing audio encoding for PCM
PiperOrigin-RevId: 322683545
2020-07-24 10:46:37 +01:00
olly
363a2a3b45 DefaultRenderersFactory: Add setting to enable float output
This also renders https://github.com/google/ExoPlayer/pull/7625 redundant.

PiperOrigin-RevId: 321544195
2020-07-24 10:37:05 +01:00
ibaker
e9a8335381 Migrate callers to pass MediaItem to createMediaSource()
createMediaSource(Uri) is deprecated.

PiperOrigin-RevId: 321121383
2020-07-24 10:31:22 +01:00
olly
e8596428c0 Pass correct formats to AudioSink
The renderers are currently constructing formats that consist of their
input format with added PCM encoding. Such formats are not self-consistent,
and this only works because DefaultAudioSink ignores the rest of the
format if the format has a PCM encoding. It would not work if the sink
implementation checked the MIME type, for example, which wouldn't be a
strange or incorrect thing for it to do.

The more correct approach is to construct a new format that properly
represents the PCM that will be provided to the sink.

This change also renames supportsOutput to supportsFormat, because
AudioSink itself has both an input and an output side, and this method
is actually evaluating support on the input side of the sink.

PiperOrigin-RevId: 320396089
2020-07-10 09:09:02 +01:00
krocard
78825a41dc Store encodings in Format instead of just pcm encodings
Previously only pcm encoding were stored in Format,
this was an issue as for audio passthrough and offload
lots of code needs to pass complex format informations
(encoding, sample rate, channel count, gapless metadata)
but could not use Format and each function was taking
each as different parameter.

By allowing Format to contain any encoding, and not only
pcmEncoding, it allows to pass a Format everywhere in ExoPlayer
code that needs a Format.

This patch does not have any functional change. It is only an internal refactor.

PiperOrigin-RevId: 318789444
2020-06-29 13:33:09 +01:00
krocard
1c018e71d4 Propagate format in supportsOutput
*** Reason for rollforward ***

Fixed dependent cl was rolled forward

*** Original change description ***

Rollback of 2aac0717d7

*** Original commit ***

Propagate format in supportsOutput

It is needed to know if gapless is needed,
as gapless offload might not be supported.

***

***

PiperOrigin-RevId: 318429321
2020-06-26 11:23:19 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
olly
f8843441a2 Align flags between the core and extension FLAC extractors
- It seems conceptually simpler for DefaultExtractorsFactory
- It seems unlikely we'll need to diverge the two. In the case of
  workaround flags we can just have them be no-ops in the version
  that doesn't need them.

PiperOrigin-RevId: 317151955
2020-06-23 11:05:37 +01:00
andrewlewis
fc0e0d4cb8 Rollback of 2aac0717d7
*** Original commit ***

Propagate format in supportsOutput

It is needed to know if gapless is needed,
as gapless offload might not be supported.

***

PiperOrigin-RevId: 315947888
2020-06-12 00:26:26 +01:00
krocard
2aac0717d7 Propagate format in supportsOutput
It is needed to know if gapless is needed,
as gapless offload might not be supported.

PiperOrigin-RevId: 315877127
2020-06-12 00:25:33 +01:00
krocard
efff7a9d22 Propagate sample rate and format deeper
#exo-offload

PiperOrigin-RevId: 310150780
2020-05-06 20:57:44 +01:00
ibaker
9dac400734 Rename ExtractorAsserts "test everything" methods
This makes the distinction more clear between the methods that test
a specific behaviour (and are meant to be used with parameterized
tests) and those that test everything in one go.

Also add a TODO to FlacExtractorTest to migrate it when we can

PiperOrigin-RevId: 308228421
2020-04-27 10:41:49 +01:00
ibaker
0e6b318138 Remove ExtractorAsserts overloads that take a Context
Also mark the two assertOutput methods private, to make the API surface
smaller.

PiperOrigin-RevId: 308228186
2020-04-27 10:41:49 +01:00
olly
2209947acb Add decoder instantiation tracing
This is just for consistency with our other renderers

PiperOrigin-RevId: 303317443
2020-03-27 23:32:37 +00:00
olly
dc33c0bdfb Improve logging II
- Show renderers with no tracks in EventLogger track logging
- Log renderer names in EventLogger track logging
- Add useful message to ExoPlaybackException instances (including
  renderer name for renderer errors)

PiperOrigin-RevId: 302421616
2020-03-25 13:03:12 +00:00
olly
ee6afe5eb9 Merge AudioDecoderException and VideoDecoderException
This is a necessary step for Decoder implementations to support
audio and video. MediaCodecRenderer.DecoderException is renamed
MediaCodecDecoderException and extends the new DecoderException

Issue: #2159
PiperOrigin-RevId: 301698238
2020-03-19 00:50:39 +00:00
olly
cbe99ec475 Make SimpleDecoderXRenderers work with any Decoder implementation
The restriction that these classes only work with SimpleDecoders
is unnecessary. An FfmpegVideoRenderer will not be able to use a
SimpleDecoder, because the SimpleDecoder assumption that each input
buffer can be decoded immediately into a corresponding output is
not true for all video codecs that Ffmpeg supports (e.g., H264 does
not have this property). Generalizing SimpleDecoderVideoRenderer to
DecoderVideoRenderer will allow FfmpegVideoRenderer to still use
the base class, without having to use a SimpleDecoder.

This is a preliminary change toward being able to merge a version
of https://github.com/google/ExoPlayer/pull/7079.

Issue: #2159
PiperOrigin-RevId: 301412344
2020-03-19 00:49:58 +00:00
olly
2f91c12f56 Drop prefix test- from test methods under v2/extensions
This is one step toward following the google3's test naming convention.
See go/java-testing/getting_started#basic-test-template for details
why prefix test isn't necessary.

This CL is generated by following command
$ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/  public void \L\1\E\2/' {}

PiperOrigin-RevId: 300530329
2020-03-19 00:46:24 +00:00
aquilescanta
47b62e8c02 DataReader: replace InterruptedException with InterruptedIOException
PiperOrigin-RevId: 299092243
2020-03-10 10:19:45 +00:00
tonihei
b5976a55ff Upgrade Kotlin annotations and fix gradle warnings
The new version fixes some warnings in Gradle builds. Also
add missing indirect compileOnly dependencies to fix some more warnings

Issue:issue:#7007
PiperOrigin-RevId: 298855510
2020-03-10 10:19:19 +00:00
olly
67b29bbe39 Format.Builder: Finish migration
Issue: #5978
PiperOrigin-RevId: 297876336
2020-02-28 18:43:04 +00:00
olly
3730639c95 Don't set decoded bitrate on audio/flac format
PiperOrigin-RevId: 297864386
2020-02-28 18:42:39 +00:00
olly
c6a6e0d6f3 Migrate various call sites to Format.Builder
PiperOrigin-RevId: 297562889
2020-02-27 17:15:34 +00:00
kimvde
52825a272d Rename FLAC dump files based on output instead of language
PiperOrigin-RevId: 297336461
2020-02-27 17:15:11 +00:00
aquilescanta
5c3c803460 Remove DRM management from Renderers
PiperOrigin-RevId: 295569075
2020-02-17 17:40:30 +00:00
kimvde
f5025bfce4 Share seek tests between FLAC extractors
PiperOrigin-RevId: 294893303
2020-02-13 15:46:05 +00:00
kimvde
bdfd24290f Share FLAC extractor tests between both extractors
PiperOrigin-RevId: 294614958
2020-02-13 15:44:29 +00:00
olly
1cbe3f72e6 DataSpec: Deprecate most constructors
Keeping (Uri) and (Uri, position, length) to avoid needing
Builder for the trivial case.

PiperOrigin-RevId: 294530226
2020-02-13 15:43:54 +00:00
kimvde
79a3bad4c3 Move assets from FLAC extension to testdata
PiperOrigin-RevId: 293553412
2020-02-11 17:09:08 +00:00
kimvde
a9507a0064 Make FakeExtractorOutput dump additional seek points
PiperOrigin-RevId: 293337032
2020-02-11 17:08:00 +00:00
kimvde
792d9b39e0 Flac extension: disable BinarySearchSeeker if totalSamples is unknown
The ceilingTimePosition is based on the total number of samples. Binary
search seeking is not possible if this value is unknown.

PiperOrigin-RevId: 292921177
2020-02-11 17:07:26 +00:00
bachinger
4bb6036cf6 add playback state changed listener
This change deprecates Player.onPlayerStateChanged(boolean pwr, int state). It removes deprecation for trivial cases. I'll remove other deprecated usages (mostly in ui module) in follow-up CLs to not bloat this CL.

PiperOrigin-RevId: 292917872
2020-02-11 17:07:03 +00:00
kimvde
1a0afacfe1 FLAC extension: remove sample rate check
This check is not needed because the FLAC specification does not
restrict the sample rate value and because the extension reads files
with other sample rates properly.

PiperOrigin-RevId: 292909391
2020-02-11 17:06:32 +00:00
andrewlewis
7b63afb212 Move FlacSteamMetadata to extractor package
It could either live in .util or .extractor, but since it's not needed
outside the extractor package in core (and the FLAC extension), and
FlacStreamMetadataTest uses a FLAC asset, it seems preferable to move it
into the extractor package.

PiperOrigin-RevId: 291372032
2020-01-24 18:15:11 +00:00
olly
a225e887fa Move @MonotonicNonNull annotations to their correct positions
PiperOrigin-RevId: 289823804
2020-01-16 13:51:09 +00:00
olly
ccce9948a9 Align media2 extension tests with other tests
PiperOrigin-RevId: 289494365
2020-01-16 13:50:36 +00:00
olly
d24188f663 Add tests to validate FLAC decoder output
PiperOrigin-RevId: 289091494
2020-01-10 15:57:23 +00:00
olly
1a9b301f52 Fix extension FLAC decoder to correctly handle non-16-bit depths
PiperOrigin-RevId: 288860159
2020-01-10 15:55:49 +00:00
kimvde
ee091e6a45 Use FlacLibrary.isAvailable in FlacExtractor selection
PiperOrigin-RevId: 288667790
2020-01-08 15:58:12 +00:00
kimvde
35fbb7f7ca Add comment explaining FlacBinarySearchSeeker output
PiperOrigin-RevId: 288464154
2020-01-08 15:57:14 +00:00
andrewlewis
a0044257b4 Add troubleshooting instructions for decoding extensions
PiperOrigin-RevId: 286585978
2019-12-20 16:59:07 +00:00
olly
8bafd6ff7d Fix FLAC seeking when the last seek point is a placeholder
PiperOrigin-RevId: 285449865
2019-12-18 18:49:48 +00:00