Commit graph

1405 commits

Author SHA1 Message Date
olly
a43144decf Don't require playback Looper to build DRM session manager.
This is required because in V2 we'll be instantiating DRM
session managers before the ExoPlayer instance (and hence
we wont have the Looper). This logic will be further cleaned
up in later CLs that overhaul DrmSessionManager in more
depth.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122453765
2016-06-15 19:41:32 +01:00
andrewlewis
537f193c88 Improve precision of fragmented/unfragmented MP4 sniffing.
Search up to 4 KB for both fragmented and unfragmented files.

Detect files with an mvex box in their moov box as fragmented.

Fix reading of brands.

Issue: #1523
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122429548
2016-06-15 19:41:32 +01:00
olly
ecf50c4f9e Fix too-long TAG + remove unused methods.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122426685
2016-06-15 19:41:32 +01:00
olly
2e8e8aba9d Always inject loadable retry count.
Now [DASH/SS]SampleSource instances are creating ChunkTrackStream
instances dynamically, it makes sense to always require that the
min retry count be injected from that level. The SampleSource
implementations should also use the retry count when refreshing
the manifest.

The option to configure the retry count on the SampleSource classes
will arrive in a later CL.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122424774
2016-06-15 19:41:32 +01:00
olly
6977c8f455 Bit of naming/documentation cleanup.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122423250
2016-06-15 19:41:32 +01:00
aquilescanta
2f4bfc3f5f Add the TrackSelectionPolicy to decouple track "assignment" and selection
Allows the user to provide their own criteria for selecting one of the available tracks
without having to reimplement the track assignment logic, i.e. linking type x tracks with
type x renderer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122422087
2016-06-15 19:41:32 +01:00
olly
23769fe82e Work around broken AAC decoder.
Issue: #1528
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122421357
2016-06-15 19:41:32 +01:00
olly
ca49d6ff40 Refactor #6.HLS.2
Rename HlsSampleSource2 -> HlsSampleSource.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122418334
2016-06-15 19:41:32 +01:00
olly
770f2c2c58 Refactor #6.HLS.1
1. Merge HlsOutput and HlsSampleSource -> HlsTrackStreamWrapper.
2. Rename HlsSource -> HlsSampleSource2. This will be renamed to
   HlsSampleSource in a subsequent CL.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122415970
2016-06-15 19:41:32 +01:00
olly
d689a8fdfd Make Format implement Parcelable.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122407769
2016-06-15 19:41:31 +01:00
olly
efaea81194 Use CodecCounters consistently in all renderers.
- Increment skippedBufferCount for VPX and ADTR.
- Set maxConsecutiveDroppedOutputBufferCount count for VPX.
  Tweak its meaning to ignore skipped frames.
- Remove outputFormat/outputBuffer changed counts. These add
  limited value. Also, MediaCodec is moving toward a model where
  you don't see the output buffers changing because you dequeue
  them one at a time (like how our extension decoders work).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122258530
2016-06-15 19:41:31 +01:00
olly
3760f514a9 Flesh out ExoPlayer extensions.
1. AudioDecoderTrackRenderer now reports decoder initialization
   and AudioTrack underruns.
2. AudioDecoderTrackRenderer can now render more than one output
   buffer per call to doSomeWork, to be consistent with
   MediaCodecAudioTrackRenderer. This may also prevent audio
   underruns in the case that audio is fragmented into many small
   buffers.
3. AudioDecoderTrackRenderer now has an overridable method that
   receives the audio session id, to be consistent with
   MediaCodecAudioTrackRenderer.
4. Fix unsafe event notification in LibvpxVideoTrackRenderer.
5. Vpx and AudioDecoder extensions now increment the CodecCounter
   inputBufferCount field correctly.
6. Decoders now have names :).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122250009
2016-06-15 19:41:31 +01:00
andrewlewis
7e58f4cd9d Allow AudioDecoderTrackRenderers to override their output formats.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122247516
2016-06-15 19:41:31 +01:00
andrewlewis
403f164b75 Pass the sample Format to AudioDecoderTrackRenderer.createDecoder.
The FFmpeg extension can support various different MIME types, so pass the
whole format to configure the decoder.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122246589
2016-06-15 19:41:31 +01:00
olly
ea8d0a7aef Move UUID constants to C, and make C an interface.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122242006
2016-06-15 19:41:31 +01:00
olly
b53a941ffd Fix crash (by calling correct DecoderInfo constructor).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122159478
2016-06-15 19:41:31 +01:00
olly
e29cb37403 Fix WavExtractor bug.
When skipToData is called the peek position is not equal
to the read position of the input. Hence peeking a chunk
header and then skipping by that amount wont do the right
thing :)!
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122157603
2016-06-15 19:41:30 +01:00
olly
9bfe62a5a5 Support 32-bit WAV.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122157513
2016-06-15 19:41:30 +01:00
olly
7301b53829 Add MediaCodecSelector.getPassthroughDecoderInfo.
Issue: #1518
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122157463
2016-06-15 19:41:30 +01:00
andrewlewis
1dcd454477 Rename util.extensions package to extensions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122151232
2016-06-15 19:41:30 +01:00
olly
68d39b5159 Remove DecoderInputBuffer.size
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122146105
2016-06-15 19:41:30 +01:00
olly
f9f95d638b Make ExtractorSampleSource amenable to proguarding.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122085277
2016-06-15 19:41:30 +01:00
olly
af78ff849a Add MediaCodecSelector.getPassthroughDecoderInfo.
Issue: #1518
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122080068
2016-06-15 19:41:30 +01:00
andrewlewis
7980e495a7 Remove an extra blank line in ExtractorSampleSource.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122065476
2016-06-15 19:41:30 +01:00
olly
5ca9f62753 Refactor #6.HLS.0
Mechanical step to create a new HlsSource in the library.
Note that naming is now confusing. This will be fixed in
the next CL, when:

