Use customCacheKey in DownloadHelper.createMediaSource

Issue: #6870
PiperOrigin-RevId: 289658261
This commit is contained in:
olly 2020-01-14 16:36:16 +00:00 committed by Oliver Woodman
parent 3feb263cfe
commit cea37c60f8
3 changed files with 11 additions and 7 deletions

View File

@ -11,8 +11,15 @@
* Rename `MediaCodecRenderer.onOutputFormatChanged` to
`MediaCodecRenderer.onOutputMediaFormatChanged`, further
clarifying the distinction between `Format` and `MediaFormat`.
* Downloads: Merge downloads in `SegmentDownloader` to improve overall download
* Downloads:
* Merge downloads in `SegmentDownloader` to improve overall download
speed ([#5978](https://github.com/google/ExoPlayer/issues/5978)).
* Fix handling of network transitions in `RequirementsWatcher`
([#6733](https://github.com/google/ExoPlayer/issues/6733)). Incorrect
handling could previously cause downloads to be paused when they should have
been able to proceed.
* Fix `DownloadHelper.createMediaSource` to use `customCacheKey` when creating
`ProgressiveMediaSource` instances.
* In MP4 streams, store the Android capture frame rate only in
`Format.metadata`. `Format.frameRate` now stores the calculated frame rate.
* Add `play` and `pause` methods to `Player`.
@ -28,10 +35,6 @@
developers to handle data that's neither UTF-8 nor ISO-8859-1
([#6753](https://github.com/google/ExoPlayer/issues/6753)).
* Add playlist API ([#6161](https://github.com/google/ExoPlayer/issues/6161)).
* Fix handling of network transitions in `RequirementsWatcher`
([#6733](https://github.com/google/ExoPlayer/issues/6733)). Incorrect handling
could previously cause downloads to be paused when they should have been able
to proceed.
* Fix handling of E-AC-3 streams that contain AC-3 syncframes
([#6602](https://github.com/google/ExoPlayer/issues/6602)).
* Fix playback of TrueHD streams in Matroska

View File

@ -448,6 +448,7 @@ public final class DownloadHelper {
break;
case DownloadRequest.TYPE_PROGRESSIVE:
return new ProgressiveMediaSource.Factory(dataSourceFactory)
.setCustomCacheKey(downloadRequest.customCacheKey)
.createMediaSource(downloadRequest.uri);
default:
throw new IllegalStateException("Unsupported type: " + downloadRequest.type);

View File

@ -111,7 +111,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
* @return This factory, for convenience.
* @throws IllegalStateException If {@link #createMediaSource(Uri)} has already been called.
*/
public Factory setCustomCacheKey(String customCacheKey) {
public Factory setCustomCacheKey(@Nullable String customCacheKey) {
Assertions.checkState(!isCreateCalled);
this.customCacheKey = customCacheKey;
return this;