1074 Commits

Author SHA1 Message Date
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
99606f6e2e Allow equality assertions on FakeExtractorOutput.
The idea here is that you'll be able to feed data through an extractor
to a FakeExtractorOutput, then do the same again with some or all of the
simulated flakiness settings toggled on FakeExtractorInput, and then
assert that the output was the same in both cases.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117224019
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
7cddd1b1d9 Move OGG extractor to use FakeExtractorInput + Simplify.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220360
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
300b58e530 Introduce FakeExtractorInput (based loosely on RecordableExtractorInput).
- Use it to simplify a bunch of tests.
- Will also replace RecordableExtractorInput in a subsequent CL.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220030
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
c8d81abd52 WebM extractor tests: Fix up byte/int conversions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117131005
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