4334 Commits

Author SHA1 Message Date
Oliver Woodman
3b5e8ada31 Merge pull request #5355 from zsmatyas:dev-v2
PiperOrigin-RevId: 229364147
2019-01-15 15:03:24 +00:00
tonihei
b97b35e2e0 Add buffer flag for last sample to improve buffered position calculation.
The buffered position is currently based on the mimimum queued timestamp of
all AV tracks. If the tracks have unequal lengths, one track continues loading
without bounds as the "buffered position" will always stay at the shorter
track's duration.

This change adds an optional buffer flag to mark the last sample of the
stream. This is set in the Mp4Extractor only so far. ExtractorMediaSource
uses this flag to ignore AV streams in the buffered duration calculation if
they already finished loading.

Issue:#3670
PiperOrigin-RevId: 229359899
2019-01-15 14:29:07 +00:00
tonihei
fcda01eb5c Remove messages on release of ConcatenatingMediaSource.
That was previously handled by the player. But since we switched to Handler
messages instead of player messages, we should do that manually.

PiperOrigin-RevId: 229341747
2019-01-15 14:28:56 +00:00
tonihei
1900e94144 Do not select a track in AdaptiveTrackSelection constructor.
This is not necessary as the track selection needs to be updated with
updateSelectedTrack anyway. It's also error-prone as the selection code
calls into a protected method of a not fully initialized class.

PiperOrigin-RevId: 229331669
2019-01-15 14:28:46 +00:00
olly
9ab08bbe5d Fix DRM protected SmoothStreaming with subtitles
Issue: #5378
PiperOrigin-RevId: 229261658
2019-01-14 23:58:45 +00:00
olly
0bfbcea632 Reset requiresSecureDecoder boolean on codec release
PiperOrigin-RevId: 229253065
2019-01-14 23:58:35 +00:00
olly
1b62277a0b Disable cache fragmentation except for progressive
DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION is added to indicate to the
cache when fragmentation is allowed. This flag is set for progressive
requests only.

To avoid breaking changes, CacheDataSink defaults to ignoring the flag
(and enabling fragmentation) for now. Respecting the flag can be
enabled manually. DownloaderConstructorHelper enables respecting of
the flag.

Issue: #4253
PiperOrigin-RevId: 229176835
2019-01-14 23:58:25 +00:00
tonihei
86637facdd Don't forget isSeekable in ExtractorMediaSource.
We currently forget whether a source is seekable at re-preparation. This was
implemented intentionally this way under the assumption that we really can't seek
until we have loaded the seek map again. However, seek operations are only
allowed after a media period is prepared. So there is no harm in remembering
whether a source is seekable.

This problem currently prevents reusing ClippingMediaSources with
ExtractorMediaSource and a non-zero start clip position.

Issue: #5351
PiperOrigin-RevId: 229169441
2019-01-14 23:58:15 +00:00
andrewlewis
f44fc542bb Blacklist OMX.SEC.mp3.dec for more devices
Issue: #4519
PiperOrigin-RevId: 229145790
2019-01-14 23:58:05 +00:00
olly
1f03093dc5 DRM: Pass sessionId rather than MediaCrypto
ExoMediaCrypto.requiresSecureDecoderComponent() is removed, and
FrameworkMediaCrypto.forceAllowInsecureDecoderComponents is made
public to allow determining whether a secure decoder is required
to be implemented in MediaCodecRenderer.

PiperOrigin-RevId: 228909771
2019-01-14 23:57:55 +00:00
olly
2d30d66746 Fix release of DRM sessions
There were some edge cases in which we'd forget to release DRM
sessions. For example if we read a format and acquired a
pendingDrmSession (in onInputFormatChanged), then immediately
read another format and overwrote pendingDrmSession, we'd
forget to release the one that's been overwritten.

This change hopefully makes release much clearer. We keep a list
of all drm sessions we're currently holding. Whenever we update
either drmSession or pendingDrmSession, we release any other
sessions that are in the list.

PiperOrigin-RevId: 228905465
2019-01-14 23:57:45 +00:00
eguven
71d4f39400 Call Listener methods on the thread started RequirementsWatcher
PiperOrigin-RevId: 228701917
2019-01-14 23:57:34 +00:00
eguven
92bec21c03 Add DownloadIndex and DefaultDownloadIndex
DownloadIndex will be used to store and query DownloadStates.

PiperOrigin-RevId: 228673766
2019-01-14 23:57:24 +00:00
tonihei
637b52ae0e Add missing call to timeline.getWindow.
The window object is used without being filled with data. This used to work
well for most cases as the same live stream is sending regular updates and the
first update is almost never used if it's not the first item in a playlist.

It causes problems when the first timeline update of a live stream is actually
used for playback (e.g. when the live stream is lazily prepared in a playlist
and played first).

PiperOrigin-RevId: 228530232
2019-01-14 23:57:14 +00:00
Zsolt Matyas
fff602358f CEA608: Limiting duplicated command checks to immediate frames
Reported in https://github.com/google/ExoPlayer/issues/3860
For failing examples see the github link above.

