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
This commit is contained in:
Florian Renaud 2023-01-06 09:10:00 +01:00 committed by GitHub
commit 2e95d4f97c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

1
changelog.d/7899.bugfix Normal file
View File

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

View File

@ -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()