From feb512544a1e3848d6e9ddd5f545c1ac55cf9cff Mon Sep 17 00:00:00 2001 From: rohks Date: Wed, 1 May 2024 08:32:52 -0700 Subject: [PATCH] Fix issue with updating the last rebuffer time The last rebuffer time was being updated erroneously, even in the absence of rebuffering events, resulting in incorrect `bs` (buffer starvation) key in CMCD. Issue: androidx/media#1124 PiperOrigin-RevId: 629731796 --- RELEASENOTES.md | 3 +++ .../java/androidx/media3/exoplayer/ExoPlayerImplInternal.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 324ccf3fa10..a807bafd0ce 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -13,6 +13,9 @@ * Add `ExoPlayer.setPriority` (and `Builder.setPriority`) to define the priority value used in `PriorityTaskManager` and for MediaCodec importance from API 35. + * Fix issue with updating the last rebuffer time which resulted in + incorrect `bs` (buffer starvation) key in CMCD + ([#1124](https://github.com/androidx/media/issues/1124)). * Transformer: * Work around a decoder bug where the number of audio channels was capped at stereo when handling PCM input. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImplInternal.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImplInternal.java index 131f6551ffa..201d21f2463 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImplInternal.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImplInternal.java @@ -3019,7 +3019,7 @@ private static boolean isUsingPlaceholderPeriod( private void updateRebufferingState(boolean isRebuffering, boolean resetLastRebufferRealtimeMs) { this.isRebuffering = isRebuffering; this.lastRebufferRealtimeMs = - resetLastRebufferRealtimeMs ? C.TIME_UNSET : clock.elapsedRealtime(); + isRebuffering && !resetLastRebufferRealtimeMs ? clock.elapsedRealtime() : C.TIME_UNSET; } /**