From 74e2384fb6e129e273f955616ad31aa127f505d4 Mon Sep 17 00:00:00 2001 From: tonihei Date: Thu, 23 Aug 2018 02:00:37 -0700 Subject: [PATCH] Add response headers to LoadEventInfo. The response headers of the last load are available from the loading source when creating media source events and can be easily forwarded. Issue:#4361 Issue:#4615 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=209900693 --- RELEASENOTES.md | 4 ++ .../source/ExtractorMediaPeriod.java | 4 +- .../source/MediaSourceEventListener.java | 47 +++++++++++++++---- .../source/SingleSampleMediaPeriod.java | 4 +- .../exoplayer2/source/ads/AdsMediaSource.java | 3 ++ .../source/chunk/ChunkSampleStream.java | 4 +- .../exoplayer2/upstream/ParsingLoadable.java | 10 ++++ .../source/dash/DashMediaSource.java | 8 +++- .../source/hls/HlsSampleStreamWrapper.java | 4 +- .../playlist/DefaultHlsPlaylistTracker.java | 8 +++- .../source/smoothstreaming/SsMediaSource.java | 6 ++- .../exoplayer2/testutil/FakeMediaPeriod.java | 3 +- .../exoplayer2/testutil/FakeMediaSource.java | 3 ++ 13 files changed, 88 insertions(+), 20 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 86cef02a1b7..23950c958fd 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -101,6 +101,10 @@ * Add uri field to `LoadEventInfo` in `MediaSourceEventListener` or `AnalyticsListener` callbacks. This uri is the redirected uri if redirection occurred ([#2054](https://github.com/google/ExoPlayer/issues/2054)). +* Add response headers field to `LoadEventInfo` in `MediaSourceEventListener` or + `AnalyticsListener` callbacks + ([#4361](https://github.com/google/ExoPlayer/issues/4361) and + [#4615](https://github.com/google/ExoPlayer/issues/4615)). * Allow `MediaCodecSelector`s to return multiple compatible decoders for `MediaCodecRenderer`, and provide an (optional) `MediaCodecSelector` that falls back to less preferred decoders like `MediaCodec.createDecoderByType` diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaPeriod.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaPeriod.java index d26695afa77..7e44322f200 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaPeriod.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaPeriod.java @@ -503,6 +503,7 @@ public void onLoadCompleted(ExtractingLoadable loadable, long elapsedRealtimeMs, eventDispatcher.loadCompleted( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), + loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, @@ -524,6 +525,7 @@ public void onLoadCanceled(ExtractingLoadable loadable, long elapsedRealtimeMs, eventDispatcher.loadCanceled( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), + loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, @@ -570,6 +572,7 @@ public LoadErrorAction onLoadError( eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), + loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, @@ -697,7 +700,6 @@ private void startLoading() { loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(dataType)); eventDispatcher.loadStarted( loadable.dataSpec, - loadable.dataSpec.uri, C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceEventListener.java b/library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceEventListener.java index 844534a43df..98d1d0a2ab0 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceEventListener.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceEventListener.java @@ -28,6 +28,9 @@ import com.google.android.exoplayer2.upstream.DataSpec; import com.google.android.exoplayer2.util.Assertions; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; /** Interface for callbacks to be notified of {@link MediaSource} events. */ @@ -44,6 +47,8 @@ final class LoadEventInfo { * after redirection. */ public final Uri uri; + /** The response headers associated with the load, or an empty map if unavailable. */ + public final Map> responseHeaders; /** The value of {@link SystemClock#elapsedRealtime} at the time of the load event. */ public final long elapsedRealtimeMs; /** The duration of the load up to the event time. */ @@ -58,6 +63,8 @@ final class LoadEventInfo { * @param uri The {@link Uri} from which data is being read. The uri must be identical to the * one in {@code dataSpec.uri} unless redirection has occurred. If redirection has occurred, * this is the uri after redirection. + * @param responseHeaders The response headers associated with the load, or an empty map if + * unavailable. * @param elapsedRealtimeMs The value of {@link SystemClock#elapsedRealtime} at the time of the * load event. * @param loadDurationMs The duration of the load up to the event time. @@ -65,9 +72,15 @@ final class LoadEventInfo { * network responses, this is the decompressed size. */ public LoadEventInfo( - DataSpec dataSpec, Uri uri, long elapsedRealtimeMs, long loadDurationMs, long bytesLoaded) { + DataSpec dataSpec, + Uri uri, + Map> responseHeaders, + long elapsedRealtimeMs, + long loadDurationMs, + long bytesLoaded) { this.dataSpec = dataSpec; this.uri = uri; + this.responseHeaders = responseHeaders; this.elapsedRealtimeMs = elapsedRealtimeMs; this.loadDurationMs = loadDurationMs; this.bytesLoaded = bytesLoaded; @@ -168,7 +181,8 @@ public MediaLoadData( * @param mediaPeriodId The {@link MediaPeriodId} this load belongs to. Null if the load does not * belong to a specific media period. * @param loadEventInfo The {@link LoadEventInfo} corresponding to the event. The value of {@link - * LoadEventInfo#uri} won't reflect potential redirection yet. + * LoadEventInfo#uri} won't reflect potential redirection yet and {@link + * LoadEventInfo#responseHeaders} will be empty. * @param mediaLoadData The {@link MediaLoadData} defining the data being loaded. */ void onLoadStarted( @@ -370,10 +384,9 @@ public void mediaPeriodReleased() { } /** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */ - public void loadStarted(DataSpec dataSpec, Uri uri, int dataType, long elapsedRealtimeMs) { + public void loadStarted(DataSpec dataSpec, int dataType, long elapsedRealtimeMs) { loadStarted( dataSpec, - uri, dataType, C.TRACK_TYPE_UNKNOWN, null, @@ -387,7 +400,6 @@ public void loadStarted(DataSpec dataSpec, Uri uri, int dataType, long elapsedRe /** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */ public void loadStarted( DataSpec dataSpec, - Uri uri, int dataType, int trackType, @Nullable Format trackFormat, @@ -398,7 +410,12 @@ public void loadStarted( long elapsedRealtimeMs) { loadStarted( new LoadEventInfo( - dataSpec, uri, elapsedRealtimeMs, /* loadDurationMs= */ 0, /* bytesLoaded= */ 0), + dataSpec, + dataSpec.uri, + /* responseHeaders= */ Collections.emptyMap(), + elapsedRealtimeMs, + /* loadDurationMs= */ 0, + /* bytesLoaded= */ 0), new MediaLoadData( dataType, trackType, @@ -423,6 +440,7 @@ public void loadStarted(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData public void loadCompleted( DataSpec dataSpec, Uri uri, + Map> responseHeaders, int dataType, long elapsedRealtimeMs, long loadDurationMs, @@ -430,6 +448,7 @@ public void loadCompleted( loadCompleted( dataSpec, uri, + responseHeaders, dataType, C.TRACK_TYPE_UNKNOWN, null, @@ -446,6 +465,7 @@ public void loadCompleted( public void loadCompleted( DataSpec dataSpec, Uri uri, + Map> responseHeaders, int dataType, int trackType, @Nullable Format trackFormat, @@ -457,7 +477,8 @@ public void loadCompleted( long loadDurationMs, long bytesLoaded) { loadCompleted( - new LoadEventInfo(dataSpec, uri, elapsedRealtimeMs, loadDurationMs, bytesLoaded), + new LoadEventInfo( + dataSpec, uri, responseHeaders, elapsedRealtimeMs, loadDurationMs, bytesLoaded), new MediaLoadData( dataType, trackType, @@ -483,6 +504,7 @@ public void loadCompleted(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadDa public void loadCanceled( DataSpec dataSpec, Uri uri, + Map> responseHeaders, int dataType, long elapsedRealtimeMs, long loadDurationMs, @@ -490,6 +512,7 @@ public void loadCanceled( loadCanceled( dataSpec, uri, + responseHeaders, dataType, C.TRACK_TYPE_UNKNOWN, null, @@ -506,6 +529,7 @@ public void loadCanceled( public void loadCanceled( DataSpec dataSpec, Uri uri, + Map> responseHeaders, int dataType, int trackType, @Nullable Format trackFormat, @@ -517,7 +541,8 @@ public void loadCanceled( long loadDurationMs, long bytesLoaded) { loadCanceled( - new LoadEventInfo(dataSpec, uri, elapsedRealtimeMs, loadDurationMs, bytesLoaded), + new LoadEventInfo( + dataSpec, uri, responseHeaders, elapsedRealtimeMs, loadDurationMs, bytesLoaded), new MediaLoadData( dataType, trackType, @@ -546,6 +571,7 @@ public void loadCanceled(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadDat public void loadError( DataSpec dataSpec, Uri uri, + Map> responseHeaders, int dataType, long elapsedRealtimeMs, long loadDurationMs, @@ -555,6 +581,7 @@ public void loadError( loadError( dataSpec, uri, + responseHeaders, dataType, C.TRACK_TYPE_UNKNOWN, null, @@ -576,6 +603,7 @@ public void loadError( public void loadError( DataSpec dataSpec, Uri uri, + Map> responseHeaders, int dataType, int trackType, @Nullable Format trackFormat, @@ -589,7 +617,8 @@ public void loadError( IOException error, boolean wasCanceled) { loadError( - new LoadEventInfo(dataSpec, uri, elapsedRealtimeMs, loadDurationMs, bytesLoaded), + new LoadEventInfo( + dataSpec, uri, responseHeaders, elapsedRealtimeMs, loadDurationMs, bytesLoaded), new MediaLoadData( dataType, trackType, diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaPeriod.java b/library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaPeriod.java index 458148499aa..f53dd594e68 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaPeriod.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaPeriod.java @@ -155,7 +155,6 @@ public boolean continueLoading(long positionUs) { loadErrorHandlingPolicy.getMinimumLoadableRetryCount(C.DATA_TYPE_MEDIA)); eventDispatcher.loadStarted( dataSpec, - dataSpec.uri, C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, @@ -211,6 +210,7 @@ public void onLoadCompleted(SourceLoadable loadable, long elapsedRealtimeMs, eventDispatcher.loadCompleted( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), + loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, @@ -229,6 +229,7 @@ public void onLoadCanceled(SourceLoadable loadable, long elapsedRealtimeMs, long eventDispatcher.loadCanceled( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), + loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, @@ -269,6 +270,7 @@ public LoadErrorAction onLoadError( eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), + loadable.dataSource.getLastResponseHeaders(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java index 7ff3b5a9b36..3d5c41e8bc7 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java @@ -43,6 +43,7 @@ import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -556,6 +557,7 @@ public void onAdLoadError(final AdLoadException error, DataSpec dataSpec) { .loadError( dataSpec, dataSpec.uri, + /* responseHeaders= */ Collections.emptyMap(), C.DATA_TYPE_AD, C.TRACK_TYPE_UNKNOWN, /* loadDurationMs= */ 0, @@ -595,6 +597,7 @@ public void onPrepareError(MediaPeriodId mediaPeriodId, final IOException except .loadError( new DataSpec(adUri), adUri, + /* responseHeaders= */ Collections.emptyMap(), C.DATA_TYPE_AD, C.TRACK_TYPE_UNKNOWN, /* loadDurationMs= */ 0, diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ChunkSampleStream.java b/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ChunkSampleStream.java index 78914e9f330..383f3dfc150 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ChunkSampleStream.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ChunkSampleStream.java @@ -432,6 +432,7 @@ public void onLoadCompleted(Chunk loadable, long elapsedRealtimeMs, long loadDur eventDispatcher.loadCompleted( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, primaryTrackType, loadable.trackFormat, @@ -451,6 +452,7 @@ public void onLoadCanceled(Chunk loadable, long elapsedRealtimeMs, long loadDura eventDispatcher.loadCanceled( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, primaryTrackType, loadable.trackFormat, @@ -518,6 +520,7 @@ public LoadErrorAction onLoadError( eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, primaryTrackType, loadable.trackFormat, @@ -585,7 +588,6 @@ public boolean continueLoading(long positionUs) { loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(loadable.type)); eventDispatcher.loadStarted( loadable.dataSpec, - loadable.dataSpec.uri, loadable.type, primaryTrackType, loadable.trackFormat, diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/ParsingLoadable.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/ParsingLoadable.java index 17d479daab8..cdcb3787fa6 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/ParsingLoadable.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/ParsingLoadable.java @@ -24,6 +24,8 @@ import com.google.android.exoplayer2.util.Util; import java.io.IOException; import java.io.InputStream; +import java.util.List; +import java.util.Map; /** * A {@link Loadable} for objects that can be parsed from binary data using a {@link Parser}. @@ -132,6 +134,14 @@ public Uri getUri() { return dataSource.getLastOpenedUri(); } + /** + * Returns the response headers associated with the load. Must only be called after the load + * completed, failed, or was canceled. + */ + public Map> getResponseHeaders() { + return dataSource.getLastResponseHeaders(); + } + @Override public final void cancelLoad() { // Do nothing. diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java index e9d9c42e0bc..6546863f66a 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java @@ -709,6 +709,7 @@ public void releaseSourceInternal() { manifestEventDispatcher.loadCompleted( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, @@ -800,6 +801,7 @@ public void releaseSourceInternal() { manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, @@ -814,6 +816,7 @@ public void releaseSourceInternal() { manifestEventDispatcher.loadCompleted( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, @@ -829,6 +832,7 @@ public void releaseSourceInternal() { manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, @@ -844,6 +848,7 @@ public void releaseSourceInternal() { manifestEventDispatcher.loadCanceled( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, @@ -1031,8 +1036,7 @@ private long getManifestLoadRetryDelayMillis() { private void startLoading(ParsingLoadable loadable, Loader.Callback> callback, int minRetryCount) { long elapsedRealtimeMs = loader.startLoading(loadable, callback, minRetryCount); - manifestEventDispatcher.loadStarted( - loadable.dataSpec, loadable.dataSpec.uri, loadable.type, elapsedRealtimeMs); + manifestEventDispatcher.loadStarted(loadable.dataSpec, loadable.type, elapsedRealtimeMs); } private long getNowUnixTimeUs() { diff --git a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java index 5c63e19f283..9bfdae1cf46 100644 --- a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java +++ b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java @@ -571,7 +571,6 @@ public boolean continueLoading(long positionUs) { loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(loadable.type)); eventDispatcher.loadStarted( loadable.dataSpec, - loadable.dataSpec.uri, loadable.type, trackType, loadable.trackFormat, @@ -596,6 +595,7 @@ public void onLoadCompleted(Chunk loadable, long elapsedRealtimeMs, long loadDur eventDispatcher.loadCompleted( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, trackType, loadable.trackFormat, @@ -619,6 +619,7 @@ public void onLoadCanceled(Chunk loadable, long elapsedRealtimeMs, long loadDura eventDispatcher.loadCanceled( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, trackType, loadable.trackFormat, @@ -680,6 +681,7 @@ public LoadErrorAction onLoadError( eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, trackType, loadable.trackFormat, diff --git a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/DefaultHlsPlaylistTracker.java b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/DefaultHlsPlaylistTracker.java index b2ebfa83758..ac94d7307ec 100644 --- a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/DefaultHlsPlaylistTracker.java +++ b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/DefaultHlsPlaylistTracker.java @@ -123,7 +123,6 @@ public void start( loadErrorHandlingPolicy.getMinimumLoadableRetryCount(masterPlaylistLoadable.type)); eventDispatcher.loadStarted( masterPlaylistLoadable.dataSpec, - masterPlaylistLoadable.dataSpec.uri, masterPlaylistLoadable.type, elapsedRealtime); } @@ -234,6 +233,7 @@ public void onLoadCompleted( eventDispatcher.loadCompleted( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, @@ -249,6 +249,7 @@ public void onLoadCanceled( eventDispatcher.loadCanceled( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, @@ -269,6 +270,7 @@ public LoadErrorAction onLoadError( eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, @@ -496,6 +498,7 @@ public void onLoadCompleted( eventDispatcher.loadCompleted( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, @@ -514,6 +517,7 @@ public void onLoadCanceled( eventDispatcher.loadCanceled( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, @@ -555,6 +559,7 @@ public LoadErrorAction onLoadError( eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, @@ -583,7 +588,6 @@ private void loadPlaylistImmediately() { loadErrorHandlingPolicy.getMinimumLoadableRetryCount(mediaPlaylistLoadable.type)); eventDispatcher.loadStarted( mediaPlaylistLoadable.dataSpec, - mediaPlaylistLoadable.dataSpec.uri, mediaPlaylistLoadable.type, elapsedRealtime); } diff --git a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java index efd733d6513..83f1a59c8bc 100644 --- a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java +++ b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java @@ -569,6 +569,7 @@ public void onLoadCompleted(ParsingLoadable loadable, long elapsedRe manifestEventDispatcher.loadCompleted( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, @@ -585,6 +586,7 @@ public void onLoadCanceled(ParsingLoadable loadable, long elapsedRea manifestEventDispatcher.loadCanceled( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, @@ -602,6 +604,7 @@ public LoadErrorAction onLoadError( manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), + loadable.getResponseHeaders(), loadable.type, elapsedRealtimeMs, loadDurationMs, @@ -692,8 +695,7 @@ private void startLoadingManifest() { long elapsedRealtimeMs = manifestLoader.startLoading( loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(loadable.type)); - manifestEventDispatcher.loadStarted( - loadable.dataSpec, loadable.dataSpec.uri, loadable.type, elapsedRealtimeMs); + manifestEventDispatcher.loadStarted(loadable.dataSpec, loadable.type, elapsedRealtimeMs); } } diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaPeriod.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaPeriod.java index 4e3713a4c6d..f2739f2b4d4 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaPeriod.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaPeriod.java @@ -31,6 +31,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelection; import com.google.android.exoplayer2.upstream.DataSpec; import java.io.IOException; +import java.util.Collections; /** * Fake {@link MediaPeriod} that provides tracks from the given {@link TrackGroupArray}. Selecting @@ -115,7 +116,6 @@ public void release() { public synchronized void prepare(Callback callback, long positionUs) { eventDispatcher.loadStarted( FAKE_DATA_SPEC, - FAKE_DATA_SPEC.uri, C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, @@ -228,6 +228,7 @@ private void finishPreparation() { eventDispatcher.loadCompleted( FAKE_DATA_SPEC, FAKE_DATA_SPEC.uri, + /* responseHeaders= */ Collections.emptyMap(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaSource.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaSource.java index 82d60264825..2fca4f42c72 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaSource.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaSource.java @@ -40,6 +40,7 @@ import com.google.android.exoplayer2.util.Assertions; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -225,6 +226,7 @@ private void finishSourcePreparation() { new LoadEventInfo( FAKE_DATA_SPEC, FAKE_DATA_SPEC.uri, + /* responseHeaders= */ Collections.emptyMap(), elapsedRealTimeMs, /* loadDurationMs= */ 0, /* bytesLoaded= */ 0), @@ -233,6 +235,7 @@ private void finishSourcePreparation() { new LoadEventInfo( FAKE_DATA_SPEC, FAKE_DATA_SPEC.uri, + /* responseHeaders= */ Collections.emptyMap(), elapsedRealTimeMs, /* loadDurationMs= */ 0, /* bytesLoaded= */ MANIFEST_LOAD_BYTES),