5166 Commits

Author SHA1 Message Date
christosts
aceba835cc Enable MediaCodec asynchronous mode
Enable using MediaCodec in async mode. Expose experimental
API to enable/disable the feature.

PiperOrigin-RevId: 283309798
2019-12-04 09:58:27 +00:00
olly
b68d19bceb Add layer of indirection for drawables
This allows easy overriding of the resources by app developers

Issue: #6709
PiperOrigin-RevId: 283306121
2019-12-04 09:58:20 +00:00
olly
1536a2ceea Rollback of e26a61b903
*** Original commit ***

Improve `Format` propagation within the `MediaCodecRenderer`.

For example, fix handling of pixel aspect ratio changes in
playlists where video resolution does not change.

Issue:#6646

***

PiperOrigin-RevId: 282903626
2019-12-04 09:58:00 +00:00
andrewlewis
a81149d962 Fix audio processor draining for reconfiguration
When transitioning to a new stream in a different format, the audio
processors are reconfigured. After this, they are drained and then
flushed so that they are ready to handle data in updated formats for the
new stream.

Before this change, some audio processors made the assumption that after
reconfiguration no more input would be queued in their old input format,
but this assumption is not correct: during draining more input may be
queued. Fix this behavior so that the new configuration is not referred
to while draining and only becomes active once flushed.

Issue: #6601
PiperOrigin-RevId: 282515359
2019-11-27 22:29:07 +00:00
andrewlewis
4799993d3b Remove redundant flush() calls from AudioProcessors
flush() is guaranteed to be called in all these cases anyway.

Also clarify documentation for AudioProcessor-specific methods that can
change the 'active' flag.

Issue: #6601
PiperOrigin-RevId: 282515255
2019-11-27 22:28:59 +00:00
andrewlewis
10f142b3ff Add AudioProcessor.AudioFormat
Issue: #6601
PiperOrigin-RevId: 282515179
2019-11-27 22:28:51 +00:00
andrewlewis
b7000e64e9 Always drain/flush AudioProcessors after configuration
This simplifies the contract of configure and is in preparation for
fixing a bug where more input can't be queued when draining audio
processors for a configuration change.

Issue: #6601
PiperOrigin-RevId: 282514367
2019-11-27 22:28:43 +00:00
olly
f630ed1ab5 Fix incorrect Javadoc
PiperOrigin-RevId: 281976465
2019-11-22 16:58:42 +00:00
andrewlewis
abe3c8ce1d Fix check for E-AC3 JOC in DASH
Issue: #6636
PiperOrigin-RevId: 281972403
2019-11-22 16:58:33 +00:00
olly
66c206c71a Make placeholder sessions report their true state
Note that the renderer changes will all disappear when we remove
legacy injection of DrmSessionManager into renderers.

PiperOrigin-RevId: 281952601
2019-11-22 15:10:32 +00:00
olly
f3185d077f Improve WakeLock/AudioBecomingNoisy Javadoc
PiperOrigin-RevId: 281764207
2019-11-22 15:10:16 +00:00
olly
7c24ba0934 Simplify checking whether a sample can be read
PiperOrigin-RevId: 281763672
2019-11-22 15:10:09 +00:00
olly
ab8816214e Simplify playback of clear samples without keys
- Move property to DrmSession; it feels like a more natural place
  for it to go (and provides greater flexibility).
- Change flags to a boolean.

PiperOrigin-RevId: 281758729
2019-11-22 15:10:02 +00:00
kimvde
b18650fdcf Expose metadata in FLAC extractor
PiperOrigin-RevId: 281538423
2019-11-22 15:09:17 +00:00
tonihei
f937fe9e2a Replace all database.beginTransaction with beginTransactionNonExclusive
This ensures other database readers can continue reading while we do our
write transaction.

PiperOrigin-RevId: 281520758
2019-11-22 15:09:01 +00:00
olly
d8dcd2930c Remove stray word in logging
PiperOrigin-RevId: 281510703
2019-11-22 15:08:53 +00:00
tonihei
809234bc4f Mark all methods accessing SQLite databases as potentially blocking.
They are all marked with a JavaDoc comment and the @WorkerThread annotation
which is useful if apps are using threading annotations. All other public
methods in the same classes are marked with @AnyThread to avoid the impression
we forgot to annotate them.