HlsSource -> HlsSampleSource
HlsSampleSource+HlsOutput -> HlsOutput
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122054800
2016-06-15 19:41:30 +01:00
eguven
9ee3030b79 Opus initialization data should be in native order.
http://developer.android.com/reference/android/media/MediaCodec.html#CSD
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121957004
2016-06-15 19:41:30 +01:00
olly
58c0ab1779 Broaden OMX.SEC.MP3.Decoder blacklisting.
Issue: #398
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121949973
2016-06-15 19:41:30 +01:00
eguven
3674f9598e ogg't'opus reader
Support for opus content in ogg container.
TODO: Sample duration and seeking.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121940392
2016-06-15 19:41:29 +01:00
olly
30ab3bef9a Bump version to 1.5.8.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121931978
2016-06-15 19:41:29 +01:00
[]inger
28eaa2cb24 Support Ogg containers without a properly flagged last page.
Such files are slightly off spec but easy to support.(https://github.com/google/ExoPlayer/issues/1506)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121927762
2016-06-15 19:41:09 +01:00
olly
b61e7cdbc4 Support 8-bit and 24-bit PCM with re-sampling.
This is a cleaned up version of the pull request below,
which will be merged with this change then applied on top.

https://github.com/google/ExoPlayer/pull/1490

Issue: #1246
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121926682
2016-06-15 19:41:09 +01:00
cblay
d2c524d726 Add open/read http exception classes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121871799
2016-06-15 19:40:39 +01:00
olly
9f2707cfa3 Push DrmInitData into Format.
- This means DrmInitData is propagated through sample queues (i.e.
  is effectively attached to every sample, so we can see when it
  changes when reading from the queue).
- It also allows different DrmInitData per track, which is possible
  in muxed MKV/WebM, and per Representation for DASH, although we
  wont be able to seamlessly adapt in the latter case.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121821928
2016-06-15 19:40:39 +01:00
olly
e284d6166a Remove AudioTrack API level 16 dependency.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121685491
2016-06-15 19:40:39 +01:00
olly
523f2662ef Skip arbitrary chunks before WAV fmt chunk.
I've seen a sample that has a LIST chunk prior to fmt. It
seems best just to skip all chunks until the format is
located. As per the RIFF spec:

"Programs must expect (and ignore) any unknown chunks
encountered, as with all RIFF forms."

https://www.aelius.com/njh/wavemetatools/doc/riffmci.pdf
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121682470
2016-06-15 19:40:39 +01:00
olly
99c0ba005a Add support for TTML Regions extent
This allows limiting the horizontal extension of the cues.
NOTE: So far, we only support percentages for size magnitudes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121682404
2016-06-15 19:40:39 +01:00
eguven
642b2009f3 Add extensions to v2 demo app.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121674924
2016-06-15 19:40:39 +01:00
cdrolle
cf0a31a7bb Fixed an NPE with self-initializing DASH segments.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121660680
2016-06-15 19:40:38 +01:00
olly
27132bb2da Update MediaCodecUtil in V2.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121566154
2016-06-15 19:40:38 +01:00
olly
7f98887468 Add support for rechunking fixed-sample-size data.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121565738
2016-06-15 19:40:38 +01:00
olly
1fea3fe3c0 Add support for TTML regions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121564959
2016-06-15 19:40:38 +01:00
cdrolle
d978398faf Added SubtitleParser interface (extending Decoder)
SubtitleParser includes a method updating the current
playback position for parsers that need to be aware
of the position in order to determine how to batch
captions (i.e. Eia608Parser).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121519712
2016-06-15 19:40:09 +01:00
olly
6e5ae4eddc Simplify DrmInitData.
- This moves to a single DrmInitData implementation that supports
  both specific and universal UUID matching. You can also do a
  combination of the two, which was not previously possible.
- The object model is simplified as a result. This is a precursor
  to a change where DrmInitData will be included directly in the
  Format to enable key rotation.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121472592
2016-06-15 19:40:09 +01:00
eguven
686816a610 Fix format constructor parameter order.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121468904
2016-06-15 19:40:09 +01:00
aquilescanta
45a46c3e6e Add getTrackType to allow track selection
In order to apply track type specific policies in
the track selection, we need to know the type of
the track renderer, this method returns one of the
constants defined in C.java of the form TRACK_TYPE_*
to allow renderer classification.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121369021
2016-06-15 19:39:52 +01:00
olly
6b9c43e578 Avoid expensive equality checks in DefaultTrackOutput.
If the media format changes from one Format object to another
one that's is equal (but not the same object), readData would
end up performing an expensive equality evaluation on every
invocation.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121362300
2016-06-15 19:39:52 +01:00
andrewlewis
c2bd01a756 Removed unused parameter.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121102072
2016-06-15 19:39:52 +01:00
olly
f0e6fff011 Remove unused private constants.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121101188
2016-06-15 19:39:52 +01:00
olly
a1299ea722 Have DrmInitData classes implement hashCode/equals.
This will be required for key rotation to work, since
we'll need a way to determine whether or not the init
data has changed.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121018211
2016-06-15 19:39:52 +01:00
andrewlewis
9b57487845 Handle gapless audio metadata in elst.
Only edit lists that truncate the first/last sample are supported, which is
sufficient to handle AAC encoder delay/padding.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121011278
2016-06-15 19:39:52 +01:00
olly
23cb9532c5 Refactor #6.5: Restore DASH UTC timing element support.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121002218
2016-06-15 19:39:52 +01:00
olly
0841d043b8 Refactor #6.4: Create child source instances on demand.
Dash/SS SampleSources now instantiate ChunkSource and
ChunkSampleSource (renamed to ChunkTrackStream) instances
on demand as tracks are enabled. The TrackGroups exposed
by the DASH/SS SampleSources are now constructed at the
top level.

Note that this change resolves the TODOs at the top of the
ChunkSource classes, allowing multiple adaptation sets of
the same type.

Next steps will include:

- Bring back UTC timing element support for DASH, which
  will be an extra request during preparation in  the DASH
  SampleSource.
- Simplification of manifest fetching to use a Loader directly
  in the two top level SampleSource classes. ManifestFetcher
  should eventually go away once HLS no longer needs it.
- Eventually, some consolidation between DASH/SS. There's a
  lot of common code there now.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121001777
2016-06-15 19:39:52 +01:00
olly
d82bb3f657 Refactor #6.3: Pull drm parsing up to SS SampleSource.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121001478
2016-06-15 19:39:52 +01:00
olly
eb3460b3aa Refactor #6.2: Start to simplify components.
Parse the duration of the media directly from the manifest
in the DASH/SS SampleSource implementations.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121001296
2016-06-15 19:39:52 +01:00
olly
b38d004553 Refactor #6.1: Pull up manifest requests.
This change pulls manifest refresh responsibility up to the
top level Dash/SS SampleSource implementations. In following
steps more of the manifest processing logic will be pulled
up (e.g. extracting track groups from the initial manifest),
which will allow ChunkSampleSource/ChunkSource instances to
be further simplified and created on demand.

I've avoided moving/renaming anything for now, so as to keep
it fairly easy to review.

Note that this change does the TODO related to releasing the
manifest fetchers.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121001139
2016-06-15 19:39:52 +01:00
olly
15a890c3ce Refactor #6.0: Add SampleSources for DASH and SS.
This is a mechanical change. The two new SampleSource classes
are forked from MultiSampleSource, with the logic that previously
was in the demo app's SourceBuilder methods copied into the
corresponding constructors. Subsequent steps will:

1. Pull the initial manifest processing from DashChunkSource and
SmoothStreamingChunkSource into the new SampleSource classes.
2. Remove the construction of ChunkSampleSource instances from
the constructors, instead instantiating children only as needed
when tracks are enabled.
3. Simplify ChunkSampleSource down into a ChunkTrackStream object.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121001021
2016-06-15 19:39:52 +01:00
cdrolle
3d14c7242d Refactored Eia608Parser so that it manipulates the caption string builder directly, avoiding unnecessary object allocation.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120926283
2016-06-15 19:39:52 +01:00
eguven
ab3489efc1 Remove unnecessary reset() method.
pageHeader.headerArray is only used in getNextSeekPosition()
in which populatePageHeader() resets them both at the beginning
anyway.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120902428
2016-06-15 19:39:35 +01:00
andrewlewis
845d250442 Restore renderer.isEnded check when updating the playback position.
If rendererMediaClock is non-null, the rendererMediaClockSource is enabled or
started, so remove the check in updatePositionUs.

When disabling renderers for track selection, renderers with changing track
selections always transition from started -> enabled.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120819483
2016-06-15 19:39:35 +01:00
olly
e88eeba859 Fix compiler warnings.
- You can't link to a generic type (apparently).
- Suppress unchecked conversion warning.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120817601
2016-06-15 19:39:35 +01:00
olly
7313c26a56 Properly document processOutputBuffer.
Plus add processOutputBuffersChanged just for consistency
with processOutputBuffer and processOutputFormat.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120811608
2016-06-15 19:39:35 +01:00
cdrolle
0bd26b74b2 Remove Eia608TrackRenderer
Functionality is moved into Eia608Parser, so that Eia608Parser
can be used with TextTrackRenderer, similar to all the other
text/subtitle formats. Modified some of the other
text/subtitle-related classes to support the new behaviour.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120755145
2016-06-15 19:39:11 +01:00
olly
6c45233653 Attempt to make drainOutputBuffer clearer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120722975
2016-06-15 19:39:11 +01:00
aquilescanta
81383f8022 Add full selector support to CSS in WebVTT
This CL allows near-complete support to CSS selectors (I say near because not every
CSS rule applies to WebVTT).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120717498
2016-06-15 19:39:11 +01:00
olly
5cbf75b619 Make AudioTrack.handleBuffer more sane.
Now uses buffer position + limit in both new and legacy modes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120713837
2016-06-15 19:39:11 +01:00
eguven
d1eb43ad62 V2 Extension fixes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120699171
2016-06-15 19:39:11 +01:00
olly
da5e4dbe92 Fix wrong-way-round-sign. Oops!
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120694784
2016-06-15 19:39:11 +01:00
andrewlewis
50f5616266 Fix documentation and logging in LongArray.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120693278
2016-06-15 19:39:11 +01:00
andrewlewis
c60470339b Remove unused parameter from ChunkSource.continueBuffering.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120691990
2016-06-15 19:39:11 +01:00
olly
854acaa1ac Set decode only flag in DefaultTrackOutput.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120553402
2016-06-15 19:39:11 +01:00
olly
9a893e3003 Fix thread-safety issue using DefaultTrackOutput.
Reading the format and/or a sample needs to be done as a
single operation. Else you can have a situation where the
queue is initially empty, and this happens:

1) Read downstream format X
2) Read downstream format X (unchanged)
3) Write format Y
4) Write first sample
5) Read first sample

