2731 Commits

Author SHA1 Message Date
andrewlewis
09165ab870 Rename droppedOutputBufferCount
Now this counter includes input buffers too, which are dropped as part of
skipping to keyframes for catch up.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171119930
2017-10-11 12:17:25 +01:00
andrewlewis
498ff14439 Add @IntDef annotations to DefaultEventListener
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170980737
2017-10-11 12:13:17 +01:00
andrewlewis
b3d462df39 Catch up video rendering by dropping to keyframes
If the current output buffer is very late and the playback position is in a
later group of pictures, drop all buffers to the keyframe preceding the
playback position.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170975259
2017-10-11 12:11:58 +01:00
tonihei
5baddfb56a Add onSeekProcessed callback to Player interface.
This is useful to determine when a seek request was processed by the player
and all playback state changes (mostly to BUFFERING) have been performed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170826793
2017-10-11 12:07:54 +01:00
olly
1495b9a473 Fix stuck playback when media has uneven track end times
* Always assume a renderer is ready if it's read to the end of
  its current stream and there's a subsequent period already
  prepared. This prevents getting stuck when a non-clock renderer
  has a short stream.
* Switch to the standalone clock if the renderer providing the
  media clock has read to the end of its current stream, is no
  longer ready, and there's a subsequent period already prepared.
  This prevents getting stuck when a clock renderer has a short
  stream.
* Remove unnecessary clock synchronization logic (since it would
  need to be made more complicated as a result of this change).
* Don't update the playing period holder when playWhenReady is
  false. This avoids the position jumping to the start of the
  next period when seeking to the very end of the current period
  whilst paused (we still end up showing the first frame of video
  from the next period, but fixing that will have to wait).

Github: #1874

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170717481
2017-10-03 08:58:25 +01:00
olly
fd576d2189 Smoother PlaybackControlView updates when speed != 1
* If speed <= 0.1, update every second.
* If 0.1 < speed < 1, update approximately once per
  second in real time, aligned so that each second boundary
  in media time has a corresponding updatae.
* If speed == 1, keep existing behavior.
* If 1 < speed <= 5, update every second in media time
* If speed > 5, update every 200ms.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170559037
2017-10-03 08:55:52 +01:00
olly
a3a9c0f3b0 Sanity check current position <= written frame position
This avoids spurious position reports following an underrun.

Github: #1874

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170344399
2017-10-03 08:51:36 +01:00
andrewlewis
60de157410 Add a few initial tests for SimpleDecoderAudioRenderer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170318174
2017-10-03 08:48:46 +01:00
andrewlewis
9c7950f342 Add AudioSink interface and use it from audio renderers
This change allows applications to provide custom AudioSinks, which could be
based on android.media.AudioTrack like AudioTrackAudioSink, or could be
completely custom.

The refactoring is mostly mechanical and shouldn't result in any functionality
changes.