[Problem]
We drop matching control codes even if they are not received on
consecutive frames.

The specification says
"(4) If the first transmission of a control code pair passes parity,
it is acted upon within one video frame. If the NEXT frame contains
a perfect repeat of the same pair, the redundant code is ignored."

Keyword is the NEXT. The frames must arrive immediately after
each other.

See https://www.law.cornell.edu/cfr/text/47/79.101

[Solution]
Set an additional flag when any data is processed. Control code
duplication checks should be limited only for the first control
byte pairs processed after any control code.

[Test]
Sarnoff tests have equivalent CEA708 and CEA608 Streams.
2019-01-10 12:15:14 -08:00
Oliver Woodman
e0c6f538af Merge pull request #5201 from zsmatyas:dev-v2
PiperOrigin-RevId: 228341073
2019-01-08 17:17:59 +00:00
eguven
0b56a03880 Use stop flag to prevent download start when not initialization/released
PiperOrigin-RevId: 228324452
2019-01-08 17:17:47 +00:00
olly
255a34d367 Noop cleanup of Cea608Decoder.CueBuilder
PiperOrigin-RevId: 228309236
2019-01-08 17:17:37 +00:00
olly
6e127d0152 SimpleCache: Scan sub-directories during initialization
This is the initialization part of mitigating issue #4253. The
remaining work is on the writing side, and is simply a case of
having startFile return File instances that are sharded into
sub-directories. We still need to decide what scheme we want
to use for doing that.

Issue: #4253
PiperOrigin-RevId: 228306327
2019-01-08 17:17:27 +00:00
olly
194caf23e5 Doc fix.
PiperOrigin-RevId: 228296962
2019-01-08 17:17:16 +00:00
olly
8c47b02083 Reduce number of calls to File.length()
Calls to File.length() can be O(N) where N is the number of files
in the containing folder. This is believed to be true for at least
FAT32. Repeated calls for the same file tend to be faster,
presumably due to caching in the file system, however are still
surprisingly expensive. Hence minimizing the number of calls is
preferable.

Issue: #4253
PiperOrigin-RevId: 228179921
2019-01-08 07:38:31 +00:00
aquilescanta
be69d5b747 Expand check for muxed audio media tags to include uris that match variants
Issue:#5313
PiperOrigin-RevId: 228155222
2019-01-08 07:38:21 +00:00
aquilescanta
147deafd01 Increase search size in mp4 sniffing once moov has been found
Issue:#5320
PiperOrigin-RevId: 228142567
2019-01-08 07:38:11 +00:00
tonihei
e8a7cb2546 Remove player and isTopLevelSource parameters from MediaSource.prepare.
They are not longer needed anywhere, are error-prone (because of threading
requirements), and complicate testing and using MediaSources without a player.

PiperOrigin-RevId: 227871157
2019-01-08 07:38:00 +00:00
tonihei
6828797555 Pass Handler together with Runnable callbacks for playlist commands.
We currently either use the app thread returned by the player or the thread
the commands are called on depending on whether the media source is already
prepared or not.

This change lets the application decide which callback thread to use. As a
side effect, we also don't longer need access the player instance passed to
MediaSource.prepare.

PiperOrigin-RevId: 227871111
2019-01-08 07:37:50 +00:00
andrewlewis
14027bc98e Treat AVERROR_INVALIDDATA as non-fatal
Also configure the FFmpeg context to ignore errors as far as possible (this
appears to have an effect only for certain decoders).

Issue: #5293
PiperOrigin-RevId: 227851397
2019-01-08 07:37:30 +00:00
andrewlewis
5efbcb4443 Fix nullness issue
PiperOrigin-RevId: 227822937
2019-01-08 07:37:13 +00:00
andrewlewis
ed1f41db1b Parse frame rate from 'mdta' metadata
PiperOrigin-RevId: 227813461
2019-01-08 07:37:01 +00:00
aquilescanta
d30375c9a1 Prevent IllegalStateException in Mp4 sniffing
If a negative value is read, sniffing should just fail.

PiperOrigin-RevId: 227689568
2019-01-08 07:34:33 +00:00
eguven
781ba39097 Disabled test case due to flakiness
PiperOrigin-RevId: 227682600
2019-01-08 07:34:24 +00:00
eguven
a940d8bc9d Use removing and restarting state internally in DownloadManager
PiperOrigin-RevId: 227682159
2019-01-08 07:34:14 +00:00
tonihei
c130723929 Replace isTopLevelSource check by period count check in AdsMediaSource.
The top level requirement only tried to ensure that the entire timeline only
has one period. This is already asserted by ImaAdsLoader. AdsMediaSource
itself works fine as long as the wrapped timeline has one period only. This
is now asserted instead.

PiperOrigin-RevId: 227682141
2019-01-08 07:34:03 +00:00
tonihei
e4ad90efd0 Set Player separately in AdsLoader interface.
Passing the player through MediaSource.prepare is only needed for the AdsLoader
and complicates other usages of MediaSource. Providing the player directly to
the AdsLoader is also in line with the usage pattern of PlayerView and other
components.