The first sample then appears to be format X rather than Y.

Note that readData in the SampleSource implementations always
looks roughly the same. readReset is identical in all cases.
isReady is identical in all cases now I've fixed them to be
that way. So it should be pretty easy to get DefaultTrackOutput
to implement TrackStream directly, at which point a whole load
of duplication will disappear.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120546377
2016-06-15 19:39:11 +01:00
olly
90b7081824 Propagate resets at the source rather than track level.
- Code is simpler. We only ever reset all tracks.
- Allows the standalone media clock to be updated properly. This
  allows simpler recovery for live streams in ExtractorSampleSource.
- Fixes #1285 and paves the way for a fix for #758.

Issue: #1285
Issue: #758
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120530682
2016-06-15 19:39:10 +01:00
olly
2b13165738 Optimize HLS seeking.
I think the concept of a sparse track might need formalizing
in Format at some point. We should probably do a similar thing
with sparse tracks in ExtractorSampleSource as well. WDYT?

Issue: #551
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120530195
2016-06-15 19:39:10 +01:00
olly
b1de997388 Remove incorrect AudioTrack timestamp adjustment.
This is just wrong. I think there used to be an off-by-one
timestamp error in YouTube's fmp4 streams, and this code
was initially designed exclusively to play such streams. I
don't see this issue any more though, if it was ever there!
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120447694
2016-06-15 19:39:10 +01:00
olly
e390bdf98c Align Chunk/HLS sample sources.
Having moved HLS to use single sample queues per track, these
classes have become relatively similar. This CL aligns the two
to make this more obvious. It remains unclear whether it'll
ever be sensible to merge them; there are still some niggly
complications for HLS.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120429618
2016-06-15 19:39:10 +01:00
[]inger
ae8f95f64d Added Ogg/Vorbis samples to internal samples for main and experimental.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120425278
2016-06-15 19:39:10 +01:00
aquilescanta
c11fda04e5 Add CSS Specificity score system to WebvttCssStyle
This CL provides the necessary infrastructure to add styling by class. This was separated
into two different CLs to ease reviewing.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120336976
2016-06-15 19:39:10 +01:00
olly
0fc53f6e37 Fix Flac test + bring v2 fully in sync (I think!).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120335929
2016-06-15 19:39:10 +01:00
olly
6635dd0ef7 Fix infinite loop in AdtsExtractor sniffing malformed or non-ADTS streams.
Here is a WAV that exhibits this issue:
https://storage.googleapis.com/courtside-public/dcower/reaper_16bit_nonbwf.wav
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120334203
2016-06-15 19:39:10 +01:00
olly
157f5ff886 Workaround for issue #1443
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120334164
2016-06-15 19:39:10 +01:00
olly
8f2e56d59b Add support for a bext chunk *before* the fmt chunk in WAV files.
This can occur in some Broadcast Wave Format (BWF) files, such as those
produced by the Zoom H2n. See the included sample for an example.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120334117
2016-06-15 19:39:10 +01:00
olly
b3f732cd05 Fix parsing of QT sample desc version 2.
Also support "lpcm" and "sowt" sample descriptors.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120334017
2016-06-15 19:39:10 +01:00
olly
2a37b02ee2 Merge updates from GitHub.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120332794
2016-06-15 19:39:10 +01:00
olly
7638bea016 Bring V2 ogg extractor up to date.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120332721
2016-06-15 19:39:10 +01:00
andrewlewis
6f32636f40 Use long instead of int for MP3 sample counter.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120331805
2016-06-15 19:39:09 +01:00
olly
2e0518f47b Apply Android studio code analysis suggestions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120326293
2016-06-15 19:39:09 +01:00
olly
48bc98f1ed Naming cleanup.
- RollingSampleBuffer -> DefaultTrackOutput
- TsChunk -> HlsMediaChunk
- Established hls.playlist package for HLS playlist things
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120325049
2016-06-15 19:39:09 +01:00
olly
69b431b8c2 Stop using SparseArray where a regular array will do.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120240634
2016-06-15 19:39:09 +01:00
olly
b5bdbedfd5 Move HLS to use a single RollingSampleBuffer per track.
Notes:
- RollingSampleBuffer will be renamed DefaultTrackOutput in a
  following CL, and variable naming will be sanitized.
