8605 Commits

Author SHA1 Message Date
aquilescanta
b5112492be Add loadTaskId to LoadEventInfo
To be used by the LoadErrorHandlingPolicy.

PiperOrigin-RevId: 308657905
2020-05-01 19:43:34 +01:00
olly
0ba397cd4e SegmentDownloader: Pull manifest loading up to base class.
This will make it a bit easier to push manifest loads to an Executor.

Issue: #5978
PiperOrigin-RevId: 308608155
2020-05-01 19:43:25 +01:00
olly
2e1024f0d1 Add CacheDataSourceFactory getters
A previous change added these getters to CacheDataSource, but it can
also be useful to retrieve these components directly from the factory.
This is useful for tasks where we're going to need to build multiple
CacheDataSource instances (e.g., to make requests in parallel), and
also need to operate directly on the same components. It's a bit more
natural to retrieve them from the factory than from an arbitrary
CacheDataSource in this case, since it can avoid unnatural code where
you create a CacheDataSource instance earlier than you would otherwise
just to use its getters, and/or create one just to use its getters and
then throw it away.

PiperOrigin-RevId: 308606020
2020-05-01 19:43:16 +01:00
olly
86fb3dfede DownloadManagerTest: Remove spurious tests and start to simplify
PiperOrigin-RevId: 308597964
2020-05-01 19:43:07 +01:00
olly
2e9ed51503 Use Executor instead of ExecutorService for parallel downloads
- Executor is a superclass of ExecutorService, so this is arguably a little
  more flexible.
- It removes the need to use null for direct execution, because Runnable::run
  is a direct executor that can be trivially used instead.
- Removing the error-prone "cannot be a direct executor" restriction in the
  parallel version of SegmentDownloader requires not relying on the futures
  returned from ExecutorService.submit() anyway.

Issue: #5978
PiperOrigin-RevId: 308586620
2020-04-27 11:34:30 +01:00
andrewlewis
008d38d832 Reattach player to ads loader on resume
When pausing and resuming a playback using an AdsLoader
it is necessary to call setPlayer again. This fixes an
issue where playback was stuck in the buffering state
when pausing and resuming an ad playback in the demo app.

PiperOrigin-RevId: 308582143
2020-04-27 11:34:29 +01:00
andrewlewis
a7c301cb23 Pass app context to the IMA SDK
Notes: this doesn't fix the current issue where the component containing the
ad overlay view leaks, but is good practice anyway.
PiperOrigin-RevId: 308582036
2020-04-27 11:34:29 +01:00
Ian Baker
a03f8a1c95 Merge pull request #7199 from TiVo:p-fix-stuckcaption
PiperOrigin-RevId: 308229206
2020-04-27 11:18:56 +01:00
tonihei
bf5b52e288 Make sure finishAllSessions() can be called without removing listener
Currently, this method is only supposed to be called before removing
the listener from the player or when releasing the player.

If called at other times, it will throw an exception later when
a playback session is ended automatically.

issue:#7193
PiperOrigin-RevId: 308254993
2020-04-27 10:41:50 +01:00
tonihei
e9511a56ea Deprecate onSeekProcessed.
PiperOrigin-RevId: 308246116
2020-04-27 10:41:50 +01:00
tonihei
13c668f9e0 Fix Widevine offline test assertion for API29+.
The error type thrown when acquiring a license that has already
been released changed from MediaDrmStateException to IllegalStateException
from API 29.

Update the tests to assert the correct type of error based on API version.

PiperOrigin-RevId: 308239508
2020-04-27 10:41:50 +01:00
aquilescanta
30c55d117e Fix NPE when reading from a SampleQueue from a loading thread
Issue: #7273
PiperOrigin-RevId: 308238035
2020-04-27 10:41:50 +01:00
tonihei
4df7470da5 Remove onSeekProcessed dependency from playback stats tracking.
The method is used to finish a brief "seeking" state that can be removed entirely
now state changes for seeking are masked.

