Skip to content

fix/QA882 voice message duration on android 9 API 28 #980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 26, 2025

Conversation

AL-Session
Copy link
Contributor

@AL-Session AL-Session commented Feb 26, 2025

On older Android versions such as API 28 on some devices the final duration of a voice message can be miscalculated due to legacy codec flakiness.

This means that we record a voice message, set the correct interim duration during upload, and then set an incorrect duration on successful upload.

The fix? Don't set the final upload duration on outgoing voice messages as the interim duration set during upload is always correct.

image

@AL-Session AL-Session marked this pull request as ready for review February 26, 2025 03:24
@AL-Session AL-Session marked this pull request as draft February 26, 2025 03:27
@AL-Session AL-Session marked this pull request as ready for review February 26, 2025 03:33

// Pass through a flag regarding whether this is an outgoing voice message to the success handler which
// will skip updating the final voice message duration if so (older android APIs <= 28 can miscalculate it).
val isOutgoingVoiceMessage = message.isSenderSelf && attachment.voiceNote
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we always the sender when we upload attachments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@@ -109,25 +114,30 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess
return Pair(key, UploadResult(id, "${server}/file/$id", digest))
}

private fun handleSuccess(dispatcherName: String, attachment: SignalServiceAttachmentStream, attachmentKey: ByteArray, uploadResult: UploadResult) {
private fun handleSuccess(dispatcherName: String, attachment: SignalServiceAttachmentStream, attachmentKey: ByteArray, uploadResult: UploadResult, isOutgoingVoiceMessage: Boolean) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need that flag when you already have an attachment below with a voiceNote property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - used voiceNote property instead.

@AL-Session AL-Session merged commit 6f75829 into dev Feb 26, 2025
1 check passed
@AL-Session AL-Session deleted the fix/QA882_voice_message_duration_on_android_9_api_28 branch February 26, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants