1153 Commits

Author SHA1 Message Date
aquilescanta
51df2dce46 Add support for voice selection in WebVTT CSS
Allow styling <v Someone>Hello</v> with ::cue(v[voice="Someone"]) { ... }.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119748009
2016-06-15 19:39:07 +01:00
andrewlewis
e594eccd4d Merge SampleSourceTrackRenderer into TrackRenderer.
TrackRenderer and SampleSourceTrackRenderer both now use a TrackStream
so they can be merged.

(This may also be useful for adding playlist support, in case TrackStreams need
to be replaced during playback.)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119743228
2016-06-15 19:39:07 +01:00
aquilescanta
c2beffc6c5 WebVTT CSS Styling -- Support for element selectors
This CL allows style blocks to reference elements. For example: we could style
a cue with text "Sometimes <b>bold</b> is not enough" with the style block
::cue(b) { ... }.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119734779
2016-06-15 19:39:07 +01:00
olly
f963c626af Remove seeking to live edge.
This is in preparation for the player knowing about the live
window, at which point only correct playback positions will be
passed into ChunkSource implementations. Note that both
implementations bound the chunk index within range in case of,
for example, off-by-one errors caused by very recent manifest
updates.

This will temporarily cause live playbacks to always start at
the beginning of the current live window (we'll be trying to
play from t=0, which will be adjusted to the start of the live
window as a result of the bounding).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119733559
2016-06-15 19:39:07 +01:00
olly
730e4ac953 Remove workaround for FrameworkSampleSource.
FrameworkSampleSource will still be useful for audio, where
sample interleaving isn't an issue. We could optionally add
a "don't wait for first frame" boolean to the video renderer
if we *really* need to keep some form of this workaround in
place, but I'd rather not do so for now.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119733224
2016-06-15 19:39:07 +01:00
olly
35e0dd8401 Use a single set of track type constants.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119732992
2016-06-15 19:39:07 +01:00
olly
956cbe4a09 Delete Clock/FakeClock from V2 until we need them.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119655941
2016-06-15 19:39:07 +01:00
eguven
192f566a1b Copy opus extension v1->v2
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119643009
2016-06-15 19:39:07 +01:00
aquilescanta
767c7ab169 Fixed id referencing in WebVTT CSS styling
In CSS, ids are references using #. The absence of # references elements.

