Skip to content

Commit 2e95d4f

Browse files
authored
Merge pull request #7899 from vector-im/bugfix/fre/buffering_on_last_chunk
[Voice Broadcast] Stop listening if we reach the last received chunk and there is no last sequence number
2 parents f1bd9b2 + 87e661e commit 2e95d4f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

changelog.d/7899.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[Voice Broadcast] Stop listening if we reach the last received chunk and there is no last sequence number

vector/src/main/java/im/vector/app/features/voicebroadcast/listening/VoiceBroadcastPlayerImpl.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
419419
// Next media player is already attached to this player and will start playing automatically
420420
if (nextMediaPlayer != null) return
421421

422-
val hasEnded = !isLiveListening && mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence == playlist.currentSequence
422+
val currentSequence = playlist.currentSequence ?: 0
423+
val lastChunkSequence = mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence ?: 0
424+
val hasEnded = !isLiveListening && currentSequence >= lastChunkSequence
423425
if (hasEnded) {
424426
// We'll not receive new chunks anymore so we can stop the live listening
425427
stop()

0 commit comments

Comments
 (0)