Some android.media.AudioTrack-specific details have to appear in the AudioSink
interface so this change modifies the javadoc on the AudioTrack (now AudioSink)
to note that some methods will have no effect.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170311083
2017-10-03 08:47:20 +01:00
zhihuichen
b14b3d43de Expose OnKeyStatusChange events, this is required to learn the usabilities of the keys.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170268043
2017-10-03 08:45:53 +01:00
tonihei
52de36c5eb Add abstract, default Player event listener.
This allows simplified listener implementations as most listeners
will not listen to all possible notifications.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170177821
2017-10-03 08:44:33 +01:00
olly
a3be937650 Prevent unnecessary consecutive playlist loads
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170078933
2017-09-26 19:19:57 +01:00
Oliver Woodman
792f046c02 Clean up HlsPlaylistTracker 2017-09-26 17:06:36 +01:00
ojw28
8ee6da1fe9 Merge pull request #3280 from yqritc/fix-primary-playlist-update
Fix primary hls playlist update
2017-09-26 16:54:47 +01:00
andrewlewis
06f7b6be6a Use IntDef for AudioTrack.startMediaTimeState
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169880369
2017-09-26 14:00:59 +01:00
eguven
1f8a8dbfa3 Add version number to serialized DownloadAction data
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169681768
2017-09-26 13:57:32 +01:00
aquilescanta
4fb18453e1 Add a "forceLowestBitrate" option to DefaultTrackSelector
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169668371
2017-09-26 13:56:04 +01:00
aquilescanta
25a9177ce3 Deduplicate DefaultTrackSelector javadocs
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169552239
2017-09-26 13:54:10 +01:00
hoangtc
324339b88f Tweak live-streaming track selection logic.
Follow-up on the update to ABR logic in AdaptiveTrackSelection for live
streaming case:
- Do not reset liveEdgeTimeUs when user seek to a different position.
- For HlsChunkSource, for non-independent segments, currently the
bufferedDuration calculate will subtract previousChunk's duration. So to make
it work with live-streaming ABR logic, we subtract timeToLiveEdgeUs a similar
amount to compensate for that operation.
- Minor update to DefaultSSChunkSource, only perform TrackSelection when needed
(after checking necessary conditions).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169531275
2017-09-26 13:48:23 +01:00
eguven
d71400d280 Add DashDownloadActionTest
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169522830
2017-09-26 13:45:42 +01:00
yqritc
455f9fb9f0 remove space 2017-09-21 16:01:32 +09:00
yqritc
cac16f1647 remove keep alive check for updating primary url to avoid redundant playlist loading 2017-09-21 14:18:59 +09:00
yqritc
ff2ece56dd fix primarySnapshotAccessAgeMs 2017-09-21 12:01:25 +09:00
olly
ce7aaab3c6 Handle bracket params on the end of SmoothStreaming URLs
Issue: #3230

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169421873
2017-09-20 19:29:17 +01:00
aquilescanta
6314a0ec82 Add support for Widevine encrypted HLS
This includes both cbcs and cenc. Will only work for streams that require a single
pssh.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169382884
2017-09-20 19:28:02 +01:00
olly
67567ffa6c TsExtractor: Do less work if payload reader does not exist
There's no reason to perform the discontinuity check or skip
the adaptation field if we don't have a payload reader for
the packet.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169374609
2017-09-20 11:57:47 +01:00
olly
ed76882271 Bump version + release notes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169257339
2017-09-19 18:26:05 +01:00
olly
d346266dc9 Workaround Samsung tablet reboot playing adaptive secure content
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169256059
2017-09-19 18:23:28 +01:00
olly
89f66924d5 Use IntDef for MediaCodecRenderer internal states
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169254794
2017-09-19 18:22:03 +01:00
eguven
09248608c0 Notify span listeners even if index store fails in SimpleCache.removeSpan
This fixes infinite loop in LeastRecentlyUsedCacheEvictor.evictCache when index store fails.

Also made CachedContentIndex not final so it can be mocked and added a package protected SimpleCache
constructor so mock index can be injected.

Issue: #3260

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169249517
2017-09-19 18:20:34 +01:00
eguven
8a0e148041 Workaround a cipher issue in Android 4.3
[]

Issue: #2755

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169249093
2017-09-19 18:19:08 +01:00
aquilescanta
fed2a1a6ea Fix PTS wraparound in HLS+Webvtt
Issue:#2928

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169246424
2017-09-19 18:17:43 +01:00
olly
5b0e693419 Fix DefaultDashChunkSource.updateLiveEdgeTimeUs
Very subtle, but lastAvailableSegmentNum is shifted by
RepresentationHolder.segmentNumShift. When accessing the
index directly it's necessary to unshift. The easiest way
to do this is to call through the holder, which does this
for you.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169239928
2017-09-19 18:16:18 +01:00
eguven
9bdf1ee944 Check if the cache is already empty before trying to evict more span
This case may happen if the max span size is more than the max size the
evictor is configured.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169101093
2017-09-19 18:14:54 +01:00
aquilescanta
5e2c7d967a Fix 2 CEA decoder bugs
1- Avoid dropped buffers by using a PriorityQueue instead of a set.
2- Process the end of stream after non-EOS buffers.

Issue:#3250

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169077365
2017-09-19 18:13:31 +01:00
andrewlewis
457d0ba1b9 Work around broken AAC decoders on Galaxy S6
Issue: #3249

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168844850
2017-09-15 23:49:34 +01:00
aquilescanta
6592a6474e Improve documentation for SCTE35-related metadata
Also expose break_durations in microseconds instead of 90kHz.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168816992
2017-09-15 23:47:12 +01:00
olly
a3a2fb506c Provisioning: Fix some (admittedly quite theoretical) issues:
1. Only tell sessions that want provisioning when provisioning occurs.
2. Also propagate failure to provision to these sessions.
3. If a session responsible for provisioning is released, start
   provisioning using another session instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168713918
