Merge pull request #6222 from vector-im/feature/ons/fix_voice_message_stackoverflow
Fix StackOverflowError while recording voice message [PSF-1065]
This commit is contained in:
commit
bae830dd03
1
changelog.d/6222.bugfix
Normal file
1
changelog.d/6222.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix StackOverflowError while recording voice message
|
@ -151,12 +151,14 @@ class AudioWaveformView @JvmOverloads constructor(
|
|||||||
|
|
||||||
private fun handleNewFftList(fftList: List<FFT>) {
|
private fun handleNewFftList(fftList: List<FFT>) {
|
||||||
val maxVisibleBarCount = getMaxVisibleBarCount()
|
val maxVisibleBarCount = getMaxVisibleBarCount()
|
||||||
|
|
||||||
fftList.forEach { fft ->
|
fftList.forEach { fft ->
|
||||||
rawFftList.add(fft)
|
rawFftList.add(fft)
|
||||||
val barHeight = max(fft.value / MAX_FFT * (height - verticalPadding * 2), barMinHeight)
|
val barHeight = max(fft.value / MAX_FFT * (height - verticalPadding * 2), barMinHeight)
|
||||||
visibleBarHeights.add(FFT(barHeight, fft.color))
|
visibleBarHeights.add(FFT(barHeight, fft.color))
|
||||||
|
|
||||||
if (visibleBarHeights.size > maxVisibleBarCount) {
|
if (visibleBarHeights.size > maxVisibleBarCount) {
|
||||||
visibleBarHeights = visibleBarHeights.subList(visibleBarHeights.size - maxVisibleBarCount, visibleBarHeights.size)
|
visibleBarHeights = visibleBarHeights.takeLast(maxVisibleBarCount).toMutableList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user