657 Commits

Author SHA1 Message Date
olly
06b3b3ca8d Migrate HLS over to new SampleQueue methods
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161391296
2017-07-10 16:17:09 +01:00
Oliver Woodman
b333169ada Merge branch 'dev-v2' of git://github.com/jcable/ExoPlayer into jcable-dev-v2 2017-07-10 12:29:06 +01:00
Oliver Woodman
7524228160 Clean up rtmp extension 2017-07-05 15:08:00 +01:00
olly
dda3616f5a Fix reporting of width/height
1. maybeRenotifyVideoSizeChanged should report reported* variables
2. Add check into maybeNotifyVideoSizeChanged to suppress reporting
   in the case that the width and height are still unknown.

Issue: #3007

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160879625
2017-07-05 15:02:39 +01:00
tonihei
05a77eef5d Move Extractor test assertion methods to ExtractorAsserts class.
This cleans up test the TestUtil class that in large parts consisted of
assertions for Extractor tests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160829066
2017-07-05 15:02:39 +01:00
olly
ad3d1e0cf2 Add reset() to SampleQueue. Deprecate reset(boolean) and disable()
The deprecated methods will be removed as soon as HLS is migrated
to use the new ones.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160827936
2017-07-05 15:02:39 +01:00
andrewlewis
d733bb4101 Fix video tunneling state transition to ready
Issue: #2985

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160827532
2017-07-05 15:02:39 +01:00
tonihei
960315c4d5 Move extractTimelineFromMediaSource to test util class.
This also ensures that TimelineAsserts only contains assert methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160827271
2017-07-05 15:02:39 +01:00
tonihei
a9efb4553d Merge TimelineAsserts.FakeTimeline into FakeTimeline.
They serve the same purpose. One was defined as single window, multi-period
timeline, while the other was a multi-window, single-period-each timeline.