NOTE: If the id of a cue was "1", we support its reference with ::cue(#1).
In CSS, however, this is not valid, and the number should be escaped with
\3 as in ::cue(\31). We still do not use number escaping (and I doubt
whether we should at some point).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119634708
2016-06-15 19:39:07 +01:00
aquilescanta
def59ebb26 Replaced full reference with import
This CL removes a warning by adding the import, and removes a qualified reference in the process.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119618343
2016-06-15 19:39:06 +01:00
aquilescanta
efe76def89 Add support to CSS in WebVTT files
This CL adds the support of CSS styling in Cues through id and "universal" cue selector.
The more sophisticated selectors will be left for later, because they requier a bit more
complex logic. Also narrowed a little bit the responsibilities of the WebvttCueParser to
move some to the WebvttParser.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119547731
2016-06-15 19:39:06 +01:00
andrewlewis
eb877f0cb7 Handle udta as a leaf atom.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119532634
2016-06-15 19:39:06 +01:00
olly
7170ff380c Remove V1 DASH multi-period + seeking-in-window from V2.
Both of these features are being promoted to first class
citizens in V2 (multi-period support will be handled via
playlists, seeking-in-window will be handled by exposing
the window/timeline from the player and via the normal
seek API). For now, it's much easier to continue the
refactoring process with the features removed.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119518675
2016-06-15 19:39:06 +01:00
cblay
1c0a120aeb Give the SimpleCache.initialize() Thread a better name.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119393264
2016-06-15 19:39:06 +01:00
olly
e5d028c425 Merge https://github.com/google/ExoPlayer/pull/1397.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119182077
2016-06-15 19:39:06 +01:00
olly
92ac270ce5 Return C constant rather than -1, as documented.
Note that the DataSourceInputStream read methods
are implementing a different interface (InputStream,
not DataSource), which is why -1 is still used in
that case.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119180851
2016-06-15 19:39:06 +01:00
eguven
05ef643e28 Copy from V1: Extractor.release() method releases all kept resources.
This method is needed by FlacExtractor to release native resources.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119143922
2016-06-15 19:39:06 +01:00
olly
7c35e38b4e Fix a few issues with SmoothStreaming in V2.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119049397
2016-06-15 19:39:06 +01:00
andrewlewis
3c1239826c Rename webm.WebmExtractor to mkv.MatroskaExtractor.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119020538
2016-06-15 19:39:06 +01:00
olly
9282710f04 Decouple next chunk evaluation and queue trimming.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118925372
2016-06-15 19:39:06 +01:00
andrewlewis
1581b915d3 Fix documentation super-nit.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118924198
2016-06-15 19:39:05 +01:00
andrewlewis
3208e20673 Add ParsableNalUnitBitArray which unescapes while reading.
This replaces calls to unescape except for SEI unescaping.

Use the new ParsableNalUnitBitArray for reading the slice header in HLS
access unit detection and slice_type reading.

Unescape the SPS before parsing in FLV and MP4. Before this change it was
parsed in its original (escaped) form.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118777869
2016-06-15 19:39:05 +01:00
olly
b041b72bae Yet more simplifications.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118775612
2016-06-15 19:39:05 +01:00
olly
9c2a971109 Simple method re-ordering of SampleSource implementations.
The only change that's not re-ordering is to add a Util method
for usToMs to replace the ones in the HLS and Chunk sources.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118775359
2016-06-15 19:39:05 +01:00
olly
292b2402e6 More SampleSource simplification.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118775144
2016-06-15 19:39:05 +01:00
olly
a4d17282f1 Have loader implement retry logic.
This was made possible by the simplification of how DASH/SS
chunk replacement works. It is also a step towards eliminating
continueBuffering(), since continueBuffering() calls are no
longer relied upon to resume a backed off load.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118774865
2016-06-15 19:39:05 +01:00
olly
d83b89cfd0 Minor documentation tweak.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118774671
2016-06-15 19:39:05 +01:00
olly
b0c8a6132d Add DataSourceFactory + implementation.
Step 6 of the refactor involves moving the logic that's
currently in the SourceBuilder classes in the demo app
into new SampleSource classes in the library. These classes
will construct video/audio/text pipelines on-demand (i.e.
when tracks are enabled) rather than constructing them all
up front as is currently the case in the SourceBuilder
classes. Hence we need a way to instantiate DataSource
instances (i.e. a DataSourceFactory ;)).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118722180
2016-06-15 19:39:05 +01:00
olly
5f37e3c8fb Ensure we re-enter the correct state after seeking.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118579021
2016-06-15 19:39:05 +01:00
olly
3187bd0829 Align DASH/SS/HLS chunk replacement mechanisms.
DASH + SS previously had a ridiculously complicated chunk
replacement mechanism in resumeFromBackOff. It also didn't
allow replacement of the first media chunk in the queue,
even though it's possible to remove it in the case that no
corresponding samples have been consumed.

This CL moves DASH + SS to the simpler model used in the
HLS implementation, where the chunk source has a single
opportunity to cancel (and hence later replace) the chunk
when the load error occurs. With this change comes the
ability to replace the first media chunk in the queue in
all cases where it's possible to do so.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118573418
2016-06-15 19:39:05 +01:00
olly
d8e6b096c4 Refine fix for limbo state.
This fixes some nuances with the initial solution. Mainly,
that the TrackStreams returned by selectTrack could not be
used safely until after endTrackSelection was invoked. It
also reduces the need for member variables to track state
between the track selection methods.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118556651
2016-06-15 19:39:05 +01:00
olly
305d8aa049 Improve ExoCacheTest.
- Use FakeDataSource as the upstream source.
- Actually validate that caching is happening (i.e. reads happen
  on the upstream source only if the data hasn't been read through
  the CacheDataSource already).