2017-09-15 23:44:38 +01:00
olly
a479afff5f Fix potential NPE/ThreadSafety issues with MediaDrm listener
- MediaDrmEventListener.onEvent is typically called on the
  app's main thread. mediaDrmHandler is instantiated on the
  playback thread. Hence mediaDrmHandler should be volatile
  to ensure visibility.
- Nulling mediaDrmHandler could result in a NPE in onEvent.
  Instantiate mediaDrmHandler (and don't null it again) to
  avoid this. MediaDrmHandler.handleMessage will correctly
  discard any events for sessions that are now closed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168707938
2017-09-15 23:43:18 +01:00
andrewlewis
58293abc11 Remove IMA dependency and add AdsMediaSource
AdsMediaSource lives in the core library so only ImaAdsLoader remains in
the ima extension. AdsMediaSource takes an AdsLoader implementation.

ImaAdsMediaSource is deprecated rather than removed for now.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168707921
2017-09-15 23:41:59 +01:00
andrewlewis
f2aed7186e Workaround the skip ad button not being focused
Issue: #3258

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168669969
2017-09-15 23:39:19 +01:00
hoangtc
b3004ab1c3 Do not apply SampleStream skip-ahead for NoSampleRenderer.
Currently, to make transition to next media period seamless, after the renderer
has read until the end of the current SampleStream, we may send it the next
SampleStream so the renderer may read from the next SampleStream ahead of the
transition.
For NoSampleRenderer, we should avoid doing this: skipping ahead for such
renderer doesn't have any benefit (the renderer does not consume data from
SampleStream), and it will change the provided rendererOffsetUs while the
renderer is still rendering from the playing media period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168669800
2017-09-15 23:38:06 +01:00
tonihei
7d59383cc4 Add reason to onPositionDiscontinuity.
This allows listeners to easily determine the source of the discontinuity.
Reasons can be period transitions, seeks, and internal reasons.

Listeners still using the deprecated ExoPlayer.EventListener interface were
updated to Player.EventListener.

GitHub: #3252

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168549612
2017-09-15 23:36:46 +01:00
andrewlewis
872cbec9e1 Add TrimmingAudioProcessor for gapless
Remove gapless functionality that relies on MediaCodec, and implement this in
an AudioProcessor instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168547487
2017-09-15 23:35:33 +01:00
hoangtc
c9591d7617 Added support for No-Sample Renderer.
Currently our Renderer is always associated with and consume data from
some SampleStreams, which were constructed from the provided MediaSource.
There are use-cases, in which the users want to have simple Renderer
implementation that does not consume data from SampleStream at all, but
render using their custom logic at each rendering position - they mostly just
need ExoPlayer to keep track of the playback position and enable/disable the
renderer.
This CL adds support for such Renderer by adding a TRACK_TYPE_NONE.
Renderer of such type will be:
- Associated with null TrackSelection as the result of track-selection
operation.
- Associated with EmptySampleStream.

GitHub: #3212

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168545749
2017-09-15 23:34:21 +01:00
hoangtc
5019da3e7b Update ABR logic in AdaptiveTrackSelection for live streaming case
In live streaming, if the playback position is very close to live edge,
the buffered duration will never reach minDurationForQualityIncreaseMs,
which prevents switching from ever happening. So we will provide the
durationToLiveEdgeUs to AdaptiveTrackSelection in live streaming case,
so it can handle this edge case.

GitHub: #3017

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168535969
2017-09-15 23:33:10 +01:00
olly
39dbb9a7fc De-dupe ACTION_DOWN events
Issue: #3259

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168378650
2017-09-15 23:31:54 +01:00
aquilescanta
f257300d8e Add tv module for USB tuner support + demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168366847
2017-09-15 23:30:41 +01:00
olly
0adb4502f6 Ignore all-zero defaultKid
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168259911
2017-09-15 23:29:28 +01:00
olly
340d0be40a Bump to 2.5.2
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168155713
2017-09-10 16:48:39 +01:00