Looking up a long in a HashSet<Long> auto boxes the long and leaves
it for the GC. As decodeOnly is relatively infrequent it's much
better to do a simple linear search in a List<Long>. That way
we can avoid boxing every incoming time stamp value. In the general
case this will be linear searching in an empty list, a very fast
operation.
Signed-off-by: Jonas Larsson <jonas@hallerud.se>
AudioTrack contains the portions of MediaCodecAudioTrackRenderer that handle the
platform AudioTrack instance, including synchronization (playback position
smoothing), non-blocking writes and releasing.
This refactoring should not affect the behavior of audio playback, and is in
preparation for adding an Ac3PassthroughAudioTrackRenderer that will use the
AudioTrack.
Passing uncropped dimensions to certain decoders will make them
output frames without proper cropping set.
Signed-off-by: Jonas Larsson <jonas@hallerud.se>
- Add a readBit method to BitsArray for reading a boolean flag.
- Make things accessed from inner classes package visibility to avoid
the compiler generating thunk methods.
- The HlsSampleSource now owns the extractor. TsChunk is more or less dumb.
The previous model was weird, because you'd end up "reading" samples from
TsChunk objects that were actually parsed from the previous chunk (due to
the way the extractor was shared and maintained internal queues).
- Split out consuming and reading in the extractor.
- Make it so we consume 5s ahead. This is a window we allow for uneven
interleaving, whilst preventing huge read-ahead (e.g. in the case of sparse
ID3 samples).
- Avoid flushing the extractor for a discontinuity until it has been fully
drained of previously parsed samples. This avoids skipping media shortly
before discontinuities.
- Also made start-up faster by avoiding double-loading the first segment.
Issue: #3