PiperOrigin-RevId: 308237009
2020-04-27 10:41:50 +01:00
sneelavara
b3dc05933d Modified the Cea608Decoder constructor 2020-04-27 10:41:50 +01:00
sneelavara
f4f13d9132 Pass the Clock interface into the constructor 2020-04-27 10:41:50 +01:00
Sadashiva Neelavara
0ef38fcd1a Replacing Flush with Collection.emptyList 2020-04-27 10:41:50 +01:00
Sadashiva Neelavara
59b8552ac0 Fix to remove CEA-608 caption stuck on screen with timeout
This changes fixes issue #7181.  Removing CEA-608 captions that timeout after 16 seconds without a
clear.
2020-04-27 10:41:50 +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
bachinger
1323dd63d5 Remove Sample from SampleChooserActivity
Unmarshal from json to MediaItem instead of Sample. Further the playlist
of MediaItems is converted to Intent extras which are read by the
PlayerActivity.

PiperOrigin-RevId: 308141231
2020-04-27 10:41:33 +01:00
krocard
7c3b461b64 Make DefaultAudioSink.getFramesPerEncodedSample endianness independent
While most ExoPlayer code parsing ByteBuffers is called with buffers in big
endian, in certain situation, buffers in little endian are used too.

MediaCodec produced ByteBuffers are in little endian, while buffers
receive from the sources are in big endian (ByteBuffer's default).

As a result, some code called from AudioSink in passthrough parsed
bytebuffer in little endian. This is not correct because those
format are specified in BigEndian.

Changing the endianness of the ByteBuffer returned from MediaCodec
would impact a lot more code that can currently be tested in the
current COVID lockdown situation.

As a result, this patch instead make the parsing code independent
of the ByteBuffer.order() set. All the code that is called from
DefaultAudioSink now parses the buffer explicitly in Big Endian.

Additionally, the MPEG big endian header data of size 4 bytes was
retrieved with ByteBuffer.get, which only returns one byte.

PiperOrigin-RevId: 308116173
2020-04-27 10:41:33 +01:00
krocard
d01d0cfd4b Define a interface type for Aac object type.
PiperOrigin-RevId: 308115863
2020-04-27 10:41:33 +01:00
tonihei
e250fe6277 Make sure not to create new playback sessions while still IDLE.
The first session should only be created once we have the media items
and/or called prepare. Otherwise the first session is created with
an EventTime having an empty timeline making it less useful.

issue:#7193
PiperOrigin-RevId: 308100555
2020-04-27 10:41:33 +01:00
olly
63db847bf6 Make download progress updates thread safe
Issue: #5978
PiperOrigin-RevId: 308076851
2020-04-27 10:41:33 +01:00
aquilescanta
25f17acd21 Move LoadEventInfo creation to the caller
LoadEventInfo needs to also be sent to the LoadErrorHandlingPolicy.

PiperOrigin-RevId: 308066998
2020-04-27 10:41:33 +01:00
ibaker
a042346102 Reshuffle the way listeners are attached to MediaSources
This better supports custom listener types defined by MediaSource
subclasses.

Part of issue:#6765

PiperOrigin-RevId: 308050575
2020-04-27 10:40:01 +01:00
olly
84faa1ae3f SegmentDownloader cleanup
This is just some trivial cleanup to get things into a better state to
implement parallel segment downloads.

Issue: #5978
PiperOrigin-RevId: 308041996
2020-04-27 10:40:01 +01:00
aquilescanta
17fff2d0f4 Fix AdsMediaSource parameter when reporting load error
PiperOrigin-RevId: 308041841
2020-04-27 10:40:01 +01:00
olly
c452d6dfc2 Remove deprecated LoadControl method
PiperOrigin-RevId: 308031992
2020-04-27 10:40:01 +01:00
bachinger
1699ab0d18 Add missing nullable annotations
The MediaSessionConnector gets a Bundle passed to the MediaSession.Callback
from the framework which can be null. This needs to be properly annotated
with @Nullable.

Issue: #7234
PiperOrigin-RevId: 307822764
2020-04-27 10:40:01 +01:00
olly
cd828e5c10 Plumb an ExecutorService into Downloader implementations
Issue: #5978
PiperOrigin-RevId: 307819608
2020-04-27 10:40:01 +01:00
samrobinson
37f0ff925a Improve Format propagation within the MediaCodecRenderer.
Handles pixel aspect ratio changes in playlists where video
resolution does not change.

Issue:#6646
PiperOrigin-RevId: 307817028
2020-04-27 10:40:01 +01:00
aquilescanta
5d3230d85a Add test for TS with h264 and DTS audio
PiperOrigin-RevId: 307789384
2020-04-27 10:40:01 +01:00
ibaker
11c24ac3e7 Split {Amr,Ogg}ExtractorTest into parameterized & non-parameterized
This avoids the non-parameterized tests being run repeatedly for every
combination of parameters.

PiperOrigin-RevId: 307785770
2020-04-27 10:40:01 +01:00
ibaker
cfa8e19f77 Use parameterization in most extractor tests
Part of what makes these tests hard to deal with (imo) is being
unable to easily run a specific config, or seeing exactly which one
failed (because you always see only the first failure).

I put the parameters as a method on ExtractorAsserts to
reduce the boiler-plate required in each test class.

I'll migrate the extension FlacExtractorTest in a follow-up CL

PiperOrigin-RevId: 307785380
2020-04-27 10:40:01 +01:00
aquilescanta
1b6a32f25a Add test for TsExtractor's FLAG_DETECT_ACCESS_UNITS
PiperOrigin-RevId: 307777265
2020-04-27 10:40:01 +01:00
tonihei
29392d2689 Make some TtmlDecoder methods static.
PiperOrigin-RevId: 307776363
2020-04-27 10:40:01 +01:00
tonihei
1031dae19b Change some annotations placement Checkerframework now warns about.
PiperOrigin-RevId: 307764457
2020-04-27 10:39:34 +01:00
olly
6f2891e5c4 Remove usages of deprecated CacheDataSourceFactory
PiperOrigin-RevId: 307684243
2020-04-27 10:39:34 +01:00
olly
4abaaf138c Remove DownloadConstructorHelper
Something that helps a constructor always seemed a bit strange.
It's now possible to use CacheDataSource.Factory directly instead.

PiperOrigin-RevId: 307661930
2020-04-27 10:39:34 +01:00
olly
722a5b2279 Move PriorityTaskManager inside CacheDataSource
In the same way it made sense to tie CacheKeyFactory and CacheDataSource
together in
7ea83d7167,
it makes sense to tie the PriorityTaskManager to the CacheDataSource as
well. This prevents error prone scenarios where one can end up being
passed around without (or with the wrong instance of) the other.

This change also internalizes use of PriorityDataSource directly into
CacheDataSource, rather than requiring the caller to chain things
themselves.

PiperOrigin-RevId: 307647290
2020-04-27 10:38:46 +01:00
olly
fab8087472 Sanitize CacheDataSource/CacheDataSink factories
PiperOrigin-RevId: 307636959
2020-04-27 10:19:33 +01:00
tonihei
96ccb893f2 Fix timestamp rounding error in fMP4 extractor.
The sample timestamps are currently rounded to milliseconds, only to
be multiplied by 1000 later. This causes rounding errors where the sample
timestamps don't match the timestamps in the seek table (which are already
in microseconds).

