feat: 打通音频整链,被控端送 PCM、主控端 waveOut 播放

- android_receiver:音频改为直接送 PCM16(FLAG_PCM=0x80),不再走 Opus 编码
  (仓库未打包 libopus,MediaCodec Opus 多数设备不可用,主控端也无解码器)
- rust_core:新增 media/audio 播放队列(上限 1 秒、按帧对齐切分、超出丢最旧)
- rust_core:音频分片校验 MAC 后按 FLAG_PCM 入队,旧 Opus 包明确丢弃并记日志
- rust_core:新增 ttstd_audio_next / ttstd_audio_pending / ttstd_audio_stats
- flutter_sender:新增 audio_player(waveOut)轮询播放队列,有数据才打开设备、静音 3 秒自动关闭
- docs:README 增加音频链路章节与 PCM 取舍,AGENTS 记录 FLAG_PCM 约定
This commit is contained in:
tongtong committed 2026-11-27 21:15:17 +08:00
1 parent c6925d0890
commit 37b2cff82b
14 files changed
+468 -19

No files matched your search

@@ -2,6 +2,7 @@
#include <optional>
#include "audio_player.h"
#include "flutter/generated_plugin_registrant.h"
#include "video_texture.h"
@@ -29,6 +30,8 @@ bool FlutterWindow::OnCreate() {
// 视频解码纹理:把 Rust Core 收到的视频帧解码后交给 Flutter 的 Texture 组件。
RegisterVideoTexturePlugin(
flutter_controller_->engine()->GetRegistrarForPlugin("TTSTDVideoTexture"));
// 音频播放:轮询 Rust Core 的 PCM 队列,用 waveOut 直接出声。
StartAudioPlayer();
SetChildContent(flutter_controller_->view()->GetNativeWindow());
flutter_controller_->engine()->SetNextFrameCallback([&]() {
@@ -44,6 +47,7 @@ bool FlutterWindow::OnCreate() {
}
void FlutterWindow::OnDestroy() {
StopAudioPlayer();
if (flutter_controller_) {
flutter_controller_ = nullptr;
}