64 Commits

Author SHA1 Message Date
olly
01c0ccbdbd Optimize ParsableBitArray
ParsableBitArray.readBit in particular was doing an excessive
amount of work. The new implementation is ~20% faster on desktop.

Issue: #3040

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161666420
2017-07-12 18:27:08 +01:00
tonihei
45f94eab62 Allow moving media source within DynamicConcatenatingMediaSource.
This option allows to move the currently playing media source to another position
and also to move other media source without creating a new MediaSource object.

Issue:#1706

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161402022
2017-07-12 18:09:08 +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
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
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
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
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
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
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
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
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
Oliver Woodman
555eb9d423 Mini cleanup 2017-06-23 17:37:28 +01:00
Oliver Woodman
8bb643976f Fix ContentDataSource and enhance tests to validate read data 2017-06-23 17:20:51 +01:00
ojw28
2da22e9e0f Merge pull request #2963 from DroidsOnRoids/dev-v2
Source length calculation in ContentDataSource changed
2017-06-23 15:45:21 +01:00
olly
950c2159b0 Discard upstream allocations more aggressively + doc cleanup
- If we have <s1>garbage<s2> and discard <s2>, throw away
  the garbage too.
- Cleanup some documentation to consistently refer to the
  queue as "queue" rather than "buffer".

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159816309
2017-06-22 20:24:53 +01:00
olly
9bad78dce6 Fix SampleMetadataQueue.getLargestQueuedTimestampUs
This was broken prior to my recent changes, since
largestDequeuedTimestampUs was only being updated in readData.
It should have been updated in the skip methods. as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159704945
2017-06-22 20:21:14 +01:00
eguven
531eb15ff4 Move DashDownloadTestBase assert methods to CacheAsserts
CacheAsserts contains cache assertion methods for testing. It's easier to use in tests than DashDownloadTestBase which requires to be extended.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159688808
2017-06-22 20:20:05 +01:00
olly
8e49cab865 Start finalizing SampleQueue methods
It's a bit messy at the moment with the deprecated methods
in there, but on the read side the new set of methods is as
follows:

Modifies the start of buffer:
- discardTo(time, keyframe, ...) [this is new]
- discardToRead()
- discardToEnd()

Modifies the read position:
- rewind()
- advanceTo(time, keyframe, ...) [this is a generalization of skipToKeyframeBefore]
- advanceToEnd() [previously called skipAll]
- read(...)

Which seems quite nice and self-consistent, and is powerful
enough for everything that we need to do as we move MediaSource
implementations over to the new methods.

TODOs for subsequent changes:
- Re-order methods in the two classes so that they're actually in
  the same order, and move the deprecated ones out of the way
- Enhance SampleQueueTest to also cover new functionality, as we
  start transitioning MediaSource implementations over to use it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159688660
2017-06-22 20:18:50 +01:00
olly
467fd2535c Expose new non-discarding SampleQueue read/skip methods
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159555748
2017-06-22 20:11:09 +01:00
aquilescanta
0ffc3ffd29 Fix DrmInitDataTest
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159554717
2017-06-22 20:09:57 +01:00
aquilescanta
317a994499 Add type to DrmInitData.SchemeData
At the moment, only CENC-defined scheme types are known values.
This will allow having more information about the encryption
scheme through the format, which in turn will allow more informed
decisions on format support.

Issue:#1661
Issue:#1989
Issue:#2089

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159538907
2017-06-22 20:04:26 +01:00
olly
c7948f2f7a TTML: Ignore regions that don't declare origin and extent
Issue: #2953

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159218386
2017-06-22 19:54:52 +01:00
tonihei
023c9d56a9 Simplify timeline test stub class.
Use an actual class for the stub media source instead of an anomymous class.
Allows to call assertReleased() on that class.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159109143
2017-06-22 19:53:36 +01:00
andrewlewis
ed27017b0c Update MIME type in FLAC test data
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159104188
2017-06-22 19:52:08 +01:00
Karol Wrótniak
86ff19b55b
null AssetFileDescriptors support added in ContentDataSource 2017-06-19 16:09:54 +02:00
Karol Wrótniak
50da6d870c
Comments from https://github.com/google/ExoPlayer/pull/2963#discussion_r122669328 applied 2017-06-19 12:46:09 +02:00
Karol Wrótniak
b77cc7c621
Introduced failing unit test for ContentDataSource 2017-06-17 16:18:43 +02:00
olly
e4617567a3 Rename DefaultTrackOutput to SampleQueue
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158842843
2017-06-14 19:31:47 +01:00
olly
6362dfeb98 Replace LinkedBlockingDeque with our own linked list
This will allow us to maintain a reference to the middle
of the queue, which is necessary to efficiently support
decoupling the read position from the start of the buffer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158839336
2017-06-14 19:30:21 +01:00
olly
fb12a659a2 Fix discarding upstream from DefaultTrackOutput
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158837777
2017-06-14 19:28:01 +01:00
olly
350998219a Add test for DefaultTrackOutput
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158745843
2017-06-13 13:17:27 +01:00
andrewlewis
4e006a9616 Move positionUs parameter from createPeriod to prepare
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158494794
2017-06-12 10:25:49 +01:00
tonihei
edbc2046e2 Clean-up manifest merge attributes.
1. Remove tools:replace in manifest files. This attribute is only needed to establish priority when two manifests are merged and have the same attribute with different values.
As this is not happening here, the attributes can be removed.