- TsChunk will also be renamed to HlsMediaChunk, since it can
  be used for non-TS containers (e.g. MP3).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120240243
2016-06-15 19:39:09 +01:00
eguven
a7d7859478 Shared super class for LibflacAudioTrackRenderer and LibopusAudioTrackRenderer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120225655
2016-06-15 19:39:09 +01:00
olly
a760c9bfd9 Use RollingSampleBuffer directly for non-HLS.
This also fixes the largest queued timestamp to be the
correct value if upstream samples are discarded.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120207054
2016-06-15 19:39:09 +01:00
olly
5ce210e374 Propagate format information through RollingSampleBuffer.
At this point the only reason preventing the chunk package
from using RollingSampleBuffer directly, rather than
DefaultTrackOutput, is that the latter maintains the largest
parsed timestamp. This will be pushed inside the former in
the next CL. Following that, splicing logic will also be
pushed inside of RollingSampleBuffer, and HLS will be moved
over to using a single RollingSampleBuffer per track, with
the splicing done inline.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120206658
2016-06-15 19:39:09 +01:00
olly
4e0638ce06 Remove unnecessary extension of DefaultTrackOutput.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120123489
2016-06-15 19:39:09 +01:00
olly
4451be929d Move sample offset application to RollingSampleBuffer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120123335
2016-06-15 19:39:09 +01:00
olly
ffb4aeaa8c Remove pointless constructor argument.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120123223
2016-06-15 19:39:09 +01:00
olly
17d7a0cb4b Make RollingSampleBuffer implement TrackOutput
This is the first step toward merging of RollingSampleBuffer
and DefaultTrackOutput, which is a precursor to removing some
indirection for DASH/SS playbacks, and to moving HLS playbacks
to use a single output buffer per track (with inline splicing).

Where this is heading is that sample format changes will
eventually be attached to samples in the rolling buffer. This
will eliminate the need for piping sample formats around the
edges of the rolling buffer (e.g. via redirection in
ChunkExtractorWrapper and BaseMediaChunk.getSampleFormat).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120123093
2016-06-15 19:39:09 +01:00
andrewlewis
4161dc8d62 Infer TYPE_SS for .isml.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120119973
2016-06-15 19:39:08 +01:00
olly
5e93c0b6e4 Fix spurious comment.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120115490
2016-06-15 19:39:08 +01:00
olly
fa04c713f6 Discard all sample data for disabled tracks.
There's a more nuanced version of this where we actually
disable on the loading side, but it's quite tricky to get
the threading just right. I have a change that I'll
probably manage to clean up and send out at some point.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120106967
2016-06-15 19:39:08 +01:00
olly
1e4a3c162e Remove setVideoScalingMode call that doesn't do anything.
Oops, forgot this from my previous CL!
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120104992
2016-06-15 19:39:08 +01:00
olly
ed188d1bc8 Apply video scaling mode correctly.
Issue: #1428
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119952373
2016-06-15 19:39:08 +01:00
olly
c99250d9c5 Constant simplification.
- Use same constant for unknown/unset microsecond times/durations.
- Change constant values to be nowhere near the "normal" range.
- Misc cleanup.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119944019
2016-06-15 19:39:08 +01:00
olly
28e926602f Remove layer of indirection when piping sample data.
For DASH + SS, sample data is currently plumbed through:

Extractor
->ChunkExtractorWrapper
->ContainerMediaChunk
->DefaultTrackOutput
->RollingSampleNBuffer