PiperOrigin-RevId: 281490301
2019-11-22 15:08:46 +00:00
christosts
ca849a0679 Fix incorrent javadoc syntax
PiperOrigin-RevId: 281480582
2019-11-22 15:08:38 +00:00
christosts
f921d0d3e5 Ability to set timeout on release() and setSurface()
Add experimental APIs to set a timeout Player#release() and
PlayerMessage#blockUntilDeliver().

PiperOrigin-RevId: 281479146
2019-11-22 15:08:31 +00:00
aquilescanta
f6afbe6cb0 Make MediaLoadData a top level class
In order to reuse it in LoadErrorHandlingPolicy.

PiperOrigin-RevId: 281333287
2019-11-22 15:08:16 +00:00
ibaker
c8e5144494 Add testutils as test dep of library-core module
The current workaround seems to cause compilation errors inside the
testutils module in Android Studio. This seems to fix them.

This doesn't introduce a circular dependency because it's only
the tests in library-core depending on testutils.

PiperOrigin-RevId: 281318192
2019-11-22 15:08:08 +00:00
samrobinson
e26a61b903 Improve Format propagation within the MediaCodecRenderer.
For example, fix handling of pixel aspect ratio changes in
playlists where video resolution does not change.

Issue:#6646
PiperOrigin-RevId: 281276023
2019-11-22 15:08:00 +00:00
andrewlewis
dbd7e055e5 Reconfigure audio sink when PCM encoding changes
Note:
- Fixing this uncovers another bug in how audio processor draining
  works, so the test playlist still doesn't play correctly after this
  change.
- Once we reconfigure the audio sink based on the ExoPlayer Format
  rather than the codec MediaFormat in a later change, this change can
  be reverted.

Issue: #6601
PiperOrigin-RevId: 281264149
2019-11-22 15:07:52 +00:00
kimvde
774ccafa93 Remove TODO around optimizing sample data outputs in FlacExtractor
Preliminary measurement showed that the results were similar to the non-optimized
version.

PiperOrigin-RevId: 281255476
2019-11-22 15:07:44 +00:00
aquilescanta
95d0921114 Make LoadEventInfo a top level class
In order to reuse it in LoadErrorHandlingPolicy.

PiperOrigin-RevId: 281087397
2019-11-18 17:55:51 +00:00
aquilescanta
699dd3d27c Deprecate public renderer constructors that take a DrmSessionManager
PiperOrigin-RevId: 281086336
2019-11-18 17:55:43 +00:00
kimvde
9b2917a9ae Add Java FLAC extractor
Seeking, live streams support and exposure of vorbis and ID3 data
are not part of this commit.

Issue: #6406
PiperOrigin-RevId: 281083332
2019-11-18 17:55:28 +00:00
olly
0db1fc67fa Cleanup key request parameters
- Make NonNull, which is already the case when using the manager builder.
- Better document PLAYREADY_CUSTOM_DATA_KEY, now that newPlayReadyInstance
  is no more.

PiperOrigin-RevId: 281079288
2019-11-18 17:55:20 +00:00
aquilescanta
d984a8cdd3 Allow user to pick which track types to create placeholder sessions for
Issue:#4867
PiperOrigin-RevId: 281064793
2019-11-18 17:55:12 +00:00
olly
1ef345192c Clean up non-trivial track selection deprecation
PiperOrigin-RevId: 281051893
2019-11-18 17:55:04 +00:00
andrewlewis
a5e14b4dae Fix byte order for HDR10+ static metadata
The implementation of writing HDR10+ static metadata assumed that the
application would use default (big endian) byte order for this metadata but
MediaCodec expects the order to match the specification CTA-861.3.

PiperOrigin-RevId: 281050806
2019-11-18 17:54:56 +00:00
olly
1629a5afd3 Make some listener methods default
PiperOrigin-RevId: 281050034
2019-11-18 17:54:48 +00:00
olly
3e17080c02 Remove SimpleCache hacks that are no longer used
PiperOrigin-RevId: 281049383
2019-11-18 17:54:40 +00:00
olly
7f2827077c Don't check rotated resolution for HEVC on LG Q7
Issue: #6612
PiperOrigin-RevId: 281048324
2019-11-18 17:54:32 +00:00
aquilescanta
82b218607f Add Util.linearSearch
PiperOrigin-RevId: 281037183
2019-11-18 17:54:15 +00:00
ibaker
79b7af656b Rollback of <unknown commit>
*** Original commit ***

Disable test coverage again

https://issuetracker.google.com/issues/37019591 causes local variables can't be found while debugging.

***

