From 923aa420dfe6eb19eb05647d90d7c5aff62198fb Mon Sep 17 00:00:00 2001 From: tonihei Date: Mon, 21 Jan 2019 13:52:14 +0000 Subject: [PATCH] Use loading period event time for fatal load errors. ExoPlaybackExceptions of type SOURCE are always associated with the loading period and thus we can use the event time for the loading period in onPlayerError. Renderer and unexpected exceptions are still associated with the currently playing period. Issue:#5407 PiperOrigin-RevId: 230216253 --- RELEASENOTES.md | 3 +++ .../android/exoplayer2/analytics/AnalyticsCollector.java | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index bfb84d2504e..053198de573 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -43,6 +43,9 @@ fit service requirements. Remove ability to set a custom stop action. * Add workaround for video quality problems with Amlogic decoders ([#5003](https://github.com/google/ExoPlayer/issues/5003)). +* Associate fatal player errors of type SOURCE with the loading source in + `AnalyticsListener.EventTime` + ([#5407](https://github.com/google/ExoPlayer/issues/5407)). ### 2.9.4 ### diff --git a/library/core/src/main/java/com/google/android/exoplayer2/analytics/AnalyticsCollector.java b/library/core/src/main/java/com/google/android/exoplayer2/analytics/AnalyticsCollector.java index 113add612a3..55031e2d12f 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/analytics/AnalyticsCollector.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/analytics/AnalyticsCollector.java @@ -488,7 +488,10 @@ public final void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) { @Override public final void onPlayerError(ExoPlaybackException error) { - EventTime eventTime = generatePlayingMediaPeriodEventTime(); + EventTime eventTime = + error.type == ExoPlaybackException.TYPE_SOURCE + ? generateLoadingMediaPeriodEventTime() + : generatePlayingMediaPeriodEventTime(); for (AnalyticsListener listener : listeners) { listener.onPlayerError(eventTime, error); }