- Move FakeClock to sit alongside the other Fake classes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118555903
2016-06-15 19:39:04 +01:00
olly
6cc507aac0 Make all DataSource implementations implement getUri.
In V2 we'll at some point start using DataSource factories
for creating DataSource instances. If there are two DataSource
interfaces this gets unnecessarily awkward.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118470751
2016-06-15 19:39:04 +01:00
olly
d869a8d2fa Fix networked WAV extraction (where # bytes read < # bytes requested).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118457489
2016-06-15 19:39:04 +01:00
andrewlewis
ce47d7be38 Fix TextTrackRenderer.isEnded().
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118455206
2016-06-15 19:39:04 +01:00
andrewlewis
ce9b309aa1 Rename SampleHolder to DecoderInputBuffer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118040127
2016-06-15 19:39:04 +01:00
olly
98fb6d150d Tighten when various SampleSource methods can be called.
This removes the need for each SampleSource implementation to
implement 3x "if(condition) {noop}" tests (ChunkSampleSource
and SingleSampleSource were missing some of these checks).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118036233
2016-06-15 19:39:04 +01:00
olly
050b0b66da Fix starting playback from t!=0
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118032818
2016-06-15 19:39:04 +01:00
olly
f09b86a1bb Fix SampleSource limbo state - Part II
This change optimizes startup and track selection for HLS. Changes
in HlsChunkSource avoid unnecessary re-requests for media playlists.
Changes in HlsSampleSource optimize exit from the limbo state (i.e.
when endTrackSelection is first called).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118026962
2016-06-15 19:39:04 +01:00
olly
b3ce415e88 Fix SampleSource limbo state by introducing explicit "selecting tracks" state.
1. SampleSource now has an explicit track selection state. This state is entered
   after the source is prepared, and also by calling startTrackSelection.
2. endTrackSelection commits selection changes, and is responsible for doing the
   right thing w.r.t starting/stopping/restarting load operations.
3. All sources now start or restart a load in the case of a new track selection.
   This fixes a problem where a source could be advanced by repeatedly disabling
   and re-enabling whilst paused. Some sources didn't restart a load in this case,
   since the position was unchanged, however the downstream renderer would then
   consume media up to the first keyframe in order to render something. Hence
   each disable/re-enable would advance by a keyframe.
4. This change will enable a subsequent change where we'll discard media for
   non-selected tracks earlier than we do currently (i.e. we'll hook the extractor
   to a dummy track output, so the samples will never be written to a rolling
   buffer). This will enable a further subsequent change where buffer contributions
   are per-renderer rather than per-source.

Issue: #1041
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118024436
2016-06-15 19:39:04 +01:00
andrewlewis
24b2c09287 Use longs rather than ints for HLS byterange.
Issue: #1387
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118024270
2016-06-15 19:39:04 +01:00
andrewlewis
d5c80a31e8 Update list of ExoPlayer extractors in FrameworkSampleSource.java.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118021856
2016-06-15 19:39:04 +01:00
olly
1e78ee82ce WAV extractor fixes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118021575
2016-06-15 19:39:04 +01:00
olly
0ee45550c9 Use longs rather than ints for HLS byterange.
Issue #1387
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118021498
2016-06-15 19:39:04 +01:00
olly
b9d2224550 Treat streams claiming to be AAC Main as AAC LC.
Issue: #1383
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=118021452
2016-06-15 19:39:03 +01:00
andrewlewis
8571c81076 Move resetting the peek position to ExtractorSampleSource.
This fixes an issue where the PsExtractor would start reading
unsynchronized if sniff was called.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117958077
2016-06-15 19:39:03 +01:00
andrewlewis
1175f50fb8 Partially merge InputBuffer and SampleHolder.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117908518
2016-06-15 19:39:03 +01:00
ccwu
0d1ae1dd67 Change the signature of onQueuedInputBuffer
Expose the input buffer for Exoplayer V2. This allows subclasses to
parse the input buffer before it is decoded. One particular usage
of this is to allow parsing user data stored in the tracks
(e.g. SEI in H264), and incorporate the user data into the rendering.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117865971
2016-06-15 19:38:07 +01:00
andrewlewis
8353463bf5 Detect sample boundaries in H.264 TSs without AUDs.
Issue: #1263
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117813106
2016-06-15 19:38:06 +01:00
andrewlewis
fc716b5711 Signal end of stream in SampleHolder flags.
Also use MediaCodec buffer flag constants instead of those on MediaExtractor.

This is in preparation for merging InputBuffer and SampleHolder.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117810136
2016-06-15 19:38:06 +01:00