5060 Commits

Author SHA1 Message Date
olly
0989f272f2 Fix "FLAC decoder input buffer too small" issue
Issue: #3514

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190752950
2018-03-29 13:32:05 +01:00
tonihei
11dbe6d04b Update Ffmpeg README with supported NDK versions disclaimer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190751660
2018-03-29 13:30:24 +01:00
andrewlewis
6dcfe57fd3 Add SilenceSkippingAudioProcessor
This uses a simple threshold-based algorithm for classifying audio frames as
silent, and removes silences from input audio that last longer than a given
duration.

The plan is to expose this functionality via PlaybackParameters in a later
change.

Issue: #2635

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190737027
2018-03-29 13:28:42 +01:00
olly
18df028ce2 Remove TrackGroups from TrackSelectorResult
They don't really belong there; it was basically a convenience
thing where one of the arguments to the track selector was being
packaged up in the result to avoid having to hold a separate
reference to it.

This change is being made as a precursor to a subsequent change
where creating the TrackSelectorResult will move from
MappingTrackSelector to DefaultTrackSelector. DefaultTrackSelector
doesn't currently have access to the un-mapped tracks, and so is
unable to create a TrackSelectorResult. It's IMO preferable to
keep it that way rather than passing them down just so they can
be included in the result.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190640594
2018-03-28 01:04:56 +01:00
olly
0a4ea1cd3e Make DefaultTrackSelector.Parameters parcelable
Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190635670
2018-03-28 01:01:55 +01:00
hoangtc
13592dfb53 Update Gradle version from 4.1 to 4.4
In Gradle 4.4, it is a bug to resolve a configuration before the lint task is
created ([see [] Therefore, to upgrade
gradle version, we need to change the "generateJavadoc" task to remove using
files() call during initialization phase, but change move this to doFirst()
instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190634090
2018-03-28 01:00:17 +01:00
byungh
82b72c9358 Automated g4 rollback of changelist 189570277.
*** Reason for rollback ***

causes b/76391022, motion still playback in Photos is broken

*** Original change description ***

Used fixed time frame in clipping media period.

Currently, whenever the clipping is updated, we move the time frame of the
clipped period to start at 0. This causes problems when we are already playing
this period and the renderer position does no longer match the stream
positions.

This change keeps the time frame of the clipped media period as it is and
instead specifies the offset of the window in the period.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190628272
2018-03-28 00:58:38 +01:00
aquilescanta
74b7b90555 Propagate non-MediaSource-preparation playlist load errors through HlsChunkSource
Erroneous condition:
===================
If the track selection contains a subset of the available variants in the
master playlist, but only the selected variants return 404, the playlist
tracker will never propagate the error.

Fix:
====
The Chunk source will propagate the playlist load error if no more
alternative playlists are available (because all are already blacklisted).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190624484
2018-03-28 00:57:01 +01:00
aquilescanta
71e5b2c073 Assume TS when the HLS segment URI has no path
Issue:#4033

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190603518
2018-03-28 00:55:19 +01:00
eguven
5925f92482 Persist content redirected URI in CacheDataSource
Issue: #2360

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190597773
2018-03-28 00:53:40 +01:00
aquilescanta
f0bb6bb263 Make MediaPeriod implementations compliant with its specification
Currently, MediaPeriod states that continueLoading may be called
during preparation. Some implementations would throw an error if
this happened.

Also make MediaPeriod documentation clearer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190596870
2018-03-28 00:52:04 +01:00
aquilescanta
b7c4a117fa Escape 💨 emoji in RELEASENOTES
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190591835
2018-03-28 00:50:15 +01:00
andrewlewis
6cb07adcee Fix handling of timestamps before play()
If the AudioTimestamp was sampled before play() was called, it was incorrectly
returned to the caller for sanity-checking. Fix this behavior by dropping the
timestamp internally in the AudioTimestampPoller.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190584412
2018-03-28 00:48:35 +01:00
olly
eb34a2a102 Improve DASH/SS seek performance
This change enables feeding decoders from the closest sync frame
before a specified seek position, where-as previously we'd
always feed decoders from the start of the chunk. This avoids
decoding and discarding many audio samples during each seek. The
same benefit also applies to video chunks containing more than
one key-frame.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190539547
2018-03-28 00:46:49 +01:00
olly
f7cd9f7d1d Seek to sync frame within moof in FragmentedMp4Extractor
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190498206
2018-03-28 00:44:54 +01:00
tonihei
3cbe91a3b0 Pass DrmSessionManager through SimpleExoPlayer.
This will allow SimpleExoPlayer to auto-register its own listener before the
drm session manager is used to set-up the renderers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190478174
2018-03-28 00:43:07 +01:00
tonihei
6c0d676050 Add callbacks for media period life cycle.
This adds callbacks for creating, releasing, and starting to read from media
periods.

Such events allow listeners to keep a list of active media periods. This is
useful to determine when no further events for a certain media period are
expected. It also allows listeners to associate renderer events unambigiously
with a reading media period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190462717
2018-03-28 00:41:29 +01:00
eguven
2a85e792f8 Rename Cache getContentMetadataSnapshot to getContentMetadata
And in ContentMetadata javadoc emphasize that it's a snapshot.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190461436
2018-03-28 00:39:51 +01:00
tonihei
eb84b144bf Move window index and media period id out of MediaLoadData again.
This gives the MediaSourceEventListener API a consistent look when new methods are
added which only have a window index and media period id.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190450270
2018-03-28 00:38:09 +01:00
olly
dfe4bfba03 Trim zero padding from EBML string values
Issue #4010

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190442962
2018-03-28 00:36:24 +01:00
tonihei
40947d52f0 Support multiple DefaultDrmSessionManager listeners.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190236842
2018-03-28 00:34:25 +01:00
aquilescanta
416e05f58c Fix exception message
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190215051
2018-03-28 00:32:42 +01:00
tonihei
432d746d82 Remove default 60sec renderer offset.
This was only needed to ensure a ClippingMediaSource can provide samples from
a key frame before the clipping start time. Now the ClippingMediaSource will
not report negative timestamps, this workaround can be removed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190045302
2018-03-28 00:28:59 +01:00
olly
391a99974e Fix hypothetical issue with encrypted CEA608
This will never happen in practice, since CEA608 shouldn't be encrypted (and we
can't handle it if it is), but in theory appendSampleEncryptionData can be called,
then skipFully can throw when applying the CEA608 transformation, then when
retrying appendSampleEncryptionData will be called again for the same sample.
appendSampleEncryptionData consumes from trackFragment.sampleEncryptionData, and
so the second time around data is being consumed one sample ahead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189931631
2018-03-28 00:27:13 +01:00
tonihei
7095a14db6 Remove MediaSourceEventListener base class from AdsMediaSource.EventListener
The ad events are independent of the other media source events. Also,
registering the listener to the internal ad media sources will report the
regular media source events twice: once directly (with a non-ad media period
id) and once through the wrapping ads source (with the correct ad media period
id).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189905561
2018-03-28 00:25:38 +01:00
aquilescanta
35460dc735 Add santoni and mido to codecNeedsSetOutputSurfaceWorkaround
Issue:#4006

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189896023
2018-03-28 00:24:01 +01:00
eguven
522f8c8a99 Make demo app play content from download cache
It's inserted before HttpDataSource as read only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189815245
2018-03-28 00:22:15 +01:00
eguven
764d18f68f Add ability to play filtered manifests in PlayerActivity
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189796293
2018-03-28 00:20:27 +01:00
cblay
dfa31f02e3 DashMediaSource: Do not use TIME_UNSET publishTime to check for stale dynamic manifest
Also convert left side from milliseconds to microseconds for comparison

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189784833
2018-03-28 00:19:07 +01:00
andrewlewis
c9d827fa2c Poll the audio timestamp more frequently at the start of playback
Add logic to poll AudioTimestamp at different rates depending on when
playback starts and how the audio timestamp advances.

This fixes a pause about 500 ms after starting playback that occurs on some
devices and also makes our polling interval match the recommendations of the
AudioTrack documentation.

Issue: #3830
Issue: #3841

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189765200
2018-03-28 00:16:26 +01:00
tonihei
95d591e0ce Handle default position in DeferredMediaPeriod.
When creating DeferredMediaPeriods, we don't know the actual timeline yet and
thus the default position is also unknown. We can still forward the correct
default position by forwarding it the deferred media period as soon as it
becomes known.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189763460
2018-03-28 00:15:01 +01:00
bachinger
6674f63b8b Omit fast forward and rewind actions when current window is not seekable
Issue: #4001

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189722812
2018-03-28 00:12:21 +01:00
andrewlewis
aad5927a2b Update audio renderer position before pausing
As part of pausing DefaultAudioSink, its position-related fields are reset. If
the audio timestamp API was in use, this results in falling back to the
getPlaybackHeadPosition API, which (on some devices) can lead to a jump in the
reported position.

Sample the position before pausing instead of after, to avoid this jump.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189713376
2018-03-28 00:11:01 +01:00
andrewlewis
99959d6130 Fix handling of getLatency throwing
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189582319
2018-03-28 00:08:17 +01:00
tonihei
e3a90a44b7 Support media source events for composite media sources.
This is achieved by automatically registering a listener for child sources in
compositions. The composite media source has the chance to correct the
reported window index and media period id in the MediaLoadData of the events.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189575414
2018-03-28 00:06:58 +01:00
tonihei
6b527da462 Used fixed time frame in clipping media period.
Currently, whenever the clipping is updated, we move the time frame of the
clipped period to start at 0. This causes problems when we are already playing
this period and the renderer position does no longer match the stream
positions.

This change keeps the time frame of the clipped media period as it is and
instead specifies the offset of the window in the period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189570277
2018-03-28 00:05:35 +01:00
eguven
371f3acea8 Prevent multiple instances of SimpleCache in the same folder
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189562865
2018-03-28 00:04:14 +01:00
andrewlewis
245c59cecc Factor out position tracking from DefaultAudioSink
DefaultAudioSink had a lot of code related to tracking the position of the
underlying AudioTrack, and working around issues with the position APIs.

Move this code to a separate class responsible for position tracking. This is in
preparation for improving the audio timestamp polling behavior.

This change is intended not to cause any behavior changes.

Issue: #3841

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189344743
2018-03-28 00:02:54 +01:00
aquilescanta
137d70b092 Clear fatal errors in Loader#startLoading
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189323050
2018-03-28 00:00:11 +01:00
tonihei
c7c9a1e9e4 Send media source events for fake media sources.
This allows to test sending events when using fake media sources.
The FakeMediaSource now simulates a manifest load when being prepared.
And the FakeMediaPeriod simulates a media load when being prepared.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189205285
2018-03-27 23:58:52 +01:00
andrewlewis
bb72d9eb6a Upgrade bintray
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189188071
2018-03-27 23:57:29 +01:00
eguven
d9f2989c9e Add getContentMetadata and applyContentMetadataMutations to Cache interface
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189186679
2018-03-27 23:56:08 +01:00
andrewlewis
234d611175 Automated g4 rollback of changelist 189153913.
*** Reason for rollback ***

This is breaking gradle sync with an error "Error:Cannot create variant 'android-lint' after configuration ':exo-library-core:debugRuntimeElements' has been resolved".

*** Original change description ***

Upgrade bintray-release and gradle versions

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189171139
2018-03-27 23:54:45 +01:00
eguven
bb71b050c9 Add getContentMetadata and applyContentMetadataMutations to SimpleCache
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189169899
2018-03-27 23:53:23 +01:00
eguven
10a48e778e Make CachedContent serialize whole metadata
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189166039
2018-03-27 23:51:56 +01:00
hoangtc
42d7a319cd Match codecs starting with "mp4a" to different Audio MimeTypes
Currently, we are treating all codecs starting with "mp4a" as AAC. However,
some codec strings starting with "mp4a" are not AAC format, as should be
treated differently.

GitHub: #3779

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189163517
2018-03-27 23:50:31 +01:00
andrewlewis
db0d656932 Consolidate position-related error handling in DefaultAudioSink
This is a step towards factoring out position tracking functionality.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189155624
2018-03-27 23:49:03 +01:00
olly
405d39b518 Upgrade bintray-release and gradle versions
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189153913
2018-03-27 23:47:32 +01:00
andrewlewis
e6ce6764d7 Clean up DefaultAudioSink
This is a first step towards factoring out position tracking functionality.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189027731
2018-03-27 23:46:04 +01:00
olly
0b182d1849 Remove versions from IMA demo manifest that are now specified via gradle
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189000217
2018-03-27 23:44:38 +01:00