~/talk

Deep Dive into Kotlin Flow Buffering and Execution Models Using Real-Time Audio Processing

TalkinJapaneseat DroidKaigi 2026 · 2026-09-01..09-03· [android, reactive-programming]
name:tkc
links:none on file
slides:none on file

A Kotlin/Android talk examines replacing a manual MediaCodec loop with a Kotlin Flow pipeline (Producer/Intermediate/Consumer) for real‑time audio. It shows a concrete bug where shareIn creates a SharedFlow with a default 64‑entry buffer while an internal ring buffer has 30 slots, causing upstream to run ahead and audio frames to be overwritten so background music plays faster; the talk reproduces this by capturing PCM from AudioTrack and gives fixes: use a zero‑buffer SharedFlow (or set buffer 0 before shareIn) and adjust Channel send/tryReceive timing to match device AudioTrack buffer sizes.

AI-written summary · about

  1. 0:00Introduction
  2. 4:48Audio processing overview
  3. 9:45Producer and consumer roles
  4. 13:18Ring buffer basics
  5. 19:25Cold vs hot flows
  6. 27:40Shared flow buffering
  7. 32:12Fast-forward issue in BGM
  8. 34:43Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.