This change bypasses the ContainerMediaChunk layer. It
should be possible to completely delete DefaultTrackOutput
in the future, but such a change may well be tied to
changes in HLS format splicing + how we buffer (or don't
buffer) disabled tracks.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119853857
2016-06-15 19:39:08 +01:00
aquilescanta
7ad34c5c5c Fix hashCode method for TrackSelection
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119842923
2016-06-15 19:39:08 +01:00
andrewlewis
e4ee19513c Remove ExoPlayer.STATE_PREPARING.
prepare(SampleSource) is renamed to setSource(SampleSource). The player
immediately transitions to STATE_BUFFERING when the source is set, at which
point doSomeWork is called.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119838825
2016-06-15 19:39:08 +01:00
olly
3ae1c615d9 LoadControl - Start cleaning up usage somewhat.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119758106
2016-06-15 19:39:07 +01:00
olly
fec7798005 Remove dead code + simplify commitSample.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119752741
2016-06-15 19:39:07 +01:00
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
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
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
olly
733f2ccd1c Add WavExtractor for extracting samples from WAV files.
This version only supports 16-bit uncompressed PCM. A follow-up CL will
add support for other sample bit depths.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117809475
2016-06-15 19:38:06 +01:00
olly
a49c8dc86d Added loadErrorNotification to SingleSampleSource.
Also hooked up DemoPlayer to ExtractorSampleSource events.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117809051
2016-06-15 19:38:06 +01:00
olly
27ab1a2e65 Merge updates from GitHub.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117808998
2016-06-15 19:38:06 +01:00
olly
5b06bfd5a8 Fixed TS+H262 playback when no pts is available
If this situation is encountered, we assume that the encoder has a good reason to
do this and use the last pts + frameDuration as new pts.

Issue: #1295
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117808961
2016-06-15 19:38:06 +01:00
olly
1ca5378cda Track input/output cleanup.
- Remove special DefaultTrackOutput.sampleData method, and have
  SingleSampleMediaChunk use the regular one instead.
- Make DummyTrackOutput behave correctly is allowEndOfInput is
  false.
- Simplify progress tracking in ExtractorSampleSource.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117808659
2016-06-15 19:38:06 +01:00
aquilescanta
60ba7823e0 Add Css styles in the WebVTT parser
This is the first version and is still not linked to the WebVTT parser nor
does it support all the intended features, but it was left this way to
ease the review a little bit.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117722492
2016-06-15 19:38:06 +01:00
olly
e7a27245e7 Use new-style for loops specifically for arrays.
As per: http://developer.android.com/training/articles/perf-tips.html
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117716743
2016-06-15 19:38:06 +01:00
olly
2469f631ae Restore SampleSource.disable API
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117701759
2016-06-15 19:38:06 +01:00
cdrolle
14c5114049 Fixed issue in which unknown sample mime types would cause MediaPresentationDescription to throw an NPE.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117560114
2016-06-15 19:38:06 +01:00
olly
d870f37878 Always use same Format objects during DASH live playbacks.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117558066
2016-06-15 19:38:06 +01:00
olly
0dc0d70397 Use SimpleDecoder for subtitles.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117543706
2016-06-15 19:38:05 +01:00
olly
ed4f83979e Add extensions package to V2.
- Not doing any renaming for now. It'll be easier to wait
  until after the extensions themselves are brought across.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117438338
2016-06-15 19:38:05 +01:00
olly
3c5a509af8 Remove unused method.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117338990
2016-06-15 19:38:05 +01:00
olly
1eff6cf210 Bring back multi-audio and VTT support for HLS.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117338865
2016-06-15 19:38:05 +01:00
andrewlewis
1d4305cb91 Remove redundant modifiers in ExoPlayer.java.
Based on

http://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.3
http://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.5
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117338783
2016-06-15 19:38:05 +01:00
olly
a067bd0965 Make OggVorbisExtractor seekable.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117252304
2016-06-15 19:38:05 +01:00
olly
4ffa3556dd Fix parsing of expandable class size.
Issue #1351
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117252069
2016-06-15 19:38:05 +01:00
olly
378b76363d Support non-square pixels in MKV.
Issue: #1360
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117251799
2016-06-15 19:38:05 +01:00
olly
8b22333ee9 Make default audio capabilities public + update extractor list.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117251647
2016-06-15 19:38:05 +01:00
olly
9777945ce2 Fix the 0 sample count ctts entry bug
When the ctts contained an entry that had a 0-valued entry count, the
parser would miss every other entry, failing the final assertion.
The standard does not seem to prevent the value 0 in the sample_count
field, so we need to allow it.

Issue: #1326
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117241945
2016-06-15 19:38:05 +01:00
olly
f04e412a1c Improve unsupported edts handling
When the edited sample sequence does not contain any sync sample Exoplayer does not provide
support. This CL changes the ArrayIndexOutOfBoundsException for a more explicative
ParserException.

Issue: #1336
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117241805
2016-06-15 19:38:05 +01:00
olly
f5b7ea676d Consider udta box as leaf
The MP4 standard considers the udta box as a regular container box. Quicktime, however,
considers it as a container (of only leaf atoms) that can have a terminating 32 bit
integer with value 0. Since this breaks the principle of not having content in container
boxes, this CL considers the udta box as a leaf box that contains other boxes and does
the parsing manually.

Issue: #1315
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117237255
2016-06-15 19:38:05 +01:00
olly
bbceb459fd Add loading error notification to ExtractorSampleSource
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117237109
2016-06-15 19:38:04 +01:00
olly
6fc8057146 Fix empty container box bug for fMP4 extractor
This fix derives from issue #1308, which came up in unfragmented mp4 files.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117236416
2016-06-15 19:38:04 +01:00
olly
eeddd6d8df Allow multiple renderers with MediaClock as long as only one is enabled.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117236319
2016-06-15 19:38:04 +01:00
olly
d0fa6bdbcc Fix handling of self initializing segments in DASH
The parsing of multiple moov boxes for a single ExtractorOutput incurred in
an assertion failure due to repeated track declarations. This CL makes each
new moov box replace any previous one. This change is transparent to the
client, no flags are provided to allow this feature.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117236246
2016-06-15 19:38:04 +01:00
olly
5f3fa3955b Set default max input size for H.263 and MPEG-4 video.
The minimum compression ratio matches the Nexus 5X MPEG-4 video decoder.

Issue: #1290
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117234657
2016-06-15 19:38:04 +01:00
olly
9d5aa0f983 Fix the build.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117234408
2016-06-15 19:38:04 +01:00
olly
7208819018 Count input buffers.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117228451
2016-06-15 19:38:04 +01:00
olly
0135aaa122 Migrate ExoCache CacheSpan filenames from v1 to v2
V2 supports encoding special characters while on disk.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117228319
2016-06-15 19:37:51 +01:00
olly
1ca32cced8 Fix empty container box bug
If a container box is empty, it is never removed
from the container box stack, breaking the extractor.

