-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix/QA882 voice message duration on android 9 API 28 #980
Conversation
…to miscalculate it on older Android versions
|
||
// 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.