Also rename methods to start/stop to better reflect their usage.

PiperOrigin-RevId: 227682112
2019-01-08 07:33:52 +00:00
aquilescanta
bfc8f9c4d8 Enable setOutputSurfaceWorkaround for Huawei P10 lite
Issue:#5312
PiperOrigin-RevId: 227673949
2019-01-08 07:33:42 +00:00
aquilescanta
7f266ceb33 Fix bug when calculating EOF position in mp4 sniffing
PiperOrigin-RevId: 227668426
2019-01-08 07:33:32 +00:00
eguven
7ae768376c Prepare DownloadState for upcoming changes
Made DownloadState top level class.
Replaced action field DownloadAction fields.
Added removing, removed and restarting states.
Renamed started state to downloading.

PiperOrigin-RevId: 227664735
2019-01-08 07:33:23 +00:00
tonihei
803b878a8a Use Handler instead of ExoPlayer messages in ConcatenatingMediaSource
ExoPlayer methods must not be called from any thread besides the specified
app thread. Therefore we shouldn't use them here. Using a regular Handler
instead is fully equivalent.

Issue:#5240
PiperOrigin-RevId: 227650489
2019-01-08 07:33:13 +00:00
andrewlewis
440824ae5c Fix replacement char check
PiperOrigin-RevId: 227646358
2019-01-08 07:33:01 +00:00
olly
0ed7ddecd7 Reduce the number of cache files
- Increase the default cache file size to 5MB
- Recommended a minimum cache file size of 2MB to discourage
  applications from specifying values small enough such that
  unreasonably large numbers of cache files are generated
- Allow maxCacheFileSize=C.LENGTH_UNSET, equivalent to setting it
  to MAX_VALUE. This is just for API consistency with other APIs
  we have that accept LENGTH_UNSET

Issue: #4253
PiperOrigin-RevId: 227524233
2019-01-08 07:32:51 +00:00
olly
ae65bcecd4 Move syncFileDescriptor to use an experimental method
PiperOrigin-RevId: 227520168
2019-01-08 07:32:41 +00:00
olly
3a9557c72f Don't pass maxCacheFileSize to CacheEvictor if real size is unknown
CacheEvictor.onStartFile currently receives a length, which is the
maximum size of the content that might be written. The LRU cache
evictor will make sure there's sufficient space for the specified
size. If the actual size of the content is unknown, CacheDataSink
passes maxCacheFileSize.

The current behavior isn't ideal. It seems valid for a developer to
specify maxCacheFileSize=Long.MAX_VALUE if they don't want any
file fragmentation in the cache. However if they then attempt to
cache something with unknown length, LRU cache will try and make
room for content of length Long.MAX_VALUE, and end up evicting the
entire cache to do so.

This change alters the logic so a length is only passed if the
actual size of the content is known. In other cases C.LENGTH_UNSET
is now passed. The LRU evictor will not evict until after the file
is committed. Note a custom LRU evictor could still opt to evict to
ensure some application specified amount of space, if that's the
desired behavior.

PiperOrigin-RevId: 227509525
2019-01-08 07:32:21 +00:00
andrewlewis
fc6a1ea522 Handle rectangular rotation projections in Matroska
See also https://github.com/Matroska-Org/matroska-specification/issues/269.

PiperOrigin-RevId: 226758584
2019-01-08 07:31:59 +00:00
tonihei
9728ac54ba Improve doc for setKeepContentOnPlayerReset.
This also applies when seeking or transitioning to unprepared media, which
isn't clear from the current documentation.

Issue:#5267
PiperOrigin-RevId: 226486685
2019-01-08 07:31:49 +00:00
eguven
3c0107752a Add STOPPED state to DownloadManager
PiperOrigin-RevId: 226460891
2019-01-08 07:31:39 +00:00
olly
f4d741a565 Bump for 2.9.3
PiperOrigin-RevId: 226356810
2018-12-20 21:14:04 +00:00
olly
a16f4aec90 Fix out of data Javadoc
PiperOrigin-RevId: 226356758
2018-12-20 21:13:52 +00:00
andrewlewis
d3ecbf75b2 Fix buffer size for renderers with TRACK_TYPE_NONE
This includes NoSampleRenderers.

PiperOrigin-RevId: 226323693
2018-12-20 21:13:42 +00:00
andrewlewis
bad8ec5952 Relax audio decoder capability checks
Issue: #5145
PiperOrigin-RevId: 226297129
2018-12-20 12:44:18 +00:00
olly
4f8b098307 Blacklist OMX.SEC.mp3.dec for more devices
Issue #4519

PiperOrigin-RevId: 226205245
2018-12-19 21:29:27 +00:00
Oliver Woodman
be2636c365 Merge pull request #4993 from saschpe:icy
PiperOrigin-RevId: 226031838
2018-12-18 19:46:54 +00:00