8916 Commits

Author SHA1 Message Date
christosts
159e3a80d5 Keep pending output format on MediaCodec.flush()
When operating the MediaCodec in asynchronous mode, we are seeing
NPEs raised from the DefaultAudioSink because output buffers are pushed
to the DefaultAudioSink with the DefaultAudioSink not configured yet.
This is possible to happen if an output buffer is passed with
MediaCodecAudioRenderer.processOutputBuffer() before an output format
change.

One possible code path to trigger this is when an output format change
is pending and we flush MediaCodec (e.g. for a seek): the callback is
waiting in the looper's queue but we ignore all currently queued
callbacks after a flush().

This commit checks for a pending output format change during a flush():
if one exists, and the next MediaCodec output callback right after the
flush() is an output buffer (and not a new output format), then the
pending output format is propagated first.

The only adapter that needs to change is the
AsynchronousMediaCodecAdapter which previsouly deleted all pending
callbacks immediately on flush(). The AsynchronousMediaCodecAdapter now
needs to also handle every enqueued callback in order to identify is
there's a pending output format change.

Testing: added unit tests for the new code. I have verified that if we
pass an output buffer to the audio renderer before the output format, it
will result on the specific NPE, but I cannot reproduce the base
scenario (an output format change is pending when flushing) on a real
device because we can't know if an output format is indeed pending.
PiperOrigin-RevId: 310885283
2020-05-14 22:19:24 +01:00
andrewlewis
6aab5e2e61 Upgrade IMA SDK to 3.18.2
PiperOrigin-RevId: 310883076
2020-05-14 22:19:14 +01:00
samrobinson
59ecce6c85 Rollback of 70273a0361
*** Original commit ***

Assert incoming buffers are little endian in the DefaultAudioSink.

***

PiperOrigin-RevId: 310377513
2020-05-14 22:19:05 +01:00
olly
9a4ec54bdf Propagate Format through extension video decoders
We currently propagate only ColorInfo, but propagating the whole Format
is generally useful (e.g., to get the frame-rate on the output side of
the decoder).

PiperOrigin-RevId: 310359650
2020-05-14 22:18:55 +01:00
ibaker
252bf43bf4 Stop parsing unsupported WebVTT CSS properties
The spec lists an exhaustive list of CSS properties that should be
recognised, all others must be ignored:
https://www.w3.org/TR/webvtt1/#the-cue-pseudo-element

PiperOrigin-RevId: 310353888
2020-05-14 22:18:46 +01:00
ibaker
99ebeaed17 Change the SubtitleView.Output interface
This allows properties to propagate when switching view types
(e.g. bottomPaddingFraction).

It also allows the style-stripping code to be pushed up to SubtitleView
and therefore shared.

PiperOrigin-RevId: 310353534
2020-05-14 22:18:37 +01:00
samrobinson
70273a0361 Assert incoming buffers are little endian in the DefaultAudioSink.
PiperOrigin-RevId: 310332895
2020-05-14 22:18:28 +01:00
ibaker
c4c826fbfe Add StrikethroughSpan support to SpannedToHtmlConverter
PiperOrigin-RevId: 310332708
2020-05-14 22:18:18 +01:00
christosts
4e8ea009b8 Fix AsynchronousMediaCodecBufferEnqueuerTest
Fixes AsynchronousMediaCodecBufferEnqueuerTest broken tests by
enqueueing input buffers that have previously been dequeued from the
MediaCodec.

The test assumes that the shadow MediaCodec implementation can dequeue
at least 10 input buffers before queueing them back. Although fragile,
it seems to work with the current robolectric shadow MediaCodec. This is
at the moment preferred compared to making the test more complicated.

PiperOrigin-RevId: 310325096
2020-05-14 22:18:09 +01:00
insun
85cf5768eb Let CastPlayer#getTrackSelector return null
Change CastPlayer#getTrackSelector to return null
instead of throwing exception.

PiperOrigin-RevId: 310319964
2020-05-14 22:18:00 +01:00
insun
c7f2df0fd9 Add Player#getTrackSelector()
PiperOrigin-RevId: 310242733
2020-05-14 22:17:51 +01:00
Jorge Ruesga
435639979f
Enable embedded CEA-708 support
Currently, DashMediaPeriod only takes into account as CEA-608 accessibility tags as embedded
closed captions tracks CEA-608. CEA-708 closed captions format is parsed when is present on
its own AdaptationSet, but not when is embedded as an accessibility tag in a video AdaptaticonSet.

