Document call view ownership and preserve probe interrupts

This commit is contained in:
evgeny committed 2026-10-29 13:34:25 +01:00
1 parent 42b3cfcbc3
commit 7c04fb43ac
2 files changed
+8

No files matched your search

@@ -43,6 +43,7 @@ class MediaAudioProbe : Instrumentation() {
val writerFailure = java.util.concurrent.atomic.AtomicReference<Exception?>(null)
var saved: MediaAudioProfile? = null
var problem: Exception? = null
var interrupted = false
try {
activity = startActivitySync(Intent(targetContext, MediaAudioProbeActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
check(MicrophonePermission.granted()) { "RECORD_AUDIO is required for the explicit microphone probe" }
@@ -169,11 +170,13 @@ class MediaAudioProbe : Instrumentation() {
android.util.Log.i("MediaAudioProbe", "receive-only SCO cold start verified usage=$usage device=${sink.routedDevice?.id} mode=${manager.mode}")
}
} catch (e: Exception) {
if (e is InterruptedException) interrupted = true
problem = e
android.util.Log.e("MediaAudioProbe", "probe failed", e)
} finally {
fun cleanup(stage: String, action: () -> Unit) {
try { action() } catch (e: Exception) {
if (e is InterruptedException) interrupted = true
android.util.Log.e("MediaAudioProbe", "cleanup failed stage=$stage", e)
if (problem == null) problem = e else problem!!.addSuppressed(e)
}
@@ -194,6 +197,7 @@ class MediaAudioProbe : Instrumentation() {
}
cleanup("activity finish") { runOnMainSync { activity?.finish() } }
writerFailure.get()?.let { failure -> if (problem == null) problem = failure else problem!!.addSuppressed(failure) }
if (interrupted) Thread.currentThread().interrupt()
}
finish(if (problem == null) 0 else 1, Bundle().apply {
putString("result", problem?.toString() ?: "Shared PCM, CAMCORDER, output route and continuous PTS verified")
@@ -490,6 +490,10 @@ RX join ограничен 250 мс за попытку; decoder не теряе
остаётся до подтверждённого освобождения codec. Остальные Surface и playout очищаются
независимо. Очередь Surface владеет callback release до успешного возврата, включая
позднюю передачу после stop; callback должен допускать повтор после исключения.
CallVideoTexture передаёт callback идемпотентного StreamPreviewTarget: частичный отказ
физического release не теряет второй ресурс. Старый destroy не отсоединяет новый output.
CallScreen фиксирует ориентацию окна, immersive возвращает прежние панели;
Bluetooth permission связан с call ID, camera permission — с конкретным engine.
Process-ссылка и Handler сохраняют cleanup после выхода RX, без переноса уже назначенного
раннего таймера. Отказ post не теряет владельцев и допускает явный stop.