Provide call DSP and Telecom boundaries for real audio worker tests
This commit is contained in:
1 parent
6d7e58c5d9
commit
41f3df89be
3 files changed
+30
No files matched your search
@@ -46,6 +46,11 @@ object SystemClock {
|
||||
fun elapsedRealtimeNanos(): Long = System.nanoTime()
|
||||
}
|
||||
|
||||
object Process {
|
||||
const val THREAD_PRIORITY_AUDIO = -16
|
||||
fun setThreadPriority(priority: Int) { check(priority == THREAD_PRIORITY_AUDIO) }
|
||||
}
|
||||
|
||||
/** Конечные vibration pulses без аппаратных эффектов; тест может отказать на любом импульсе. */
|
||||
class VibrationEffect private constructor(val timings: LongArray, val repeat: Int) {
|
||||
companion object { fun createWaveform(timings: LongArray, repeat: Int) = VibrationEffect(timings.copyOf(), repeat) }
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.utun.chat.data
|
||||
|
||||
/** Граница Telecom для настоящего CallAudioEngine; DSP заменён только в host NativeLib. */
|
||||
object TelecomCallManager {
|
||||
var connection: UtunConnection? = null
|
||||
fun connectionFor(id: Long) = connection
|
||||
}
|
||||
+18
@@ -35,6 +35,24 @@ object LogManager {
|
||||
|
||||
/** Только host-тест: считает уведомления standby, не загружает JNI и не запускает ядро. */
|
||||
object NativeLib {
|
||||
@Volatile var callAudioFailures = emptySet<String>()
|
||||
@Volatile var onCallFeed: () -> Unit = {}
|
||||
val callAudioCommands: MutableList<Pair<String, Long>> = Collections.synchronizedList(mutableListOf())
|
||||
fun callAudioStart(id: Long): Boolean {
|
||||
callAudioCommands.add("start" to id)
|
||||
return "start" !in callAudioFailures
|
||||
}
|
||||
fun callAudioStop() {
|
||||
callAudioCommands.add("stop" to 0L)
|
||||
check("stop" !in callAudioFailures) { "native call audio stop failed" }
|
||||
}
|
||||
fun callAudioFeed(id: Long, samples: ShortArray, muted: Boolean, ptsUs: Long): Boolean { onCallFeed(); return true }
|
||||
fun callAudioPull(id: Long, samples: ShortArray) = 0
|
||||
fun callAudioClock(id: Long, nowUs: Long, snapshot: LongArray): Boolean { snapshot[0] = 1; return true }
|
||||
fun callAudioDiagnostics(id: Long, snapshot: LongArray) = false
|
||||
fun callAudioProgress(id: Long, epoch: Long, position: Long, atUs: Long, nowUs: Long, measured: Boolean) {}
|
||||
fun callAudioSetAec(enabled: Boolean) {}
|
||||
fun callAudioSetAecDelay(frames: Int) {}
|
||||
val callCommands = mutableListOf<Pair<String, Long>>()
|
||||
fun callStart(channel: String, peer: Long, id: Long) { callCommands.add("start" to id) }
|
||||
fun callAccept(id: Long) { callCommands.add("accept" to id) }
|
||||
|
||||
Reference in new issue
Block a user