6600 Commits

Author SHA1 Message Date
ibaker
b8c8ce0ee0 Use Mp4WebvttDecoder for WebVTT content in DASH MP4 containers
This was broken by 74a9d8f680
because DashManifestParser switched to setting Format.sampleMimeType to
text/vtt while SubtitleDecoderFactory was still expecting
application/x-mp4-vtt. This change teaches SubtitleDecoderFactory to
check both Format.containerMimeType and Format.sampleMimeType.

I'll investigate a follow-up change to remove
MimeTypes.APPLICATION_MP4VTT completely (it's currently still used in
AtomParsers).

Issue: #7985
PiperOrigin-RevId: 334771672
2020-10-17 12:09:13 +01:00
ibaker
9ce2ac8a8c Create a robolectricutils module
This holds shared test infrastructure that needs to depend on
Robolectric.

PiperOrigin-RevId: 334604041
2020-10-17 12:08:59 +01:00
ibaker
bd312ec906 Preserve limit when resetting ParsableByteArray in OggPacket#populate
When I moved ParsableByteArray#data behind a getter I replaced some
assignments with calls to reset(byte[]):
ce2e6e2fd6

reset(byte[]) deliberately sets `limit` to `data.length`, in order to
handle cases that were reassigning `data` but not updating `limit`.
However OggPacket was already using `limit` to track where to write
'new' data into the array, so changing `limit` to `data.length` caused
us to try and write new data beyond the end of the array.

I looked at other uses of reset(byte[]) in ce2e6e2fd6
and condluded the only other usage in MatroskaExtractor is legit and
shouldn't be updated like this (because MatroskaExtractor previously
*wasn't* correctly updating/maintaining `limit`).

Issue: #7992
PiperOrigin-RevId: 334601586
2020-10-17 11:53:40 +01:00
andrewlewis
824b2a7305 Fix position ramping behavior with AudioTrack speed params
Non-realtime AudioTrack playback speed was not taken into account when
extrapolating the old mode's position, causing the position not to
advance smoothly.

This should be a no-op when not using AudioTrack playback params for
speed adjustment.

Issue: #7982
PiperOrigin-RevId: 334151163
2020-10-17 11:53:06 +01:00
samrobinson
89cd796bf6 Do not require subtitleButton in custom layouts of StyledPlayerView
Every other subtitleButton has an if not null check, but does not force non null.

Issue: #7962
PiperOrigin-RevId: 334124323
2020-10-17 11:52:45 +01:00
Oliver Woodman
9819664bd1 Merge pull request #7798 from yoobi:trackSelectionView
PiperOrigin-RevId: 333751261
2020-10-17 11:51:53 +01:00
kimvde
57f11d1556 Parse TLEN duration in Mp3Extractor
Issue: #7949
PiperOrigin-RevId: 333733615
2020-10-17 11:51:36 +01:00
bachinger
19530866c7 Always pass true for ongoing with the first notification
ISSUE: #7977
PiperOrigin-RevId: 333726625
2020-10-17 11:51:30 +01:00
christosts
300bee5f0b Bring back setRenderTimeLimitMs
PiperOrigin-RevId: 333712782
2020-10-17 11:51:18 +01:00
samrobinson
973d23543e Add support for mp2 boxes.
Issue: #7967
PiperOrigin-RevId: 333709003
2020-10-17 11:49:06 +01:00
christosts
a1999ef854 Util.getStringForTime() prefixes negative times
Fix bug to place the negative sign in the beginning
of the returned String.

PiperOrigin-RevId: 333504868
2020-10-17 11:48:24 +01:00
kim-vde
31251a40c1 Merge pull request #7968 from DolbyLaboratories:dev-v2-channelConfiguration
PiperOrigin-RevId: 333485323
2020-10-17 11:48:14 +01:00
tonihei
30be792a15 Switch SntpClient to time.android.com and allow to set host.
PiperOrigin-RevId: 333480727
2020-10-17 11:48:08 +01:00
krocard
64aa634f9b Fix offload buffer full detection after setEndOfStream
This issue has been observed on a test app stress
testing setEndOfStream.

The issue has not been observed on ExoPlayer,
probably due to timing differences, but it is fixed
preventively.

#exo-offload

PiperOrigin-RevId: 333472136
2020-10-17 11:48:02 +01:00
ibaker
92f9de8ea3 Delete sample_cbs.adts test asset
This seems to be an exact copy of sample.adts. Update the test to use
the same sample but just output to a different dump file.