PiperOrigin-RevId: 280666758
2019-11-17 00:33:26 +00:00
olly
c0d3930816 Parse channel count and sample rate from ALAC initialization data
Also remove the "do we really need to do this" comment for AAC.
Parsing from codec specific data is likely to be more robust, so
I think we should continue to do it for formats where we've seen
this problem.

Issue: #6648
PiperOrigin-RevId: 280575466
2019-11-15 05:16:39 +00:00
Oliver Woodman
c613e502aa Merge pull request #6650 from stanionascu:dev-v2-dv
PiperOrigin-RevId: 280573887
2019-11-15 05:16:29 +00:00
krocard
5579cc89c6 Propagate end of stream received from OnFrameRenderedListener
Previously the renderer EOS (aka last frame rendered), was reported as soon
as the last encoded frame was queued in the codec renderer.
This leaded to EOS reported too early.

PiperOrigin-RevId: 280456277
2019-11-15 05:16:19 +00:00
tonihei
c8e7ecd367 Merge consecutive segments for downloading.
This speeds up downloads where segments have the same URL with different
byte ranges. We limit the merged segments to 20 seconds to ensure the download
progress of demuxed streams is roughly in line with the playable media duration.

Issue:#5978
PiperOrigin-RevId: 280410761
2019-11-15 05:16:11 +00:00
aquilescanta
51711a0c97 Fix MediaDrm leaks in OfflineLicenseHelper
PiperOrigin-RevId: 280176216
2019-11-15 05:16:03 +00:00
ibaker
65b49a49f7 Fix parameter name mismatch in Playlist
PiperOrigin-RevId: 280167223
2019-11-15 05:15:56 +00:00
olly
0ff79c0e02 Support switching between Surface and VideoDecoderOutputBufferRenderer
Clear state for one mode when entering the other in both SimpleExoPlayer
and SimpleDecoderVideoRenderer. The latter is redundant for the case of
renderers that are used inside SimpleExoPlayer, but seems nice to have.

- Entering Surface mode means receiving a non-null Surface, SurfaceHolder
  or TextureView in SimpleExoPlayer, or a non-null Surface in
  SimpleDecoderVideoRenderer.
- Entering VideoDecoderOutputBufferRenderer means receiving a non-null
  VideoDecoderOutputBufferRenderer in SimpleExoPlayer and
  SimpleDecoderVideoRenderer.

PiperOrigin-RevId: 280155151
2019-11-15 05:15:48 +00:00
olly
bee6294813 Add clear methods for VideoDecoderOutputBufferRenderer
Also add some missing Nullable annotations.

PiperOrigin-RevId: 280150512
2019-11-15 05:15:40 +00:00
olly
7ca77c6002 Make DrmSession acquire/release consistent with ExoMediaDrm
This aligns the method naming and Javadoc. The only remaining
inconsistency I can see is that the initial reference count for
DrmSession is 0 rather than 1. Unfortunately I think it's not
trivial to get these aligned, because DefaultDrmSessionManager
relies on being able to do something between instantiation and
the DrmSession starting to open the session. In practice this
doesn't really matter, since DrmSessions will be obtained via the
manager, which does increment thee reference count to 1 to be
consistent with how ExoMediaDrm acquisition works.

PiperOrigin-RevId: 280136574
2019-11-15 05:15:32 +00:00
olly
9b4a3701d4 Clean up ExoMediaDrm reference counting documentation
PiperOrigin-RevId: 280106092
2019-11-15 05:15:24 +00:00
bachinger
69e51505e4 use getPeriodByUid when searching for subsequent period of seek timeline
Issue: #6641
PiperOrigin-RevId: 279963739
2019-11-15 05:15:08 +00:00
aquilescanta
abe0330f39 Add a track type argument to DrmSessionManager.acquirePlaceholderSession
Issue:#4867
PiperOrigin-RevId: 279928345
2019-11-15 05:15:00 +00:00
aquilescanta
b84a9bed2c Add a parameter object for LoadErrorHandlingPolicy methods
PiperOrigin-RevId: 279928178
2019-11-15 05:14:51 +00:00
ibaker
ddb70d96ad Require an end timecode in SSA and Subrip subtitles
SSA spec allows the lines in any order, so they must all have an end time:
http://moodub.free.fr/video/ass-specs.doc

The Matroska write-up of SubRip assumes the end time is present:
https://matroska.org/technical/specs/subtitles/srt.html

This will massively simplify merging issue:#6595

PiperOrigin-RevId: 279926730
2019-11-15 05:14:43 +00:00