2. Some BUILD files also define a deprecated manifest merge strategy different from the android default merge strategy. For consistency these are set to "android'.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158075128
2017-06-06 16:38:45 +01:00
aquilescanta
f16967cdfe Flexibilize Util.parseXsDateTime to allow single digit hour
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156999955
2017-05-25 15:00:51 +01:00
olly
e892e3a5c7 Fix TTML positioning
Issue: #2824

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156781252
2017-05-23 15:19:55 +01:00
andrewrice
78c4cb74ea Fixes incorrectly-ordered arguments to calls to assertEquals
([]
This change has been automatically generated by an Error Prone check that
detects incorrect argument ordering on calls to assertEquals-style methods. See
[]

Cleanup change automatically generated by javacflume/refactory
Refactoring: third_party/java_src/error_prone/project/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects:AssertEqualsArgumentOrderChecker_refactoring

Tested:
    TAP --sample for global presubmit queue
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156739144
2017-05-23 15:19:55 +01:00
tonihei
1594e71917 Test for changing repeat mode during playback
(Related to GitHub Issue #2577)

Added test to ExoPlayerTest which changes the repeat mode during playback.
Test verifies that ExoPlayer shows the periods in the intended order.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156168166
2017-05-17 16:48:07 +01:00
bachinger
f335fb936d Enlarge size of data array of parsable packetArray if ogg packet size exceeds
the current size.

https://github.com/google/ExoPlayer/issues/2782

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156018137
2017-05-17 16:48:07 +01:00
tonihei
3dd2f4af57 Tests for timeline repeat mode support.
Checking the expected next/previous window indices and if the correct window
or period gets returned.

TimelineTest defines mock classes and verification methods used by the specific
implementation tests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155727385
2017-05-17 16:48:07 +01:00
aquilescanta
4abf64b7ef Make MODE_SINGLE_PMT the default mode
Even though this is not strictly spec compliant, this will make exoplayer
behave like it used to before multiple program support. Developers
who want to take advantage of the multiple program support are probably
less than the ones who only want their stream to "just work". This is
particularly useful for streams obtained after a filtering component,
like a tv tuner.

Issue:#2757

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155486122
2017-05-11 05:53:20 +01:00
aquilescanta
1f43fb1998 Introduce CryptoData parameter object
This will allow supporting more encryption schemes. Including some
that require more encryption data, like the encryption pattern.

Issue:#1661
Issue:#1989
Issue:#2089

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155481889
2017-05-11 05:53:20 +01:00
tonihei
4d1826dd3d Add repeat mode mechanics to Exoplayer.
(Relating to GitHub Issue #2577)

All getter, setter and callbacks have been added and value of repeatMode is
passed to getNextXXXIndex methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155071985
2017-05-04 20:55:48 +01:00
anjalibh
e07b8fe7d5 Parse ColorInfo from WebM Container and set it on MediaFormat.
* colorSpace, colorRange and colorTransfer are relevant to all videos.
* The rest of the fields are relevant only to HDR videos.
* Tested on a prototype device that decodes VP9 profile 2, 10 bit.
* The Webm spec spells color as 'colour' so the webm id reference use the same spelling.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154098189
2017-04-25 16:34:19 +01:00
tonihei
0a7011b390 Support default style in Tx3g decoder.
The track initialization data of Tx3g includes default style values for
font styles, colour, and font family. Additionally the decoder now supports
vertical subtitle placements other than the Tx3g default of 85% video height.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152930057
2017-04-18 19:33:30 +01:00