Enable GZIP for SingleSampleMediaSource

Issue: #4771

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212623142
This commit is contained in:
olly 2018-09-12 05:30:06 -07:00 committed by Oliver Woodman
parent a5a7e988e3
commit b4dfed874d
2 changed files with 4 additions and 1 deletions

View file

@ -113,6 +113,8 @@
`MediaCodecRenderer`, and provide an (optional) `MediaCodecSelector` that
falls back to less preferred decoders like `MediaCodec.createDecoderByType`
([#273](https://github.com/google/ExoPlayer/issues/273)).
* Enable gzip for requests made by `SingleSampleMediaSource`
([#4771](https://github.com/google/ExoPlayer/issues/4771)).
* Fix bug reporting buffered position for multi-period windows, and add
convenience methods `Player.getTotalBufferedDuration` and
`Player.getContentBufferedDuration`

View file

@ -287,7 +287,8 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
this.durationUs = durationUs;
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
this.treatLoadErrorsAsEndOfStream = treatLoadErrorsAsEndOfStream;
dataSpec = new DataSpec(uri);
dataSpec =
new DataSpec(uri, DataSpec.FLAG_ALLOW_GZIP | DataSpec.FLAG_ALLOW_CACHING_UNKNOWN_LENGTH);
timeline =
new SinglePeriodTimeline(durationUs, /* isSeekable= */ true, /* isDynamic= */ false, tag);
}