HlsChunkSource: Don't reload the same chunk twice when switching variants

This is wasteful and especially troublesome when we need to switch down
to keep up with the stream. Downloading the same chunk twice, once with
old bitrate and once with new often causes buffering.
Add EXT-X-BYTERANGE support #139
Fix for IV bigger than 32 bits #145
Revert "EncryptionKeyChunk: Don't try to parse too big values as Integer"

This reverts commit 864b7eadaec7494170cb377ea8c94143448fa583.
Merge remote-tracking branch 'upstream/dev-hls' into dev-hls
HlsSampleSource: Improve Loadable exception handling

If we encounter a non fatal error, eg a socket timeout, during load
we want to try again a few times. This doesn't always happen though
since some code paths always throw when a loadable exception is
seen.

For non fatal exceptions, allow 5 retries. Mark invalid http response
codes as fatal as there's no need to retry if we get 404, 403 etc.

Signed-off-by: Jonas Larsson <jonas@hallerud.se>
TsChunk: Restart at the correct position after a failure

TsChunk lets a TsExtractor read straght from the DataSource until
the number of read bytes is -1. If the DataSource encounters an
error while reading, eg socket timeout, and exception is thrown
and HlsSampleSource will retry loading. When retrying TsChunk
starts at the old loadPosition. But since the TsExtractor has
already read some bytes at the old loadPosition it gets confused.
Quite often this manifests as an assertion in TsExtractor.read:
Assertions.checkState(packetLength == 0);

Socket failures during read is quite common on unreliable networks
such as mobile. By increasing the loadPosition by number of bytes
read we can retry at the current position without confusing the
extractor.

Signed-off-by: Jonas Larsson <jonas@hallerud.se>
EncryptionKeyChunk: Don't try to parse too big values as Integer

IVs can be way too big for integer, resulting in exceptions like
NumberFormatException: Invalid int: "8bebc5019dd7301db52130f579d42f8c"

Instead of parsing as an int and formatting the parsed int as String
to do zero padding, pad as String and convert the result char by
char to construct the padded IV byte[] representation.

Signed-off-by: Jonas Larsson <jonas@hallerud.se>