feat: deliver clean avatar home in 0.6.2 UI debug candidate
Keep the avatar mounted while all connection, permission, privacy and diagnostic controls live in a settings sheet. Save the tested continuous-body renderer, safe transition driver and foreground HELLO/permission workflow from this session. Pin runtime03 for the code14 UI-only candidate; mouth deformation remains unresolved. Add source UI contracts, an optional sensor-free device probe, exact asset import and candidate packaging checks. Portrait binaries and diagnostics remain private and untracked.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package android.media
|
||||
|
||||
import android.view.Surface
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
/** Deterministic API doubles exercise production codec control; no Android decoder claim. */
|
||||
object CodecFixture {
|
||||
var frames=20; var fps=20; var gop=4; var firstPtsUs=0L
|
||||
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
|
||||
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
|
||||
}
|
||||
}
|
||||
class MediaFormat {
|
||||
companion object { const val KEY_MIME="mime"; const val KEY_WIDTH="width"; const val KEY_HEIGHT="height" }
|
||||
fun getString(key: String): String? = "video/avc"
|
||||
fun getInteger(key: String): Int = if (key == KEY_WIDTH) 480 else 848
|
||||
}
|
||||
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) {}
|
||||
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 advance() { frame++ }
|
||||
fun release() {}
|
||||
companion object { const val SEEK_TO_PREVIOUS_SYNC=0 }
|
||||
}
|
||||
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
|
||||
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 start() {}
|
||||
fun dequeueInputBuffer(timeout: Long) = 0
|
||||
fun getInputBuffer(index: Int): ByteBuffer = ByteBuffer.allocate(32)
|
||||
fun queueInputBuffer(index: Int,offset: Int,size: Int,pts: Long,flags: Int) { queue.add(Output(pts+CodecFixture.timestampOffsetUs,flags,size)) }
|
||||
fun dequeueOutputBuffer(info: BufferInfo,timeout: Long): Int {
|
||||
if (!CodecFixture.outputEnabled || queue.isEmpty()) return -1
|
||||
val out=queue.removeFirst(); current=out
|
||||
info.presentationTimeUs=out.pts; info.flags=out.flags; info.size=out.size
|
||||
return 0
|
||||
}
|
||||
fun releaseOutputBuffer(index: Int,render: Boolean) {
|
||||
if (render) { val pts=checkNotNull(current).pts; CodecFixture.rendered += pts; CodecFixture.onRender?.invoke(pts) }
|
||||
}
|
||||
fun flush() { queue.clear(); CodecFixture.flushes++ }
|
||||
fun stop() {}
|
||||
fun release() { CodecFixture.releases++ }
|
||||
}
|
||||
Reference in New Issue
Block a user