110 Commits

Author SHA1 Message Date
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
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
olly
0d22d02df5 FFmpeg extension: Correctly pad input buffers
FFmpeg requires input buffers to be sized larger than the size
of the data they contain. This is to allow optimized decoder
implementations that read data in fixed size chunks, without
the risk of such decoders reading beyond the end of the buffer.

Issue: #2159
PiperOrigin-RevId: 310946866
2020-05-14 22:20:55 +01:00
olly
8ae8bf7b21 Split fetching FFmpeg from build_ffmpeg.sh
It makes it harder to work with a different branch. Also make
the FFmpeg instructions consistent with those of the other
extensions (e.g., by removing the "jni" part of the path from
the FFMPEG_EXT_PATH variable.

PiperOrigin-RevId: 310937751
2020-05-14 22:20:36 +01:00
krocard
efff7a9d22 Propagate sample rate and format deeper
#exo-offload

PiperOrigin-RevId: 310150780
2020-05-06 20:57:44 +01:00
olly
ee14fe7adf Align Decoder(Audio|Video)Renderer decoder re-use logic
- Fix DecoderAudioRenderer to re-init codec if the DRM session changes.
- Add canKeepCodec to DecoderVideoRenderer. Previously it was assumed
  that the decoder could be re-used, but this will not be true in all
  cases for FfmpegVideoRenderer.

Issue: #7079
PiperOrigin-RevId: 309935278
2020-05-05 18:38:50 +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
25e0d30760 Consistency fixes for FFmpeg extension instructions
PiperOrigin-RevId: 303316976
2020-03-27 23:32:29 +00:00
olly
9be4c08459 FFmpeg extension cleanup
PiperOrigin-RevId: 303298804
2020-03-27 23:32:11 +00:00
olly
b314da5f02 Rename FfmpegDecoder to FfmpegAudioDecoder
It looks like the video path will use a separate FfmpegVideoDecoder

Issue: #2159
PiperOrigin-RevId: 303068617
2020-03-27 23:31:03 +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
818925d4a7 Add shell for FfmpegVideoRenderer
Issue: #2159
PiperOrigin-RevId: 301705371
2020-03-19 00:50:55 +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
b7a5ace4be Make FfmpegLibrary H264/HEVC aware
Issue: #2159
PiperOrigin-RevId: 301351495
2020-03-19 00:48:46 +00:00
olly
235c631136 FfmpegAudioRenderer should use UNSUPPORTED_TYPE for non-audio formats
Issue: #2159
PiperOrigin-RevId: 301345559
2020-03-19 00:48:38 +00:00
krocard
fdf35776f8 Add support for x86_64 for the ffmpeg extension
Requested by https://github.com/google/ExoPlayer/issues/7058.
Additionally move one of the common option in COMMON_OPTIONS.

PiperOrigin-RevId: 299862479
2020-03-10 10:21:29 +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
Oliver Woodman
aeea17dd0f Merge pull request #6999 from xufuji456:dev-v2
PiperOrigin-RevId: 298544278
2020-03-10 10:17:13 +00:00
olly
c6a6e0d6f3 Migrate various call sites to Format.Builder
PiperOrigin-RevId: 297562889
2020-02-27 17:15:34 +00:00
xufulong
6d14c168e2 use swresample instead of avresample, since avresample module has been deprecated. 2020-02-19 22:09:01 +08:00
aquilescanta
5c3c803460 Remove DRM management from Renderers
PiperOrigin-RevId: 295569075
2020-02-17 17:40:30 +00:00
olly
f1f0ff3a65 Use MIME types rather than PCM encodings for ALAW and MLAW
PiperOrigin-RevId: 287999703
2020-01-06 14:55:01 +00:00
andrewlewis
a0044257b4 Add troubleshooting instructions for decoding extensions
PiperOrigin-RevId: 286585978
2019-12-20 16:59:07 +00:00
tonihei
72d5b425d3 Add IntDefs for renderer capabilities.
This simplifies documentation and adds compiler checks that the correct values
are used.

PiperOrigin-RevId: 283754163
2019-12-05 10:20:15 +00:00
olly
3065d51310 Provide instructions for building extensions using Windows PowerShell
PiperOrigin-RevId: 283296427
2019-12-04 09:58:13 +00:00
andrewlewis
a4e7274cca Update audio extension build configurations
- Fix FLAC extension build (currently broken due to use of std::array,
  but fixed by migrating to NDK r20).
- Move opus and ffmpeg extensions to NDK r20. For ffmpeg, upgrade to
  release 4.2 which requires using libswresample and updates to the
  build script.

Issue: #6601
PiperOrigin-RevId: 277924119
2019-11-05 16:16:38 +00:00
kimvde
f133766b40 Improve ffmpeg build instructions
- Simplify the supported formats configuration by moving it to a
  separate variable, therefore avoiding updating the COMMON_OPTIONS
  variable in the ffmpeg build command.
- Move the ffmpeg build command to a shell script.

PiperOrigin-RevId: 274778232
2019-10-15 23:07:45 +01:00
ibaker
c5b6c6229b Simplify the ffmpeg build instructions a little
In-line EXOPLAYER_ROOT which only has one reference. And change
FFMPEG_EXT_PATH to always include "/jni"

PiperOrigin-RevId: 270866662
2019-10-02 21:25:48 +01:00
olly
2d0b10a73a Use constant to define androidx annotation version
PiperOrigin-RevId: 266801762
2019-09-05 10:45:08 +01:00
tonihei
cd4571161a Add builders for SimpleExoPlayer and ExoPlayer.
The current ExoPlayerFactory is growing too big and usage becomes increasingly
complicated because it's not possible to set individual components without
specifying many other defaults.

Adding new builder classes makes building easier and more future-proof.

PiperOrigin-RevId: 263339078
2019-08-15 14:41:51 +01:00
tonihei
0e33123938 Turn on non-null-by-default for some core library packages.
And add missing some missing annotations to the publicly visible API of these
packages.

PiperOrigin-RevId: 263134804
2019-08-15 14:41:51 +01:00
tonihei
389eca6e07 Merge robolectric_testutils into testutils.
We no longer need two modules as AndroidX-Test takes care of the system
abstraction and we no longer have Robolectric Handler/Looper workarounds.

PiperOrigin-RevId: 262363201
2019-08-09 18:36:32 +01:00
tonihei
a9b93d7ec2 Fix some remaining extension API nullability issues.
PiperOrigin-RevId: 261910303
2019-08-06 15:54:08 +01:00
tonihei
346f8e670a Turn on non-null-by-default for most extensions.
PiperOrigin-RevId: 261700729
2019-08-05 20:27:43 +01:00
olly
fb0481c520 Bump annotations dependency + update release notes
PiperOrigin-RevId: 261353271
2019-08-02 19:04:56 +01:00
olly
cb8983afd1 Standardize ALAC initialization data
Android considers ALAC initialization data to consider of the magic
cookie only, where-as FFmpeg requires a full atom. Standardize around
the Android definition, since it makes more sense (the magic cookie
being contained within an atom is container specific, where-as the
decoder shouldn't care what container the media stream is carried in)

Issue: #5938
PiperOrigin-RevId: 261124155
2019-08-01 20:38:55 +01:00
olly
3afdd7ac5a Put @Nullable annotation in the right place
PiperOrigin-RevId: 249828748
2019-05-30 15:10:55 +01:00
tonihei
33c677846a Use versioned manifest in all Robolectric tests.
We are currently defaulting to targetSdk=1 as no targetSdk is specified. Only
tests which explicitly ask for another SDK use another test SDK. With the
versioned manifest, all tests run using the targetSDK by default.

PiperOrigin-RevId: 249060796
2019-05-21 13:51:43 +01:00
andrewlewis
1bc279795b Log warnings when extension libraries can't be used
Issue: #5788
PiperOrigin-RevId: 245440858
2019-04-26 18:35:15 +01:00
eguven
f9f009645d Add missing DownloadService build*Intent and startWith* methods
PiperOrigin-RevId: 244196081
2019-04-18 23:22:35 +01:00
tonihei
1ee51518ae Use new exoplayer.dev domain everywhere.
The old domain automatically forwards to the new one. For consistency, change
all doc and code references regardless.

Also adds GitHub CNAME config file which configures our page for the custom
domain.

PiperOrigin-RevId: 243592110
2019-04-16 15:25:27 +01:00
tonihei
8e80acd18f Use androidx.test and extensions.
This replaces the deprecated usages of RobolectricTestRunner and
RuntimeEnvironent and fully migrates the tests to androidx.

PiperOrigin-RevId: 238011667
2019-03-15 04:53:12 +00:00
olly
0622afe170 Migrate to androidx
Issue: #5489
PiperOrigin-RevId: 234507428

Add missing annotation dependency

Issue: #5489
PiperOrigin-RevId: 234566177
2019-02-19 13:22:54 +00:00
tonihei
edabbd52d0 Update Robolectric and Truth.
PiperOrigin-RevId: 233612344
2019-02-18 15:59:32 +00:00
olly
ae12b76ac4 Add tests to ensure DefaultRenderersFactory reflection works
Also add explicit Lint.IfChange/ThenChange rules to make it
clearer what needs to be done when changing one of the code
paths that's accessed via reflection.

PiperOrigin-RevId: 233406709
2019-02-18 15:58:11 +00:00