Skip to content

Commit

Permalink
Merge pull request element-hq#7899 from vector-im/bugfix/fre/bufferin…
Browse files Browse the repository at this point in the history
…g_on_last_chunk

[Voice Broadcast] Stop listening if we reach the last received chunk and there is no last sequence number
  • Loading branch information
Florian14 authored Jan 6, 2023
2 parents f1bd9b2 + 87e661e commit 2e95d4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/7899.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Voice Broadcast] Stop listening if we reach the last received chunk and there is no last sequence number
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
// Next media player is already attached to this player and will start playing automatically
if (nextMediaPlayer != null) return

val hasEnded = !isLiveListening && mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence == playlist.currentSequence
val currentSequence = playlist.currentSequence ?: 0
val lastChunkSequence = mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence ?: 0
val hasEnded = !isLiveListening && currentSequence >= lastChunkSequence
if (hasEnded) {
// We'll not receive new chunks anymore so we can stop the live listening
stop()
Expand Down

0 comments on commit 2e95d4f

Please sign in to comment.