Embedded CEA-708 support is added by parsing accessibility tags like the example below:

  <Accessibility schemeIdUri="urn:scte:dash:cc:cea-708:2015" value="1=lang:eng;2=lang:deu"/>
  <Accessibility schemeIdUri="urn:scte:dash:cc:cea-708:2015" value="1=lang:eng;2=lang:eng,war:1,er:1"/>

so it creates a new CEA-708 track for accessibility tags with schemeIdUri = urn:scte:dash:cc:cea-708:2015
and extract accessibilityChannel and language from value attribute.

Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2020-05-13 04:45:56 +01:00
Dennis Fölster
8d2406ece3 Keep the paused state during buffering without playWhenReady.
The PlaybackStateCompat#STATE_BUFFERING expects the playback to begin
once enough data has been buffered. This is however not the case if
playWhenReady is not set on the exoplayer.
2020-05-12 14:43:47 +02:00
Arnold
dfec0338c5 Add minimum constraints (width, height, frame rate, bitrate) to DefaultTrackSelector. 2020-05-09 22:00:45 +03:00
krocard
535e14cb4d Implement format to encoding for AAC
PiperOrigin-RevId: 310199693
2020-05-06 20:58:11 +01:00
krocard
a2ce75d836 AudioSink buffers should be in LITTLE_ENDIAN
Some part of the audio pipeline in the DefaultAudioSink
(PCM processors) are expecting little endian buffers.

As a result, in order to behave like MediaCodec,
make sure the passthrough MediaCodec-bypass pipeline
also processes little endian output buffers.

PiperOrigin-RevId: 310172464
2020-05-06 20:58:02 +01:00
krocard
040a88f4f8 Parse AAC initialisation data in MatroskaExtractor
This aligns mkv with mp4, flv and ts extractors.

This issue was found when AAC in an MKV container was not offloaded
as format.codecs was null.

PiperOrigin-RevId: 310170759
2020-05-06 20:57:53 +01:00
krocard
efff7a9d22 Propagate sample rate and format deeper
#exo-offload

PiperOrigin-RevId: 310150780
2020-05-06 20:57:44 +01:00
ibaker
8077fe1bf1 Add media period info to DrmSessionEventListener methods
Part of issue:#6765

PiperOrigin-RevId: 310143494
2020-05-06 20:57:35 +01:00
krocard
34327bec5c Propagate the correct gapless values in passthrough
Previously the input format values were used,
but it could be incorrect if two format change were
occurring in quick successions.

PiperOrigin-RevId: 310142675
2020-05-06 20:57:26 +01:00
krocard
64b50ba9fc Clarify DRM passthrough comment
PiperOrigin-RevId: 310142362
2020-05-06 20:57:17 +01:00
Oliver Woodman
b1b93069a9 Merge pull request #7324 from tpiDev:cronet/migrate-to-play-services-17-0-0
PiperOrigin-RevId: 310115628
2020-05-06 20:57:06 +01:00
olly
62e1000df4 Upgrade OkHttp to 3.12.11.
PiperOrigin-RevId: 310114401
2020-05-06 20:56:55 +01:00
tonihei
98f8862d1c Remove threading requirement from listener registration methods.
These methods operate on a thread-safe collection and are thus
inherently thread-safe. This simplifies some player setup configurations
where initial listeners are added on a background thread (e.g. when
using a dependency injection framework).

PiperOrigin-RevId: 310113181
2020-05-06 20:56:46 +01:00
tonihei
95ffc365ca Remove auto-notification of current cues when adding listener.
Users of addTextOutput should instead query the current cues if they
need them. This is more consistent with how other listeners are handled.

PiperOrigin-RevId: 310112241
2020-05-06 20:56:37 +01:00
Tamás Varga
069fa69c4b Merge branch 'dev-v2' into cancel-hls-chunk-download-and-discard-upstream
# Conflicts:
#	library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java
2020-05-06 10:06:15 +02:00
olly
99b62a24d1 Rename VideoDecoderRenderer to VideoDecoderGLFrameRenderer
We currently have DecoderVideoRenderer and VideoDecoderRenderer, which
is very confusing! This one is package private, so we can rename it to
remove some of the confusion.

Also fix some nullness issues.

PiperOrigin-RevId: 309964088
2020-05-05 18:39:47 +01:00
Oliver Woodman
6888160800 Merge pull request #7328 from TiVo:include-roleflags-in-final-format
PiperOrigin-RevId: 309963490
2020-05-05 18:39:38 +01:00
bachinger
ab559eb373 Add media item property to Timeline.Window
PiperOrigin-RevId: 309949800
2020-05-05 18:39:25 +01:00
krocard
81a13a638d A passthrough codec is only needed for DRM
In passthrough MediaCodec is not used except if
the format has a DRM.

