3041 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
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
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
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
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
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
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
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
ibaker
eb8c174b4c Update WebVttCueParser to parse position alignment values
Currently we assume these are "start", "center", "middle" or "end",
which was correct in a previous draft of the spec:
https://www.w3.org/TR/2014/WD-webvtt1-20141111/#dfn-webvtt-text-position-cue-setting

The released spec uses "line-left", "center" and "line-right":
https://www.w3.org/TR/webvtt1/#webvtt-position-cue-setting

PiperOrigin-RevId: 307371066
2020-04-20 13:29:44 +01:00
andrewlewis
ccdd1a43c2 Fix AdsMediaSource child sources not being released
Also add unit tests for AdsMediaSource.

PiperOrigin-RevId: 307365492
2020-04-20 13:29:23 +01:00
andrewlewis
02af670a0f Fix gapless playback
Audio processors are now flushed twice after reconfiguration.
The second flush call cleared the pending trim start bytes so
transitions between tracks were no longer gapless.

Fix this by removing logic to clear pending trim bytes on flush.
As a result we may trim data incorrectly if there is a flush
before any data has been handled for seeking to a non-zero
position, but this edge case will happen rarely and the effect
shouldn't be noticeable.

PiperOrigin-RevId: 307344357
2020-04-20 13:29:14 +01:00
bachinger
8ea33e2315 Support ad tag with default media source
This is the missing attribute to support all features of the Sample with MediaItem. Hence PlayerActivity can use the setMediaItems() method directly without creating actual media sources in the app code.

PiperOrigin-RevId: 307102036
2020-04-20 13:28:56 +01:00
olly
7ea83d7167 Better tie injection of Cache/CacheDataSource/CacheKeyFactory
PiperOrigin-RevId: 307056661
2020-04-20 13:28:38 +01:00
Oliver Woodman
704993ce7c Merge pull request #7210 from nebyan:CacheKeyFactoryNotUsed
PiperOrigin-RevId: 307045655
2020-04-20 13:28:27 +01:00
tonihei
7350981ef9 Use higher level interface for method parameters where possible.
This makes it easier to use the helper methods because the player doesn't
have to be assigned to a SimpleExoPlayer in all cases.

PiperOrigin-RevId: 307039126
2020-04-20 13:28:16 +01:00
ibaker
ece8d22357 Remove a suppression introduced by the checker-framework 3.3.0 upgrade
Update the comment on a suppression of Field.get(null) which is safe
but blocked by the checker.

These suppressions were introduced in d1e0572448

PiperOrigin-RevId: 307036441
2020-04-20 13:28:07 +01:00
tonihei
ca2105d50c Wait with throwing stuck buffering error until pending load is finished
We currently check for shouldContinueLoading, which is the intention to load,
not playbackInfo.isLoading, which is the actual loading state, when detecting
stuck buffering issues.

They only differ if the LoadControl said stop loading (based on nextLoadPosition),
but there is still a load in flight (updating bufferedPosition). This may cause
the exception to be thrown in edge cases that are only temporary.

PiperOrigin-RevId: 307022608
2020-04-20 13:27:57 +01:00
bachinger
abadc76872 Merge pull request #7245 from Clement-Jean:silence-media-source-factory
PiperOrigin-RevId: 307010600
2020-04-17 10:44:42 +01:00
andrewlewis
efaa98eecf Fix TeeAudioProcessor sink configuration
TeeAudioProcessor needs to configure its sink when it is initially set up.

PiperOrigin-RevId: 306808871
2020-04-17 10:44:24 +01:00
bachinger
d7280f096f Add custom cache key to media item
This is required to migrate the PlayerActivity away from Sample to MediaItem. It hence needs adding buildUpon to MediaItem to mix in the customCacheKey and streamKeys before playback.

PiperOrigin-RevId: 306710643
2020-04-17 10:44:16 +01:00
Clement Jean
3c655981d4 Add tag and Factory to SilenceMediaSource 2020-04-16 22:28:48 +08:00
christosts
91690f06ed Add Clock#currentTimeMillis()
PiperOrigin-RevId: 306602043
2020-04-15 17:42:19 +01:00
tonihei
823419761f Allow custom playback session id generator.
This allows users to inject their own session id logic.

PiperOrigin-RevId: 306597785
2020-04-15 17:42:19 +01:00
olly
6cff8a6ad0 Don't select trick-play tracks by default
Issue: #6054
Issue: #474
PiperOrigin-RevId: 306504362
2020-04-15 17:42:18 +01:00