issue:#7086
PiperOrigin-RevId: 307630559
2020-04-27 10:19:23 +01:00
aquilescanta
7839955f31 Separate encryption data into a new TrackOutput method
Allows media parser to populate crypto data.

PiperOrigin-RevId: 307616083
2020-04-27 10:19:13 +01:00
olly
1ab5923f27 Fix nullness checker warnings
PiperOrigin-RevId: 307570994
2020-04-27 10:19:03 +01:00
gyumin
118f0b3938 Prevent StreamVolumeManager from being released twice
PiperOrigin-RevId: 307534335
2020-04-27 10:18:52 +01:00
bachinger
628234fd1f Read media items from intent
PiperOrigin-RevId: 307442976
2020-04-27 10:18:41 +01:00
ibaker
6a36574af3 Use anti-aliasing and bitmap filtering for bitmap subtitles
issue:#6950
PiperOrigin-RevId: 307411067
2020-04-27 10:18:31 +01:00
bachinger
8d0d31e15c Add key set id to MediaItem
PiperOrigin-RevId: 307390673
2020-04-27 10:18:20 +01:00
olly
cb51a1bfe6 Fix H265Reader to correctly output SEI and AUD NAL units
Issue: #7113
PiperOrigin-RevId: 307380133
2020-04-20 13:30:02 +01:00