Issue: #1308
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117228211
2016-06-15 19:37:45 +01:00
olly
37e00c8c6f Support multiplexed fMP4.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117228173
2016-06-15 19:37:45 +01:00
olly
d20ce3fa16 Added FLAC to the Webm list of known types.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117226935
2016-06-15 19:37:45 +01:00
olly
9a40a4c77d Clean up enabled renderers + processing of resets.
- Made enabledRenderers an array to avoid loads of method calls.
- Made if so that enabled renderers are always called in a consistent
  order, rather than their order changing if they're enabled/disabled
  over time. This is likely to make performance more predictable.
- Split out reading of resets into a separate method. This method is
  now called directly after seeking on the source, so as to ensure
  instant propagation of the new position from source->renderers in
  the common case.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117225639
2016-06-15 19:37:45 +01:00
olly
9b467b7c1b DASH: Ignore stream defined index if manifest defines one.
Issue: #1287
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117225449
2016-06-15 19:37:45 +01:00
olly
ae2e858978 Fix incorrect playback speed of mono audio on MTK/JB devices.
Issue #801
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117225377
2016-06-15 19:37:45 +01:00
olly
8447781a44 Add workaround to discard NAL units up to the first SPS.
Some devices fail to decode an avc3 stream that doesn't start with an SPS (for
example, if an access unit delimiter appears first). Workaround the issue by
discarding input sample data up to the first SPS on those devices.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117224602
2016-06-15 19:37:45 +01:00
olly
fb1d2d9ee8 Add hooks for timestamp checking in MediaCodecTrackRenderer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117224468
2016-06-15 19:37:44 +01:00
olly
26ad44248a Fix a bug where ID3 data was read as sample data.
When reading unknown duration files with CBR seeking, the Mp3Extractor could
try to read sample data from 0. This happened because synchronization did not
skip over the ID3 data when it immediately found valid frames. When the invalid
sample data is read, the extractor tries to resynchronize from the next byte
(at offset 1), and this fails because the ID3 data at the start of the file is
longer than the synchronization search distance.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117224270
2016-06-15 19:37:44 +01:00
olly
d9d6b8540d HLS: Ignore AAC/H264 streams if we know they don't exist.
This is needed to support fully demuxed audio in HLS. For the
sample I have the video (only) variant still declares an AAC
stream. I suspect there's at least one toolchain out there that
hardcodes H264 and AAC streams in TS output.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117224224
2016-06-15 19:37:44 +01:00
olly
9cfff0b028 Merge cleaned version of https://github.com/google/ExoPlayer/pull/1234.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117224172
2016-06-15 19:37:44 +01:00
olly
a1fc0a6b00 Set max input size for H.265/HEVC.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220851
2016-06-15 19:37:44 +01:00
olly
b1c356fbab Simplify (i.e. remove) waiting for first sync frame.
The upstream source (or its stream) should always provide data
starting from a sync frame, so this logic shouldn't be necessary.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220759
2016-06-15 19:37:44 +01:00
olly
b37e9f6980 For both alignment cue setting value and position cue setting alignment value,
allow "center".
This value (and not "middle") is listed in
https://w3c.github.io/webvtt/ ( WebVTT: The Web Video Text Tracks Format, Draft
Community Group Report, 21 December 2015).

Leaving the behavior for "middle" unchanged.
It was the value listed in older drafts, e.g.
https://www.w3.org/TR/2014/WD-webvtt1-20141113/ ( W3C First Public Working
Draft 13 November 2014 )
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220612
2016-06-15 19:37:44 +01:00
olly
16f57e3919 Ignore repeated control characters in EIA608 subtitles.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220536
2016-06-15 19:37:44 +01:00
olly
a1c74cb259 Give a calculation for H.264 level picture size limits.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220482
2016-06-15 19:37:44 +01:00
olly
5a6d1435ab Fix overzealous ContentProtection filtering.
Failing to parse a UUID from a ContentProtection should only
result in filtering if there was actually a cenc:pssh element
there for us to get it from.

Issue: #1256
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220417
2016-06-15 19:37:44 +01:00
olly
bccffb017d Cleanup - Make PesReader classes static.
This avoids accessing PtsTimestampAdjuster through a thunk method,
and allows the PesReader classes to be static, which is nice in
general.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220139
2016-06-15 19:37:44 +01:00
olly
a1a48abe92 Apply gapless playback metadata for MP3/MP4 playback using MediaCodec.
Issue: #497
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117219944
2016-06-15 19:37:43 +01:00
olly
ba88091c7b Added MPEG2-Program Stream extractor.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117219856
2016-06-15 19:37:43 +01:00
olly
2b4dcbef3f Fix parsing of version 1 pssh boxes, and ignore version 2+.
Issue: #1195
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117155301
2016-06-15 19:37:43 +01:00
olly
64d7f2f846 Deduplicate functions for parsing hex strings.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117149421
2016-06-15 19:37:43 +01:00
olly
554817cca6 Extract gapless playback data in MP4 files.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117148015
2016-06-15 19:37:43 +01:00
olly
2380857bf2 Clip the skip length in DefaultExtractorInput.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117141509
2016-06-15 19:37:43 +01:00
olly
a6ba84ade6 Update Mpd parser duration calculation.
Set the duration to the sum of the final period's start
+ duration (if available) if MPD@mediaPresentationDuration
isn't set in the manifest.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117141391
2016-06-15 19:36:30 +01:00
olly
61adcf98d2 Fix issue seeking backward when using SingleSampleSource.
Issue: #1193
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117136800
2016-06-15 19:36:30 +01:00
olly
c98f7e8348 Fixed the Mp4 embedded WebVTT playback
Issue: #1185
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117136646
2016-06-15 19:36:29 +01:00
olly
028ce2582c Fix handling of extended ID3 tags in MPEG-TS/HLS.
Issue #1181
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117136370
2016-06-15 19:36:29 +01:00
olly
b76db7acd2 Fix Javadoc typo.
Issue: #1235
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117131149
2016-06-15 19:36:29 +01:00
olly
9d732d8c27 Robustness fixes for WebM extractor.
- readFully calls when reading a string or varint may have 0 length.
  The behavior of a 0 length read isn't well defined either at the
  ExtractorInput or DataSource level, particularly when the read may
  also coincide with EOS. We'll work on defining these cases properly
  going forward, but in the meantime this fix avoids attempting 0
  length reads.
