- Rust: 新增 media::stream 访问单元队列与分片重组,FFI 增加 ttstd_video_next/pending/stats(ABI 2) - Windows: runner 内嵌 Media Foundation 解码纹理插件(NV12/RGB32→BGRA),开启 CODECAPI_AVLowLatencyMode 消除约 36 帧积压,按显示区域裁掉 16 对齐补齐行 - Android: 大帧按 1200 字节分片发送;csd(SPS/PPS) 随每个关键帧重发,修复先投屏后连接时只收到 P 帧导致的黑屏 - Flutter: 独立 ttstd/video 通道获取 textureId 与统计,VideoView 渲染 Texture 并显示分辨率/PTS/失败原因 - 诊断: stats 增加 format/auBytes/keyframes/submitHr;缺插件、缺 SPS/PPS 显式提示;TTSTD_DUMP_VIDEO 可抓码流配合 ffprobe 定位 - 发现与服务检查: mDNS 发现客户端、服务地址探测、设置页与连接状态卡片(启动本机监听/停止) - 工具与文档: video_feed 推流示例、一键打包脚本、DEMO 出画面排查表与实测截图
114 lines
3.5 KiB
Dart
114 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class VideoView extends StatelessWidget {
|
|
const VideoView({
|
|
super.key,
|
|
this.textureId,
|
|
this.connected = false,
|
|
this.resolution = '',
|
|
this.pts,
|
|
this.error = '',
|
|
});
|
|
|
|
final int? textureId;
|
|
final bool connected;
|
|
final String resolution;
|
|
final int? pts;
|
|
|
|
/// 原生解码链路的失败原因,为空表示没有错误。
|
|
final String error;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return AspectRatio(
|
|
aspectRatio: 16 / 9,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(16),
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
theme.colorScheme.surfaceContainerHighest,
|
|
theme.colorScheme.surfaceContainerLowest,
|
|
],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
),
|
|
),
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
if (textureId != null)
|
|
Texture(textureId: textureId!)
|
|
else
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(Icons.connected_tv, size: 72, color: theme.colorScheme.primary.withValues(alpha: 0.6)),
|
|
const SizedBox(height: 12),
|
|
Text(connected ? '视频通道已建立' : '等待投屏画面',
|
|
style: theme.textTheme.titleMedium),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
error.isNotEmpty ? error : 'H.264/H.265 → External Texture',
|
|
style: theme.textTheme.bodySmall?.copyWith(
|
|
color: error.isNotEmpty
|
|
? theme.colorScheme.error
|
|
: theme.textTheme.bodySmall?.color,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
if (resolution.isNotEmpty)
|
|
Positioned(
|
|
top: 12,
|
|
left: 12,
|
|
child: _Badge(
|
|
icon: Icons.videocam,
|
|
label: resolution,
|
|
color: connected ? theme.colorScheme.primary : theme.colorScheme.outline,
|
|
),
|
|
),
|
|
if (pts != null)
|
|
Positioned(
|
|
top: 12,
|
|
right: 12,
|
|
child: _Badge(icon: Icons.timer, label: 'PTS $pts', color: theme.colorScheme.outline),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _Badge extends StatelessWidget {
|
|
const _Badge({required this.icon, required this.label, required this.color});
|
|
|
|
final IconData icon;
|
|
final String label;
|
|
final Color color;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
|
decoration: BoxDecoration(
|
|
color: Colors.black54,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(icon, size: 14, color: color),
|
|
const SizedBox(width: 6),
|
|
Text(label, style: const TextStyle(color: Colors.white, fontSize: 12)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|