Wire reviewed emotion bridges and action media playback fences

This commit is contained in:
zenord
2026-10-13 02:09:38 +08:00
parent 4ead34a944
commit 515d106da7
28 changed files with 961 additions and 65 deletions
+12 -2
View File
@@ -29,10 +29,20 @@ fun actionCheck() {
check(statuses.last().status=="started")
release!!();check(!controller.active && statuses.last().status=="cancelled")
stale(ActionEnd(true,true,true));check(statuses.last().status=="cancelled")
check(controller.offer(plan(3)));confirm!!(false);release!!()
check(statuses.last().status=="failed" && picked.size==2)
check(controller.offer(plan(6)))
val pendingStop=confirm!!
controller.cancel();release!!()
check(controller.active && statuses.last().status=="cancelled")
pendingStop(true);check(!controller.active && statuses.last().turn==6L && statuses.last().status=="cancelled")
check(controller.offer(plan(7)))
pendingStop(false) // Duplicate retired callback must not poison current capture gate.
check(controller.active && !playing)
confirm!!(true);check(playing)
controller.cancel();release!!();check(!controller.active)
check(controller.offer(plan(4)));confirm!!(true)
now+=10001;controller.tick();release!!();check(statuses.last().status=="failed")
check(controller.offer(plan(3)));confirm!!(false);release!!()
check(statuses.last().status=="failed" && controller.active && picked.size==4)
val missing=ActionController(null,player,{now},{confirm=it},{statuses.add(it)})
check(missing.capability==null && !missing.offer(plan(5)))
+2
View File
@@ -10,6 +10,8 @@ fun main() {
actionCheck()
emotionActionCheck()
conversationPackageCheck()
actualMediaViewCheck()
mediaBoundaryCheck()
checkContinuous()
checkEngineering()
checkSafeDriver()
+12 -5
View File
@@ -9,9 +9,12 @@ object CodecFixture {
var timestampOffsetUs=0L; var outputEnabled=true; var configureFails=false
var seeks=mutableListOf<Long>(); var releases=0; var flushes=0
var rendered=mutableListOf<Long>(); var onRender: ((Long) -> Unit)? = null
var emitNativeSurface=false
val timelines=mutableMapOf<String,List<Long>>()
fun reset() {
frames=20; fps=20; gop=4; firstPtsUs=0; timestampOffsetUs=0; outputEnabled=true; configureFails=false
seeks.clear(); releases=0; flushes=0; rendered.clear(); onRender=null
emitNativeSurface=false;timelines.clear()
}
}
class MediaFormat {
@@ -21,12 +24,13 @@ class MediaFormat {
}
class MediaExtractor {
val trackCount=1; private var frame=0
val sampleTime: Long get() = if (frame >= CodecFixture.frames) -1L else CodecFixture.firstPtsUs+frame*1_000_000L/CodecFixture.fps
fun setDataSource(fd: java.io.FileDescriptor,offset: Long,length: Long) {}
private var timeline: List<Long>?=null
val sampleTime: Long get() = timeline?.getOrNull(frame) ?: if(frame >= (timeline?.size ?: CodecFixture.frames)) -1L else CodecFixture.firstPtsUs+frame*1_000_000L/CodecFixture.fps
fun setDataSource(fd: java.io.FileDescriptor,offset: Long,length: Long) { timeline=CodecFixture.timelines[android.content.AssetFixture.paths[fd]] }
fun getTrackFormat(index: Int) = MediaFormat()
fun selectTrack(index: Int) {}
fun seekTo(time: Long,mode: Int) { CodecFixture.seeks += time; frame=(time*CodecFixture.fps/1_000_000).toInt()/CodecFixture.gop*CodecFixture.gop }
fun readSampleData(buffer: ByteBuffer,offset: Int): Int = if (frame >= CodecFixture.frames) -1 else 1
fun readSampleData(buffer: ByteBuffer,offset: Int): Int = if (frame >= (timeline?.size ?: CodecFixture.frames)) -1 else 1
fun advance() { frame++ }
fun release() {}
companion object { const val SEEK_TO_PREVIOUS_SYNC=0 }
@@ -35,11 +39,12 @@ class MediaCodec {
class BufferInfo { var presentationTimeUs=0L; var flags=0; var size=0 }
private data class Output(val pts: Long,val flags: Int,val size: Int)
private val queue=java.util.ArrayDeque<Output>(); private var current: Output? = null
private var target: Surface?=null
companion object {
const val BUFFER_FLAG_END_OF_STREAM=4
fun createDecoderByType(mime: String) = MediaCodec()
}
fun configure(format: MediaFormat,surface: Surface,crypto: Any?,flags: Int) { check(!CodecFixture.configureFails) }
fun configure(format: MediaFormat,surface: Surface,crypto: Any?,flags: Int) { check(!CodecFixture.configureFails);target=surface }
fun start() {}
fun dequeueInputBuffer(timeout: Long) = 0
fun getInputBuffer(index: Int): ByteBuffer = ByteBuffer.allocate(32)
@@ -51,7 +56,9 @@ class MediaCodec {
return 0
}
fun releaseOutputBuffer(index: Int,render: Boolean) {
if (render) { val pts=checkNotNull(current).pts; CodecFixture.rendered += pts; CodecFixture.onRender?.invoke(pts) }
if (render) { val pts=checkNotNull(current).pts; CodecFixture.rendered += pts; CodecFixture.onRender?.invoke(pts)
if(CodecFixture.emitNativeSurface) target?.texture?.emit(pts*1000)
}
}
fun flush() { queue.clear(); CodecFixture.flushes++ }
fun stop() {}
+4 -2
View File
@@ -2,9 +2,11 @@ package android.content
class Context { val assets = Assets() }
class Assets {
fun open(path: String) = java.io.ByteArrayInputStream(byteArrayOf())
fun openFd(path: String) = Descriptor()
fun openFd(path: String) = Descriptor(path)
}
class Descriptor : java.io.Closeable {
object AssetFixture { val paths=mutableMapOf<java.io.FileDescriptor,String>() }
class Descriptor(path: String="") : java.io.Closeable {
val fileDescriptor = java.io.FileDescriptor(); val startOffset = 0L; val length = 20L
init { AssetFixture.paths[fileDescriptor]=path }
override fun close() {}
}
+2
View File
@@ -17,6 +17,8 @@ fun emotionActionCheck() {
edge("in","neutral","happy"),edge("out","happy","neutral"))
val actions=listOf("asset_01","asset_02").map { mapOf<String,Any?>("id" to it,"kind" to "dance",
"mouthAllowed" to false,"disallowTALK" to true,"entryAnchor" to "A","returnAnchor" to "A",
"sourcePackageId" to "neutral","sourceFrame" to 96,"sourcePtsUs" to 4_000_000L,
"returnPackageId" to "neutral","returnFrame" to 0,"returnPtsUs" to 0L,
"clip" to clip(true),"audioEndUs" to 1_900_000L) }
val root=mapOf<String,Any?>("schemaVersion" to 2,"identityId" to "a01","packId" to "a01-expression-action-v1",
"fallbackPackageId" to "neutral","conversationPackages" to listOf(conversation("neutral"),conversation("happy")),
+3
View File
@@ -6,6 +6,7 @@ class MediaPlayer {
var prepared: ((MediaPlayer)->Unit)? = null
var info: ((MediaPlayer,Int,Int)->Boolean)? = null
var error: ((MediaPlayer,Int,Int)->Boolean)? = null
var completion: ((MediaPlayer)->Unit)? = null
var isLooping = false; val looping get() = isLooping
var volume = 1f; var released = false; var started = false
val videoWidth = 480; val videoHeight = 848
@@ -15,7 +16,9 @@ class MediaPlayer {
fun setOnPreparedListener(callback: (MediaPlayer)->Unit) { prepared = callback }
fun setOnInfoListener(callback: (MediaPlayer,Int,Int)->Boolean) { info = callback }
fun setOnErrorListener(callback: (MediaPlayer,Int,Int)->Boolean) { error = callback }
fun setOnCompletionListener(callback: (MediaPlayer)->Unit) { completion=callback }
fun prepareAsync() {}
fun start() { started = true }
fun stop() { started = false }
fun release() { released = true }
}
+76
View File
@@ -0,0 +1,76 @@
import com.gorios.lanvoice.avatar.*
import com.gorios.lanvoice.dialogue.RoleEmotion
/** Callback-controlled ports test held exits and release fences, not physical playback. */
fun mediaBoundaryCheck() {
var cases=0
class Port: CompositeMediaPort {
lateinit var pack: ContinuousAvatarPack
lateinit var frame: (BodyFrameKey,Boolean)->Unit
lateinit var ended: ()->Unit
var advances=0;var loop=false
var release: (()->Unit)?=null
override fun prepare(pack: ContinuousAvatarPack,entryFrame: Int,mouth: Boolean,loop: Boolean,
frame: (BodyFrameKey,Boolean)->Unit,ended: ()->Unit,failed: ()->Unit) {
this.pack=pack;this.frame=frame;this.ended=ended;this.loop=loop
}
override fun advance() { advances++ }
override fun mouth(talk: Boolean,generation: Long,revision: Long) {}
override fun close(released: ()->Unit) { release=released }
fun emit(i: Int,ordinal: Long=0) { frame(BodyFrameKey(i,ordinal,pack.body.ptsUs[i]),true) }
}
val music=object: MusicMediaPort {
override fun prepare(media: ActionMedia,ready: ()->Unit,firstFrame: ()->Unit,ended: ()->Unit,failed: ()->Unit) { error("No action in this fixture") }
override fun start() { error("No action in this fixture") }
override fun close(released: ()->Unit) = released()
}
val original=mediaFixtureIndex()
val clip=original.edges.first { it.id=="neutral-happy" }.clip
for(loopBridge in listOf(false,true)) {
val edges=original.edges.map {
when {
loopBridge && it.id=="neutral-loop" -> it.copy(clip=clip,nativeLoop=false)
!loopBridge && it.id=="neutral-happy" -> it.copy(fromFrame=0)
else -> it
}
}
val ports=mutableListOf<Port>();val reports=mutableListOf<String>()
val driver=ConversationMediaDriver(original.copy(edges=edges),{ Port().also(ports::add) },music,{}, { phase,_-> reports.add(phase) })
driver.beginTurn(7);driver.start();val source=ports.single()
if(!loopBridge) driver.intent(mediaReply(RoleEmotion.HAPPY),true)
source.emit(0)
if(loopBridge) (1..96).forEach { source.emit(it) }
check(ports.size==3 && reports.last()=="body_neutral");cases++
val held=source.advances
val target=ports[1];val bridge=ports[2]
check(!bridge.loop && (!loopBridge || !source.loop));cases++
bridge.emit(0)
check(source.advances==held && reports.last()=="body_neutral");cases++
target.emit(0)
check(reports.last()=="bridge" && source.release!=null);cases++
bridge.emit(1);bridge.emit(2);bridge.ended()
check(reports.contains(if(loopBridge) "body_neutral" else "body_happy") && bridge.release!=null);cases++
driver.stop {}
val before=reports.size
source.emit(0);bridge.ended();target.emit(0)
check(reports.size==before);cases++
ports.forEach { it.release?.invoke() }
}
for(bad in listOf("index","ordinal")) {
val ports=mutableListOf<Port>();val reports=mutableListOf<String>()
val driver=ConversationMediaDriver(original,{ Port().also(ports::add) },music,{}, { phase,_->reports.add(phase) })
driver.beginTurn(7);driver.start();val source=ports.single();source.emit(0)
if(bad=="index") source.emit(2) else source.emit(1,1)
check(reports.last()=="media_failed" && source.release!=null);cases++
source.release?.invoke()
}
val noOwn=original.copy(visuals=original.visuals.map { if(it.id=="happy") it.copy(mouthBodySha=null) else it })
val ports=mutableListOf<Port>()
val driver=ConversationMediaDriver(noOwn,{ Port().also(ports::add) },music,{})
driver.beginTurn(7);driver.start();ports.single().emit(0)
driver.prepareExpression(mediaReply(RoleEmotion.HAPPY,seq=1))
driver.intent(mediaReply(RoleEmotion.HAPPY,intensity=2),true)
check(ports.size==1 && driver.selection?.let { it.packageId=="neutral" && it.selectedEmotion==RoleEmotion.HAPPY && it.selectedIntensity==2 }==true);cases++
driver.stop {};ports.forEach { it.release?.invoke() }
println("PASS: $cases production media driver boundary cases: frame0 exit held until target+bridge ready, actual non-native loop bridge, own-mouth whole fallback, exact frame/ordinal guards and retired callbacks; fixture only")
}
+133
View File
@@ -0,0 +1,133 @@
import com.gorios.lanvoice.avatar.*
import com.gorios.lanvoice.dialogue.*
import android.os.TestScheduler
import android.media.CodecFixture
import android.media.MediaPlayer
import android.graphics.BitmapFactory
import android.opengl.GLFixture
import android.view.TextureView
fun mediaFixtureIndex(): EmotionActionIndex {
val packs=linkedMapOf("neutral" to dynamicPack(97,24,"c".repeat(64)).copy(root="neutral/"),
"happy" to dynamicPack(49,24,"d".repeat(64)).copy(root="happy/"),
"sad" to dynamicPack(121,30,"e".repeat(64)).copy(root="sad/"))
val visuals=packs.map { (id,p)->TalkPackage(id,RoleEmotion.entries.single { it.wire==id },p.body.sha256,p.body.sha256,p.body.ptsUs,p.body.ptsUs,true) }
val bridges=packs.map { (id,p)->ConversationEdge("$id-loop",id,id,p.body.frameCount-1,0,p.body,true) }+
listOf("happy","sad").flatMap { id->listOf("neutral" to id,id to "neutral").map { (from,to)->
ConversationEdge("$from-$to",from,to,packs.getValue(from).body.frameCount-1,0,
ContinuousBodyAsset("clips/$from-$to.mp4","f".repeat(64),480,848,3,125000,List(3) { it*1_000_000L/24 }))
} }
val musicPts=List(24) { it*1_000_000L/24 }
val actions=ReviewedActionPack("a".repeat(64),listOf("asset_01","asset_02").map {
ActionAsset(it,1000,ActionMedia("clips/$it.mp4","a".repeat(64),"",musicPts,1_000_000,480,848,"neutral",96,"neutral",0,950_000))
})
return EmotionActionIndex("neutral",packs,visuals,actions,bridges)
}
fun mediaReply(emotion: RoleEmotion,turn: Long=7,seq: Long=2,intensity: Int=if(emotion==RoleEmotion.NEUTRAL) 0 else 1)=
ReplyEmotion(emotion,intensity,EmotionSource.MODEL,turn,seq)
fun actualMediaViewCheck() {
var cases=0
fun reset() {
TestScheduler.reset();CodecFixture.reset();GLFixture.reset();BitmapFactory.wrongSize=false;MediaPlayer.created.clear()
CodecFixture.emitNativeSurface=true
}
fun rig(index: EmotionActionIndex=mediaFixtureIndex()): Triple<EmotionActionAvatarView,AvatarMediaBinding,MutableList<VideoPresentation>> {
index.packages.values.forEach { CodecFixture.timelines[it.root+it.body.path]=it.body.ptsUs }
index.edges.filterNot { it.nativeLoop }.forEach { CodecFixture.timelines[index.root+it.clip.path]=it.clip.ptsUs }
val binding=AvatarMediaBinding();binding.beginTurn(7)
val reports=mutableListOf<VideoPresentation>()
val view=EmotionActionAvatarView(android.content.Context(),AvatarPack(fallback="fixture.png",emotionAction=index),binding,reports::add)
view.render(true);TestScheduler.advanceBy(1)
return Triple(view,binding,reports)
}
reset();val (view,binding,reports)=rig()
check(reports.last().actual=="body_neutral");cases++
val driverField=view.javaClass.getDeclaredField("driver").apply { isAccessible=true }
val driver=driverField.get(view)
binding.prepare(mediaReply(RoleEmotion.HAPPY,seq=1));TestScheduler.advanceBy(200)
check(reports.none { it.actual=="body_happy" });cases++ // Header preloads hidden, never shows.
binding.intent(mediaReply(RoleEmotion.HAPPY,intensity=2),true)
TestScheduler.until { reports.any { it.actual=="body_happy" } || reports.any { it.actual=="media_failed" } }
check(reports.none { it.actual=="media_failed" }) { reports.takeLast(6).toString() }
val selected=(driver as ConversationMediaDriver).selection
check(selected?.selectedIntensity==2 && selected.visualIntensity==1 && selected.selectedEmotion==RoleEmotion.HAPPY);cases++
check(reports.any { it.actual=="bridge" } && reports.none { it.actual=="media_failed" });cases++
TestScheduler.advanceBy(3000)
check(reports.any { it.actual=="body_happy" && it.clipId.contains("loop1") });cases++
view.render(true);TestScheduler.advanceBy(100)
check(driverField.get(view)===driver);cases++ // Actual persistent view, same settings/foreground path.
binding.intent(mediaReply(RoleEmotion.SAD,seq=3),false)
TestScheduler.until { reports.last().actual=="bridge" }
binding.beginTurn(8);binding.intent(mediaReply(RoleEmotion.SAD,turn=8),true)
binding.intent(mediaReply(RoleEmotion.HAPPY,turn=7,seq=99),true) // Retired reply ignored.
TestScheduler.until { reports.last().actual=="body_sad" }
check((driverField.get(view) as ConversationMediaDriver).selection?.selectedEmotion==RoleEmotion.SAD);cases++
TestScheduler.advanceBy(4500)
check(reports.any { it.actual=="body_sad" && it.clipId.contains("loop1") } && reports.none { it.actual=="media_failed" });cases++
val count=reports.size;view.render(false);TestScheduler.advanceBy(1000)
check(reports.size==count && driverField.get(view)==null && CodecFixture.releases>=5);cases++
view.dispose()
reset();val (mismatchView,mismatchBinding,mismatchTrace)=rig()
mismatchBinding.prepare(mediaReply(RoleEmotion.HAPPY,seq=1));TestScheduler.advanceBy(100)
mismatchBinding.intent(mediaReply(RoleEmotion.SAD,seq=2),true)
mismatchBinding.prepare(null)
TestScheduler.until { mismatchTrace.any { it.actual=="body_sad" } }
check(mismatchTrace.none { it.actual=="body_happy" || it.actual=="media_failed" });cases++
mismatchView.dispose();TestScheduler.advanceBy(100)
for(confirmed in listOf(true,false)) {
reset();val (cancelView,cancelBinding,_)=rig()
var stop: ((Boolean)->Unit)?=null;var resumed=0
val statuses=mutableListOf<ActionStatus>()
val controller=ActionController(mediaFixtureIndex().actionPack,cancelBinding,{TestScheduler.now},{stop=it},statuses::add,
{ active->if(!active) resumed++ })
check(controller.offer(ActionPlan("p".repeat(24),7,"a".repeat(64),15000)))
controller.cancel();TestScheduler.advanceBy(100)
check(statuses.isEmpty() && controller.active && MediaPlayer.created.isEmpty());cases++
stop!!(confirmed);TestScheduler.advanceBy(100)
check(statuses.single().status==if(confirmed) "cancelled" else "failed");cases++
check(MediaPlayer.created.isEmpty() && resumed==(if(confirmed) 1 else 0) && controller.active!=confirmed);cases++
cancelView.dispose();TestScheduler.advanceBy(100)
}
for(mode in listOf("complete","cancel","failed","background","late_final_frame")) {
reset();val index=mediaFixtureIndex();val (actionView,actionBinding,trace)=rig(index)
var stopped: ((Boolean)->Unit)?=null
val statuses=mutableListOf<ActionStatus>()
val controller=ActionController(index.actionPack,actionBinding,{TestScheduler.now},{stopped=it},statuses::add)
check(controller.offer(ActionPlan("x".repeat(24),7,"a".repeat(64),15000)))
TestScheduler.advanceBy(100);check(MediaPlayer.created.isEmpty());cases++
stopped!!(true);val movie=MediaPlayer.created.single()
check(!movie.started);movie.prepared!!(movie)
TestScheduler.until { movie.started }
check(trace.last().clipId.startsWith("f96_") && trace.last().actual=="action");cases++
val textures=actionView.children.filterIsInstance<TextureView>()
fun latch(pts: Long) { val texture=checkNotNull(textures[3].surfaceTexture);texture.timestamp=pts*1000
textures[3].surfaceTextureListener!!.onSurfaceTextureUpdated(texture) }
check(textures[3].alpha==0f);latch(0);check(textures[3].alpha==1f);cases++
when(mode) {
"complete","late_final_frame" -> {
index.actionPack!!.assets.first().media!!.ptsUs.drop(1).dropLast(if(mode=="late_final_frame") 1 else 0).forEach(::latch)
TestScheduler.advanceBy(1000);movie.completion!!(movie)
if(mode=="late_final_frame") { check(statuses.last().status=="started");latch(index.actionPack.assets.first().media!!.ptsUs.last()) }
TestScheduler.until { statuses.last().status=="completed" }
check(movie.released && trace.last().actual=="body_neutral" && trace.last().clipId.startsWith("f0_"));cases++
movie.completion!!(movie);check(statuses.count { it.status=="completed" }==1);cases++
}
"cancel" -> { controller.cancel();TestScheduler.until { statuses.last().status=="cancelled" }
check(movie.released && !movie.started && !controller.active);cases++ }
"failed" -> { movie.error!!(movie,1,2);TestScheduler.until { statuses.last().status=="failed" }
check(movie.released && !controller.active);cases++ }
"background" -> { controller.cancel();actionView.render(false);TestScheduler.until { !controller.active }
check(movie.released && driverField.get(actionView)==null);cases++ }
}
val before=statuses.size;movie.completion!!(movie);TestScheduler.advanceBy(10)
check(statuses.size==before);cases++
actionView.dispose();TestScheduler.advanceBy(100)
}
CodecFixture.reset();MediaPlayer.created.clear()
println("PASS: $cases actual EmotionActionAvatarView/binding/held GLES renderer/MediaPlayer callback cases: hidden header/final mismatch, final slight,97→49→121 and24→30fps/native loops, real bridge frames/latest turn, settings continuity, mic-confirm/cancel-pending/failure gate, safe exit/music first+last PTS/native end/release/idle-A, completion order, cancel/error/background/stale callbacks; deterministic Android doubles, device/naturalness not_run")
}
+2 -1
View File
@@ -1,4 +1,5 @@
package com.gorios.lanvoice.avatar
// Loader has independent byte/hash verification; no real portrait bytes in JVM fixtures.
data class AvatarPack(val idle: String = "",val talk: String = "",val fallback: String,val waiting: String = fallback,
val safeGraph: SafeAvatarGraph? = null,val pathRoot: String = "",val motionStatus: String = "anchor_review_pending")
val safeGraph: SafeAvatarGraph? = null,val pathRoot: String = "",val motionStatus: String = "anchor_review_pending",
val continuous: ContinuousAvatarPack?=null,val emotionAction: EmotionActionIndex?=null)
+1 -1
View File
@@ -2,7 +2,7 @@ package android.view
import android.content.Context
import android.graphics.SurfaceTexture
import android.graphics.Matrix
class Surface(texture: SurfaceTexture) { fun release() {} }
class Surface(val texture: SurfaceTexture) { fun release() {} }
class TextureView(context: Context) {
var alpha = 1f; var isOpaque = true
val isAvailable = true; val surfaceTexture = SurfaceTexture()
+8 -2
View File
@@ -30,7 +30,13 @@ fun checkActionSession() {
check(prepared.last()?.emotion==com.gorios.lanvoice.dialogue.RoleEmotion.HAPPY)
AudioCapture.confirmStopsAutomatically=false
val oldFrame=checkNotNull(AudioCapture.lastFrame)
event("action.plan",EventKind.ACTION,7,mapOf("action_id" to "x".repeat(24),"pack_sha256" to sha,"ttl_ms" to 10000L))
val fields=mapOf("action_id" to "x".repeat(24),"pack_sha256" to sha,"ttl_ms" to 10000L)
event("action.plan",EventKind.ACTION,7,fields)
check(!states.last().actionActive && plays==0) // A server plan cannot fabricate local TTS drain.
val frameMethod=session.javaClass.getDeclaredMethod("onFrame",DownlinkFrame::class.java).apply { isAccessible=true }
frameMethod.invoke(session,DownlinkFrame(7))
checkNotNull(AudioPlayback.lastDrained)(7,0);Handler.drain()
event("action.plan",EventKind.ACTION,7,fields)
check(states.last().actionActive && plays==0)
val before=DialogueProtocol.uplinks.size
oldFrame(ByteArray(640));Handler.drain();check(DialogueProtocol.uplinks.size==before)
@@ -39,7 +45,7 @@ fun checkActionSession() {
session.setMicrophoneMuted(true);session.setMicrophoneMuted(false);session.interrupt()
check(AudioCapture.starts==starts)
val enqueued=AudioPlayback.enqueued
session.javaClass.getDeclaredMethod("onFrame",DownlinkFrame::class.java).apply { isAccessible=true }.invoke(session,DownlinkFrame(7))
frameMethod.invoke(session,DownlinkFrame(7))
check(enqueued==AudioPlayback.enqueued)
val stale=checkNotNull(ended)
session.background();Handler.drain()