- [Aside] UTF8 the is guaranteed default charset on Android.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117130356
2016-06-15 19:36:29 +01:00
olly
9f4e46bd3c Discard CSD buffers from the raw decoder in passthrough mode.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117129870
2016-06-15 19:36:29 +01:00
olly
835a9e9abe Use a separate MIME type for DTS Express.
DTS Express (which is DTS LBR according to http://www.mp4ra.org/codecs.html) is
not supported for passthrough playback currently. Associate a different MIME
type with it so that we don't try to use DTS passthrough for playing DTS
Express.

The MIME type for DTS Express is just vnd.dts.hd, with a profile parameter
indicating that it's DTS Express rather than one of the other formats.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117129583
2016-06-15 19:36:29 +01:00
olly
e116125c40 DashChunkSource: Handle minor timing differences
Handle minor timing difference between the different media content
and the available range values as specified in the MPD.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117127112
2016-06-15 19:06:46 +01:00
olly
c2eb9d5598 Disable funky FRC on L on nVidia shield.
The logic in the platform was causing captions and the reported
playback position to gradually drift out of sync with respect to
audio and video.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117126970
2016-06-15 18:54:51 +01:00
olly
8ef4af1358 Fix incorrect position calculation in VBRI seeker.
Issue: #1197
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117125081
2016-06-15 18:54:51 +01:00
olly
d3d63101d1 [Refactor - Step #5] Introduce TrackSelector
Notes:

- The way this works is that every time the player needs to
  select some tracks it invokes the TrackSelector. When a
  track selection is actually activated (i.e. "hits the
  screen") it gets passed back to the TrackSelector, which
  allows it to expose the current tracks through an API that
  it may choose to define. Since playlist support doesn't exist
  yet, it's currently the case that the pass-back always occurs
  immediately.
- A TrackSelector can invalidate its previous selections if its
  selection criteria changes. This will force the player to invoke
  it again to make a new selection. If the new selection is the
  same as the previous one for a renderer then the player handles
  this efficiently (i.e. turns it into a no-op).
- DefaultTrackSelector supports disabling/enabling of renderers.
  Separately, it supports overrides to select specific formats.
  Since formats may change (playlists/periods), overrides are
  specific to not only the renderer but also the set of formats
  that are available to it. If the formats available to a renderer
  change then the override will no longer apply. If the same set
  of formats become available at some point later, it will apply
  once more. This will nicely handle cases like ad-insertion where
  the ads have different formats, but all segments of main content
  use the same set of formats.
- In general, in  multi-period or playlist cases, the preferred
  way of selecting formats will be via constraints (e.g. "don't play
  HD", "prefer higher quality audio") rather than explicit format
  selections. The ability to set various constraints on
  DefaultTrackSelector is future work.

Note about the demo app:

- I've removed the verbose log toggle. I doubt anyone has
  ever used it! I've also removed the background audio option.
  Without using a service it can't be considered a reference
  implementation, so it's probably best to leave developers to
  figure this one out. Finally, listening to AudioCapabilities
  has also gone. This will be replaced by having the player
  detect and handle the capabilities change internally in a
  future CL. This will work by allowing a renderer to invalidate
  the track selections when its capabilities change, much like
  how a selector is able to invalidate the track selections in
  this CL.
- It's now possible to enable ABR with an arbitrary subset of
  tracks.
- Unsupported tracks are shown grayed out in the UI. I'm not
  showing tracks that aren't associated to any renderer, but we
  could optionally add that later.
- Every time the tracks change, there's logcat output showing
  all of the tracks and which ones are enabled. Unassociated
  tracks are displayed in this output.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117122202
2016-06-15 18:54:51 +01:00
olly
9c98c4bb10 Make Track[Group|GroupArray|Selection] consistent.
- I don't think the length is useful in hashCode; if the length
  is different then Arrays.hashCode should account for that.
- "this." just for consistency across these classes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=116641142
2016-06-15 18:54:51 +01:00
olly
00191848f7 Make TrackSelection implement equals/hashCode.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=116638211
2016-06-15 18:54:51 +01:00
olly
73400907fc Introduce TrackGroupArray.
This change replaces TrackGroup[] with TrackGroupArray. This is
to allow equality based hashCode and equals implementations.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=115563146
2016-06-15 18:54:51 +01:00
olly
d1cb4bc1af Fix hasSampleFormat in experimental version. Oops!
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=115561885
2016-06-15 18:54:51 +01:00
olly
1208d8ec75 Allow more precise reporting of format support.
This change allows a TrackRenderer to distinguish between the
"I don't support this type at all" case and the "I am a general
purpose renderer of this type, but cannot support the specific
subtype" case.

Bug=26622675
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=115454950
2016-06-15 18:54:51 +01:00
olly
6ba4fa3b51 Make SampleSource interfaces right for TrackSelector.
The TrackSelector API will look like:

TrackSelection[] selectTrack(
    TrackRenderer[] renderers, TrackGroup[] trackGroups);

In this CL:

- SampleSources return TrackGroup[], so that the result can be easily
  passed to the selector.
- TrackStream gets its own file to sit alongside other Track* classes.
- A TrackSelection object is introduced to encapsulate group and track
  indices.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=115251331
2016-06-15 18:54:51 +01:00
olly
39a924451a Return format and adaptation support from single method.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=114963314
2016-06-15 18:54:51 +01:00
olly
0e60335064 Add structure to ExoPlaybackException.
- Add a top level failure type (source/renderer/unexpected),
  and convenience methods for retrieving the underlying cause
  without needing to cast.
- Also add renderer index in the case of renderer failures.
- setIndex/getIndex is a little . . . unclean, but alternatives
  involve either having the top line of the stack trace be a
  non-interesting line, or loads of try/catch blocks in
  ExoPlayerImplInternal.

Issue: #777
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=114763073
2016-06-15 18:54:51 +01:00
olly
c48dd4f3e3 Use FormatEvaluator for HLS.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=114743795
2016-06-15 18:54:51 +01:00
olly
a7adcce018 One Format object to rule them all.
- Format can represent both container and sample formats.
  If a container contains a single track (as is true in
  DASH and SmoothStreaming) then the container Format can
  also contain sufficient information about the samples
  to allow for track selection. This avoids the Format to
  MediaFormat conversions that we were previously doing in
  ChunkSource implementations.

- One important result of this change is that adaptive
  format evaluation and static format selection now use the
  same format objects, which is a whole lot less confusing
  for someone who wants to implement both initial selection
  and subsequent adaptation logic. It's not in the V2 doc,
  but it may well make sense if the TrackSelector not only
  selects the tracks to enable for an adaptive playback, but
  also injects a FormatEvaluator when enabling them that will
  control the subsequent adaptive selections. That would make
  it so that all format selection logic originates from the
  same place.

- As part of this change, the adaptiveX variables are removed
  from the format object; they don't really correspond to a
  single format. This also saves on having to inject the max
  video dimensions through a bunch of classes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=114546777
2016-06-15 18:54:50 +01:00
olly
362d0400cd Don't pass chunk list to ChunkSource.disable().
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=114545827
2016-06-15 18:54:50 +01:00
olly
782817d524 Remove durationUs from MediaFormat.
Duration was originally included in MediaFormat to match the
framework class, but it actually doesn't make much sense. In
many containers there's no such thing as per-stream duration,
and in any case we don't really care. Setting the duration on
each format required excessive piping.

This change moves duration into SeekMap instead, which seems
to make a lot more sense because it's at the container level,
and because being able to seek is generally couplied with
knowing how long the stream is.

This change is also a step toward merging Format and MediaFormat
into a single class (because Format doesn't have a duration),
which is coming soon.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=114428500
2016-06-15 18:54:50 +01:00
olly
ebf87a3619 Simplify codec configuration.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=114427767
2016-06-15 18:54:50 +01:00
olly
335bb0aff2 Implement decoder capability checks in MediaCodecTrackRenderers.
[Step 4 - Partial, of []

- The capabilities checks previously performed in VideoFormatSelectorUtil
  are now performed in MediaCodecVideoTrackRenderer. This means they'll be
  useful for non-chunk use cases (e.g. when using ExtractorSampleSource).
- Added capabilities checks for audio in MediaCodecAudioTrackRenderer. We
  didn't check audio capabilities previously.
- Added functionality to allow a TrackRenderer to indicate the extent of
  its adaptive support.

The idea here is that a TrackSelector (to be introduced) will have access to:

(a) TrackGroups from the SampleSource that indicate whether they support
adaptive playbacks and the formats of each individual track.
(b) TrackRenderers that indicate whether they support adaptive playbacks as
well as how capable they are of rendering formats of individual tracks.

This is everything that a TrackSelector needs from the player components in
order to decide how to wire things up. Note that a TrackSelector may opt to
treat FORMAT_EXCEEDS_CAPABILITIES as FORMAT_HANDLED at its own risk, if it
thinks that it (or the user) knows better. This is a request that we've seen
from third parties for better handling cases where capabilities aren't
accurately reported by the underlying platform.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=114427428
2016-06-15 18:54:50 +01:00
cblay
6bc52262db Minor tweaks/fixes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=113868179
2016-06-15 18:54:38 +01:00
olly
43e1e7e83a ExoPlayer V2 Refactor - Misc
Delete SingleSampleChunkSource. I don't think it's really
useful for anything, now we have SingleSampleSource.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=113259289
2016-06-15 18:54:38 +01:00
olly
ce324f1ca9 ExoPlayer V2 Refactor - Step 7 (partial)
This change removes the need for SourceBuilders to load their
manifests before building their sources. This is done by pushing
initial manifest loads into the ChunkSource classes. This simplifies
the SourceBuilders a lot, and also DemoPlayer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=113259259
2016-06-15 18:54:38 +01:00
olly
be47148940 ExoPlayer V2 Refactor - Step 4
Notes:
1. The logic in ExoPlayerImplInternal is very temporary, until we
   have proper TrackSelector implementations. Ignore the fact that
   it's crazy and has loads of nesting.
2. This change removes all capabilities checking. TrackRenderer
   implementations will be updated to perform these checks in a
   subsequent CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=113151233
2016-06-15 18:54:26 +01:00
olly
6cb20525cb ExoPlayer V2 Refactor - Step 3
Move binding of tracks<->renderers to ExoPlayerImplInternal.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=113046018
2016-06-15 18:54:26 +01:00
olly
cdae9ac5d2 ExoPlayer V2 Refactor - Steps 1/2.
GitHub note - Apologies for the cryptic change descriptions,
they relate to a design doc that's not externally visible.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=113043764
2016-06-15 18:53:40 +01:00
Oliver Woodman
61d581fe44 Prepare for 2.x push 2016-06-15 13:36:09 +01:00
Oliver Woodman
39a7cea987 Bump version to 1.5.4 2016-01-22 16:07:16 +00:00
andrewlewis
a9720457d8 Add support for playing DTS in HLS.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112774678
2016-01-22 13:37:31 +00:00
olly
7bf8080950 ExoPlayer: Remove deprecated methods.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112736771
2016-01-22 12:11:16 +00:00
olly
d804446b34 Implement seeking via a single code path.
When a seek is performed, renderers currently perform the
actions that they need to take in two places: Some changes
are performed in seekTo implementations. Other changes are
performed when discontinuities are read from the source.

In HLS we need to perform what is effectively a seek
originating in the source. To support this, this CL allows
discontinuities read from the source to modify the playback
position. All actions that renderers perform as a result
of a seek are moved to be performed when a discontinuity is
received.

Best way to understand CL:
- Look at SampleSource interface change and then at the
  concrete implementations, to make sure they've been
  changed properly.
- Look at SampleSourceTrackRenderer change.
- Look at concrete renderers. The general pattern is that
  code previously performed in seekTo and READ_DISCONTINUITY
  is merged into onDiscontinuity().

Note: This will be further untangled in V2.

Issue #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112720746
2016-01-22 12:11:16 +00:00
andrewlewis
3f0244e214 Read gapless playback metadata in files with Xing metadata.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112699916
2016-01-22 12:11:16 +00:00
andrewlewis
9d89d48f56 Fix ParsableByteArrayTest.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112693523
2016-01-22 12:11:16 +00:00
andrewlewis
588d5a6e55 Parse encoder delay and padding from ID3 metadata in MP3.
Based on AOSP's MP3Extractor.cpp and ID3.cpp.

Issue: #497
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112685664
2016-01-22 12:11:15 +00:00
andrewlewis
25fb2a826e Merge MP3 sniffing/synchronization functionality.
As part of this change, Extractor.sniff may read/skip (not just peek) if it
returns true. This allows Extractors to avoid parsing the input a second time in
read.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112683272
2016-01-22 12:11:15 +00:00