PiperOrigin-RevId: 333469714
2020-10-17 11:47:54 +01:00
andrewlewis
79638d1e3d Add support for 'mett' sample description
PiperOrigin-RevId: 333272292
2020-10-17 11:47:44 +01:00
andrewlewis
884a0f52cd Remove unused MP4 atom type
PiperOrigin-RevId: 333051018
2020-10-17 11:47:35 +01:00
tonihei
93948471c8 Don't require the existence of the next period to wait for its stream.
We have a workaround for uneven sample stream durarions in playlists that
assumes a renderer allows playback if it's reading ahead or waiting for
the next stream.

652c2f9c18 changed this logic to no longer require to
wait until the next stream is prepared due to a change in how we advance
media periods in the queue. However, the code falsely still requires the
next stream to exist (even if it's not prepared). This can cause a stuck
buffering state when the difference in the duration of the streams is more
than what we buffer ahead because we never create the next stream in such
a case.

Note: DefaultMediaClock.shouldUseStandaloneClock has roughly the same logic
and also doesn't require the next stream to be present.

Also fix a test that seemed to rely on this stuck buffering case to test
stuck buffering detection. Changed the test to not read the end of stream
to ensure it runs into the desired stuck buffering case.

Issue:#7943
PiperOrigin-RevId: 333050285
2020-10-17 11:47:27 +01:00
olly
a837e7a3b0 Cleanup layout XMLs to be consistent with others
PiperOrigin-RevId: 333023580
2020-10-17 11:44:43 +01:00
ibaker
77249bdf0e Use replace() instead of replaceAll() in SsaDecoder
We're not using regex so there's no need to use replaceAll()

PiperOrigin-RevId: 332865724
2020-10-17 11:44:17 +01:00
krocard
201d120e38 Recover from audio server crash while sleeping for offload
Without this patch, playback would be frozen indefinitely
until the user manually pauses and unpauses it.

This has the side effect of disabling offload until
the next stop due to the workaround of
disabling offload when it encounters a failure.

As an audio server crash is considered very
infrequent, especially in stable conditions like
an audio only playback, it is unlikely that disabling
offload is an issue.

PiperOrigin-RevId: 332857094
2020-10-17 11:44:10 +01:00
Oliver Woodman
1850a918f1 Merge pull request #7938 from bennettpeter:pullreq-ssa-subtitles
PiperOrigin-RevId: 332814223
2020-10-17 11:43:54 +01:00
ibaker
3e36ebe28e Suppress Guava-related ProGuard/R8 warnings
I didn't copy-paste the whole of
https://github.com/google/guava/wiki/UsingProGuardWithGuava because
this line seems relevant based on our current usage.

Lots of that file seems to relate to classes that are strongly
discouraged on Android:
https://github.com/google/guava/wiki/Android#specifics

I've only added this to the `common` module, since everyone that uses
ExoPlayer must depend on that. This avoids duplicating this line into
every module that has a Guava dependency.

Also remove some other warning suppressions that are defined in both
`core` and `common`.

Issue: #7904
PiperOrigin-RevId: 332203086
2020-10-17 11:41:41 +01:00
olly
f4896d769f Replace duration strings with plurals
PiperOrigin-RevId: 332014290
2020-10-17 11:41:35 +01:00
kimvde
97a0df77f6 Support android.resource URI scheme
Issue: #7866
PiperOrigin-RevId: 330736774
2020-10-17 11:40:56 +01:00
olly
8955cd3a61 Clean up experimental offload Javadoc
PiperOrigin-RevId: 331591005
2020-10-17 01:17:36 +01:00
olly
8386d617bf Fix OOM-is-prevented test OOM-ing :)
This test is intended to check that DefaultLoadControl will cause
playback to fail as "stuck buffering" rather than OOM-ing, in the
case that its target buffer size is reached and playback still
hasn't started.

Unfortunately, the target buffer size is ~130MB, and when running
on some setups an OOM actually ends up happening before this much
memory is allocated.

This change makes the target buffer size much smaller to avoid the
problem.

PiperOrigin-RevId: 331748208
2020-09-16 13:37:26 +01:00
bachinger
4f982763cf Add getMediaItemCount() and getMediaItemAt(int)
PiperOrigin-RevId: 331211708
2020-09-11 23:21:08 +01:00
olly
9fb2902dad Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:02:37 +01:00
olly
ea25729a09 Make BatchBufferTest allocate less memory
Setting to 2x BATCH_SIZE_BYTES

