Files
simplex-chat/apps
Narasimha-sc f1c2b38c51 android, desktop: don't probe duration synchronously when stopping recorder
AudioPlayer.start() synchronously invokes RecorderInterface.stopRecording.
RecorderNative.stop() ran runBlocking { progressJob.cancelAndJoin() }, which
waits for the progress coroutine's invokeOnCompletion handler - and that
handler calls realDuration(path). On Desktop realDuration goes through
AudioPlayer.duration which constructs a fresh AudioPlayerComponent and runs
media().startPaused() on the recording file VLC just released; that probe
is slow and on Waydroid sometimes never returns. A second realDuration call
for stop()'s return value duplicated the I/O.

Skip the runBlocking await and return wall-clock elapsed from progress()
instead of probing the file. The progressJob's invokeOnCompletion still
fires (now async on Default), so the recState transition still happens via
the existing listener path - just no longer blocking the caller.

durationMs reported to RecordingState.Finished by stopRecordingAndAddAudio
is now wall-clock elapsed rather than container-probed - tens of ms looser,
well below any user-visible threshold for a voice message.
2026-04-29 07:54:30 +00:00
..
2026-04-27 17:55:20 +01:00
2025-07-08 12:22:57 +01:00