1278 Commits

Author SHA1 Message Date
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
Oliver Woodman
7d9007af28 Update release notes 2016-01-22 16:07:09 +00:00
aquilescanta
a8a9e0de2a Removed permissions from the library manifest
Fixes: #1176
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112781092
2016-01-22 15:07:00 +00:00
olly
da2752137b Add proguard config for Opus extension.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112776882
2016-01-22 13:58:57 +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
Oliver Woodman
a02fd14c31 Fix Eclipse project for library tests. 2016-01-22 12:19:49 +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
4bea0b184f Fix warnings in OggVorbisExtractorTest and VorbisBitArrayTest.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112699244
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
bed89730a7 Fix path to Mockito for Eclipse.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112691130
2016-01-22 12:11:15 +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
andrewlewis
e6637c50c2 Fix a couple of compilation warnings.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112676296
2016-01-22 12:11:15 +00:00
Oliver Woodman
89ce1ccedf OggVorbisExtractor (WIP - Seeking not yet enabled) 2016-01-22 11:46:37 +00:00
Oliver Woodman
88fa1495c4 Use consistent naming for Xing headers/tags.
Also fix a couple of style nits.
2016-01-22 11:40:27 +00:00
Oliver Woodman
cef1f12f1d Add readString to ParsableByteArray 2016-01-22 11:40:02 +00:00
Oliver Woodman
eda8ac4e01 Add eventSourceId to onAvailableRangeChange events 2016-01-22 11:38:06 +00:00
Oliver Woodman
00068c8954 Add vpx extension playback test. 2016-01-22 11:36:21 +00:00
andrewlewis
783467b8fb Work around broken MP3 decoder.
Issue: #398
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112412961
2016-01-18 19:22:47 +00:00
olly
a049382cd7 Treat seeks in HLS live to be at t=0, as in ExtractorSampleSource.
This makes sense until we need to support seeking in the live window.

Issue: #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112402026
2016-01-18 19:22:47 +00:00
olly
cef0f7a0b1 Apply flush workaround on S5 Mini devices with Exynos chipset.
Also apply the workaround for the secure variant of OMX.SEC.avc.dec.
Note that it's not necessary to do the same for the RK decoder in
the method below, since that workaround is targeted at SDK_INT<=17
and secure decoders only came along in 18.

Issue: #603
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112395376
2016-01-18 19:22:47 +00:00
ojw28
c01d0096ab Merge pull request #1155 from bartsidee/1095-dev
link track language attribute in Smoothstream parser
2016-01-16 15:37:07 +00:00
Bart van den Ende
8e1f14cbc3 resolve #1095 get language for all types, not just audio 2016-01-16 12:35:32 +01:00
Bart van den Ende
d5425bb64a resolve #1095 store the language as normalised attribute so we can access it from the track parser 2016-01-16 12:35:23 +01:00
Bart van den Ende
19cf24234c resolve #1095 map the audio track language to the element parser instead of the track parser 2016-01-16 12:35:04 +01:00
Oliver Woodman
9ab6c96169 Make TtmlColorParser comment a little clearer. 2016-01-15 19:18:19 +00:00
Oliver Woodman
c60dac7c46 Further tweaks to TTML color parsing. 2016-01-15 19:13:58 +00:00
Oliver Woodman
7974a61476 Fix TtmlColorParser test.
Also simplify the implementation slightly.
2016-01-15 19:06:27 +00:00
Oliver Woodman
afafd08346 Merge branch 'aptly-io-fix_rgba_color_tuple' into dev 2016-01-15 18:53:39 +00:00
Oliver Woodman
b5c8595655 Resolve merge conflict 2016-01-15 18:53:30 +00:00
andrewlewis
284b7e7f28 Comment (e-)AC-3/DTS descriptor tags.
Also, use terminology from ATSC spec in Ac3Util comment.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112254908
2016-01-15 18:49:03 +00:00
andrewlewis
0900c53564 Set the passthrough buffer size based on encoded format bit rates.
After this change, AC-3 uses about 20 KB and DTS uses 49 KB.

For comparison, 'normal' PCM playbacks use by default (depending on the device
and input format) about 45 KB. For passthrough, the following buffer sizes were
used before this change:
- Nexus Player AC-3: 23 KB
- Nexus Player DTS: 25 KB
- NVIDIA Shield AC-3: 15 KB
- NVIDIA Shield DTS: 16 KB (caused underruns in some DTS-HD playbacks)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112254836
2016-01-15 18:48:24 +00:00