diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/WaveFormSanitizer.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/WaveFormSanitizer.kt index 94490529c0..78a03f3775 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/WaveFormSanitizer.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/WaveFormSanitizer.kt @@ -80,7 +80,7 @@ internal class WaveFormSanitizer @Inject constructor() { positiveList } - Timber.d("Sanitize from ${waveForm.size} items to ${finalList.size} items") + Timber.d("Sanitize from ${waveForm.size} items to ${finalList.size} items. Max value was $max") return finalList } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt index 6ab9f83c32..e67fa7cca0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -257,7 +257,7 @@ class MessageItemFactory @Inject constructor( return MessageVoiceItem_() .attributes(attributes) .duration(messageContent.audioWaveformInfo?.duration ?: 0) - .waveform(messageContent.audioWaveformInfo?.waveform ?: emptyList()) + .waveform(messageContent.audioWaveformInfo?.waveform?.toFft().orEmpty()) .playbackControlButtonClickListener(playbackControlButtonClickListener) .voiceMessagePlaybackTracker(voiceMessagePlaybackTracker) .izLocalFile(localFilesHelper.isLocalFile(fileUrl)) @@ -622,6 +622,13 @@ class MessageItemFactory @Inject constructor( .highlighted(highlight) } + private fun List?.toFft(): List? { + return this?.map { + // Value comes from AudioRecordView.maxReportableAmp, and 1024 is the max value in the Matrix spec + it * 22760 / 1024 + } + } + companion object { private const val MAX_NUMBER_OF_EMOJI_FOR_BIG_FONT = 5 }