Nevertheless the code was still requiring that a
passthrough decoder be present even if it was not going to be
used (aka no drm).

PiperOrigin-RevId: 309947271
2020-05-05 18:39:16 +01:00
ibaker
5117138481 Fix RelativeSizeSpan handling in SpannedToHtmlConverter
A silly mistake of confusing a fractional float with a percentage.

PiperOrigin-RevId: 309946004
2020-05-05 18:39:07 +01:00
aquilescanta
635886449a Use DataSpec request headers in HttpMediaDrmCallback
PiperOrigin-RevId: 309944716
2020-05-05 18:38:59 +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
tonihei
2e81186a33 Add timeout to TestExoPlayer runUntil methods.
If the condition isn't fulfilled, they currently block until the
test runner times out the test. Our usual approach is to timeout
in the test itself so that the error message is clearly showing the
blocked condition.

Also clean-up some documentation.

PiperOrigin-RevId: 309930198
2020-05-05 18:38:41 +01:00
samrobinson
d944f32f24 Change SilenceSkippingAudioProcessor to not rely on the frame MSB.
PiperOrigin-RevId: 309925306
2020-05-05 18:38:32 +01:00
krocard
918963c2b4 Do not use MediaCodec in passthrough mode.
Now that MediaCodec is not use in passthrough, no
MediaCodec should be created in this mode.

Additionally, do not instantiate a MediaCodec in passthrough

#exo-offload

PiperOrigin-RevId: 309916131
2020-05-05 18:38:23 +01:00
andrewlewis
fa7d26dd9f Migrate to new IMA preloading APIs
issue:#6429
PiperOrigin-RevId: 309906760
2020-05-05 18:38:14 +01:00
aquilescanta
a8d1de5198 Fix TrackOutput documentation for encryption data format
PiperOrigin-RevId: 309899166
2020-05-05 18:38:05 +01:00
aquilescanta
fff3f99f4a Pass LoadErrorInfo to LoadErrorHandlingPolcy
Issue: #7309
PiperOrigin-RevId: 309749566
2020-05-05 18:37:57 +01:00
olly
862a6e4dd2 Pass appropriate frame-rate to Surface.setFrameRate
PiperOrigin-RevId: 309746009
2020-05-05 18:37:47 +01:00
andrewlewis
c926acb36d Add missing @Player.State in action schedule
PiperOrigin-RevId: 309735092
2020-05-05 18:37:38 +01:00
andrewlewis
965383879e Add tests for snap-back to midroll
These tests require longer content so that the ads are spaced apart far enough
to trigger preloading while content is playing (rather than immediately as soon
as a position is reported).

PiperOrigin-RevId: 309733826
2020-05-05 18:37:30 +01:00
andrewlewis
99a3cc2877 Add test ads response with two midrolls
Also clean up naming of test ads responses.

PiperOrigin-RevId: 309728625
2020-05-05 18:37:21 +01:00
tonihei
3c2e5df527 Update initial bitrate estimates.
PiperOrigin-RevId: 309720018
2020-05-05 18:37:12 +01:00
olly
dcae3c2609 CronetDataSource: Use standard InterruptedIOException
PiperOrigin-RevId: 309710359
2020-05-05 18:37:03 +01:00
tonihei
5819b47f41 Use helper method for duplicated message sending logic.
PiperOrigin-RevId: 309709215
2020-05-05 18:36:54 +01:00
tonihei
3ebad15338 Fix usage of deprecated IntDef.
And allow default value constant to be assigned as valid value.

PiperOrigin-RevId: 309708888
2020-05-05 18:36:45 +01:00
tonihei
3100f5938d Reorder SimpleExoPlayer constructor calls.
We currently call the old (deprecated) from the new one and not
the other way round.

Also remove a duplicated method.

PiperOrigin-RevId: 309702752
2020-05-05 18:36:34 +01:00
Steve Mayhew
2ba0b1d997 Format in TrackGroup must include roleFlags from HLS manifest parse
With sample prepare (non-chunkless) the `Format` object in the TrackGroup is derived from the data in the stream and data in the manifest.  This change includes the roleFlags from the HLS manifest parse in the final derived format.
2020-05-04 11:30:12 -07:00
Tomasz Pieszko
2cae3b3905 [MOD] Use Cronet from Play Services, as default instead of using embedded one. It lets to reduce APK size ~8MB. 2020-05-04 11:18:43 +02:00