PiperOrigin-RevId: 331124129
2020-09-11 13:30:33 +01:00
olly
5bd61116a2 Fix incorrect type when creating ExoPlaybackException
PiperOrigin-RevId: 331027732
2020-09-11 13:30:15 +01:00
bachinger
862cf26534 fix typo
PiperOrigin-RevId: 331025924
2020-09-11 13:30:06 +01:00
tonihei
4648a41962 Don't keep 100MB static buffer in test.
This may remove available memory from other tests running in the same
process. Instead, create the huge buffer when needed so it can be GCed
immediately.

PiperOrigin-RevId: 330960844
2020-09-11 13:29:57 +01:00
tonihei
c75077cb9e Release player in e2e playback tests.
Not releasing the player means the playback thread keeps running
and also keeps its entire allocated playback buffer.

PiperOrigin-RevId: 330958821
2020-09-11 13:29:48 +01:00
krocard
52a1c791f7 Introduce audio offload scheduling tests
PiperOrigin-RevId: 330918396
2020-09-11 13:29:29 +01:00
tonihei
4d2a2384d6 Add convenience constructor methods.
When passing in ExtractorFactory instances to SimpleExoPlayer.Builder or
DefaultMediaSourceFactory, we currently need to pass in one other
instance (RenderersFactory or DataSource.Factory), that developers will
often set to its default. To avoid specifying these defaults, these new
convience methods allow to just set the ExtractorsFactory if required.

PiperOrigin-RevId: 330908002
2020-09-11 13:29:02 +01:00
andrewlewis
fdb9bbb619 Remove testutil dependency on Robolectric shadows
Move shadow-related utils for end-to-end tests into core test.

PiperOrigin-RevId: 330902696
2020-09-11 13:28:25 +01:00
olly
268ad81a98 Fix Javadoc for DefaultDataSourceFactory constructors
PiperOrigin-RevId: 330736458
2020-09-11 13:27:53 +01:00
insun
61b253bd5e Fix not to show repeat button when its mode is NONE.
PiperOrigin-RevId: 330627047
2020-09-09 09:45:54 +01:00
olly
49699d398d Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:45:48 +01:00
tonihei
6290d093c1 Support ExtractorFactory in DefaultMediaSourceFactory.
This allows to customize extractor flags more easily when setting up the player.

In addition, we need to provide a way to pass in the ExtractorFactory through
the constructor chain starting in SimpleExoPlayer so that removing the
DefaultExtractorsFactory is possible for R8.

PiperOrigin-RevId: 330472935
2020-09-09 09:45:42 +01:00
Oliver Woodman
6c7884436a Remove unfinished FfmpegVideoRenderer from release 2020-09-07 20:48:28 +01:00
olly
6cce608f32 Simplify DefaultMediaSourceFactory ad configuration
- Use a setter, which is consistent with how other optional
  components are passed.
- Remove nesting where a provider provides another provider.
  Since AdSupportProvider then only provides one thing, it
  can be renamed to AdsLoaderProvider, which more clearly
  expresses what it provides.

PiperOrigin-RevId: 330396334
2020-09-07 20:46:57 +01:00
insun
ea158dcdb0 Apply styled widget's bug fixes to legacy widget
- Prevent buffering when clicking ffwd button at the end of stream
- Set VR button disabled when listener is not registered

PiperOrigin-RevId: 330039336
2020-09-07 20:43:10 +01:00
olly
45dc66ef2f Clear CodecInfos on InputFormat if codec is null
In maybeInitCodecWithFallback, it caches availableCodecInfos with mediaCryptoRequiresSecureDecoder and inputFormat as inputs, and won't clear it if shouldInitCodec is false, resulting in a case where availableCodecInfos is not null and codec is null.
When we have a new format, it's reasonable to clear availableCodecInfos if codec is null. Otherwise we might not be able to properly initialize a new codec.

PiperOrigin-RevId: 329971796
2020-09-07 20:43:00 +01:00
christosts
8dcab1d20a Remove fragile tests
PiperOrigin-RevId: 329894431
2020-09-07 20:42:42 +01:00
insun
f68faff30b Set VR button disabled when listener is not registered (styled view)
PiperOrigin-RevId: 329851964
2020-09-07 20:42:33 +01:00
olly
fd71e38db3 Fix DASH/SS/HLS module readme files
PiperOrigin-RevId: 329751934
2020-09-07 20:42:23 +01:00
olly
fe2fc8b73f Add useful DownloadRequest to MediaItem conversion method
PiperOrigin-RevId: 329722775
2020-09-07 20:42:14 +01:00
olly
b5a4dc8f36 Fix dispatch of play when in IDLE or ENDED
PiperOrigin-RevId: 329722282
2020-09-07 20:42:04 +01:00