The combined FakeTimeline uses TimelineWindowDefinitions which allow multi-
window, multi-period fake timelines.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160808844
2017-07-05 15:02:39 +01:00
Oliver Woodman
19a3d94022 Remove offline classes for now (not ready yet) 2017-06-30 22:24:40 +01:00
olly
4ee0b2e1c8 Update release notes + bump version number
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160663100
2017-06-30 18:54:35 +01:00
olly
c7924bfe22 Clean up parseSampleEntryEncryptionData
It was a bit strange how it returned something via the return
value and something else via the "out" variable, and doing it
this way wasn't even saving any allocations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160645640
2017-06-30 16:54:31 +01:00
olly
51b98e817c Make Android Studio happy (make State public)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160638478
2017-06-30 16:53:20 +01:00
tonihei
177a33bbee Merge TimelineAsserts.StubMediaSource into FakeMediaSource.
The StubMediaSource was a subset of the FakeMediaSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160638245
2017-06-30 16:52:12 +01:00
tonihei
9db0b8cce0 Move fake ExoPlayer component test classes to testutils.
Fake ExoPlayer componenets used within ExoPlayerTest.java can be useful for
other test classes and are therefore made available in testutils.
They can also be merged with other existing fake components.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160632908
2017-06-30 16:49:59 +01:00
tonihei
3b2cfa148c Move Timeline assertions to testutils.
Some parts of TimelineTest provided common assertions and helper classes for
other tests. As such, they better fit into testutils. In line with other
assertion methods, the TimelineVerifier class has been converted to a set of
static assertion methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160629797
2017-06-30 16:47:41 +01:00
olly
04b57f9c8e Fix DvbParser bug
Issue: #2957

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160628086
2017-06-30 16:46:31 +01:00
hoangtc
28030b6c7e Temp workaround for [Internal: b/63092960]
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160543009
2017-06-30 16:45:21 +01:00
tonihei
84f4fe5cf9 Recover from empty timelines.
(Related to GitHub #1706)

When the timeline becomes empty, the playback state transitions to "ended".
When the timeline becomes non-empty again, exceptions are thrown because MSG_DO_SOME_WORK is still regularly sent and media periods are getting prepared.

This change ensures that no MSG_DO_SOME_WORK messages are sent in "ended" state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160537147
2017-06-30 16:44:14 +01:00
olly
db177db6d9 DrmSession cleanup
These changes are in part related to handling playback of mixed clear
and encrypted content, where we might want to use a secure decoder
throughout, but only have drm init data and only care about the state
of the DrmSession during playback of encrypted parts.

- requiresSecureDecoderComponent became unnecessary when we added
  ExoMediaCrypto, which provides a layer in which requiresSecureDecoderComponent
  can be overridden.
- Relaxed requirements for obtaining the MediaCrypto. It's helpful
  to allow retrieval in the error state, since it can be used to
  instantiate a decoder and play clear samples.
- Deferred throwing of errors in renderer implementations. As long as
  we can get a MediaCrypto, we should init the codec. We can also
  play clear samples without failing if playClearSamplesWithoutKeys is
  true, regardless of the errors state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160536365
2017-06-30 16:42:01 +01:00
eguven
beb0734107 Extract base class from DashDownloaderFactory
This base class will be used to extend HlsDownloaderFactory from.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160523335
2017-06-30 16:40:53 +01:00
aquilescanta
e344e9cbb7 Add SinglePeriodTimeline constructor to fill missing window information
Issue:#2930

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160520480
2017-06-30 16:39:41 +01:00
olly
51af85f263 Prefer Google over MediaTek for PCM decoding pre-O.
Issue: #2873

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160520136
2017-06-30 16:38:37 +01:00
tonihei
69db6cb60b Add dynamic concatenating media source.
(GitHub issue #1706)

The media source allows adding or removing child sources before and after prepare() was called.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160516636
2017-06-30 16:37:31 +01:00
tonihei
a98d5bbd0a Do not start rebuffering after playback ended.
This is currently happening after toggling the repeat mode. This is line with
the rest of the implementation which requires a seek operation to resume
playback.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160516449
2017-06-30 16:36:19 +01:00
andrewlewis
1f815db367 Switch the IMA extension to use in-period ads
This also adds support for seeking in periods with midroll ads.

Remove Timeline.Period.isAd.

Issue: #2617

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160510702
2017-06-30 16:35:14 +01:00
tonihei
6509dce6b7 Clarify JavaDoc of MediaPeriod.
Two of MediaPeriod's methods are only called after the media period has been
prepared. Added this to JavaDoc of these method to simplify implementations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160510373
2017-06-30 16:34:08 +01:00
eguven
81d077c037 Extract base class from DashDownloader
This base class will be used to extend HlsDownloader from.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160505710
2017-06-30 16:31:58 +01:00
andrewlewis
c6e5b67626 Move InlinedApi warning suppression to class level for C
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160412354
2017-06-28 22:26:05 +01:00
andrewlewis
71ffc7668c Support specifying AudioAttributes for AudioTrack
Add a compatibility AudioAttributes class so that the app can specify
audio attributes in the same way before and after API 21.

Deprecate SimpleExoPlayer.setStreamType. Add
SimpleExoPlayer.setAudioAttributes and MSG_SET_AUDIO_ATTRIBUTES.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160408574
2017-06-28 22:26:05 +01:00
tonihei
c385ece69d Move methods into MediaPeriodHolder.
Both methods make extensive use of MediaPeriodHolder internals.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160386401
2017-06-28 22:26:05 +01:00
andrewlewis
96fa660284 Expose ad playback information on ExoPlayer
Also update the time bar to show ad markers using in-period ads and
remove support for periods being marked as ads.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160382805
2017-06-28 22:26:05 +01:00
andrewlewis
66d122710e Add support for in-period ads
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160294524
2017-06-28 22:26:05 +01:00
olly
4a59c7cf40 Make it easier to use ExoPlayer modules in other projects II
With this change, it becomes possible to depend on ExoPlayer
locally in settings.gradle by doing:

gradle.ext.exoplayerRoot = 'path/to/exoplayer/root'
apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle')

You can optionally add a prefix onto ExoPlayer's module names
by adding:

gradle.ext.exoplayerModulePrefix = 'prefix'

Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160277967
2017-06-28 22:26:05 +01:00
andrewlewis
26b32f6078 Move getPeriodPosition methods to Timeline
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160273929
2017-06-28 22:26:05 +01:00
olly
2a8eb5a2a1 Make it easier to use ExoPlayer modules in other projects
It's currently difficult to use ExoPlayer modules in other gradle
projects because they rely on constants and dependencies defined
in our own top level gradle file. This change moves the constants
into a separate file referenced directly from each module. It also
removes the need for the top level gradle file to declare a
dependency on com.novoda:bintray-release. This is now only needed
if "exoplayerPublishEnabled = true" is specified.

Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160272072
2017-06-28 22:26:05 +01:00
andrewlewis
1dcad4d173 Store a MediaPeriodId in PlaybackInfo
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160271631
2017-06-28 22:26:05 +01:00
andrewlewis
675756d32d Create MediaPeriods based on an identifier not an index
This will allow MediaSources to provide MediaPeriods that correspond to ad
breaks in a timeline period rather than content for a timeline period, in a
future change.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160267841
2017-06-28 22:26:05 +01:00
andrewlewis
d4059ecc65 Use period holder indices to determine if a period was seen
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160257503
2017-06-28 22:26:05 +01:00
tonihei
410228acb8 Rename isLast to isFinal in MediaPeriodHolder.
This better reflects the purpose of this flag and makes code more readable.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160246573
2017-06-28 22:26:05 +01:00
Oliver Woodman
076a77e598 Fix indexing error 2017-06-26 23:41:00 +01:00
eguven
3fbfe29d27 Modify CacheUtil.cache() for polling counters
Getting active status of caching is needed to display on UI. Instead of a listener interface polling was chosen because of simplicity and better suits to UI refreshing.

CachingCounters.downloadedBytes was updated after whole data is downloaded. Now it's updated for each read into buffer. Buffer length defines how finer these updates are.

CachingCounters.totalBytes is added so UI can display a progress bar.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160142048
2017-06-26 17:07:56 +01:00
olly
acbddbc0a5 Use regular array for SampleQueues in ExtractorMediaPeriod
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160138881
2017-06-26 17:07:56 +01:00
olly
c448463a05 Move DashMediaSource and SsMediaSource to new SampleQueue methods
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160130540
2017-06-26 17:07:56 +01:00
olly
1b71e3b40d Move ExtractorMediaPeriod to new SampleQueue methods
This change allows you to enable/disable tracks within which
all samples are key-frames without any re-buffering (e.g. audio,
text and metadata). This effectively reverts V2 back to the
behavior in V1, only this time we're doing it properly. []ly
disabling/enabling, or disabling/enabling whilst paused, no longer
cause samples to get "lost" between the source and renderers.

Note it also becomes really easy to support a few other things,
although support is not exposed in this change:

- Enable/disable video tracks without any re-buffering, by
  changing the toKeyframe argument passed to discardTo to true.
- Retain media in the buffer for some time after it's been played
  (e.g. to support a single back-5s-seek efficiently), by
  subtracting the desired back-buffer time from the value that's
  passed to discardTo.

Issue: #2956
Issue: #2926

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160128586
2017-06-26 17:07:56 +01:00
olly
b3c6f6fb31 Merge ContentDataSource fixes + tests from GitHub
https://github.com/google/ExoPlayer/pull/2963/files
8bb643976f

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160128047
2017-06-26 17:07:56 +01:00
hoangtc
70e6dd5930 Update DrmSessionException.
Make DrmSessionException takes in Throwable cause instead of Exception cause, which is more limiting and doesn't add any benefit.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160121486
2017-06-26 17:05:21 +01:00
olly
c007e93ab0 Fix setSelectionOverride(index, tracks, null)
Issue: #2988

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159958591
2017-06-24 14:42:15 +01:00
tonihei
363f2414d1 Fix check for last period index in ExoPlayerImplInternal
The if clause was never executed because nextLoadingPeriodIndex is set
to C.INDEX_UNSET instead of loadingPeriodIndex + 1.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159948661
2017-06-24 14:42:15 +01:00
Oliver Woodman
555eb9d423 Mini cleanup 2017-06-23 17:37:28 +01:00