perf(video): 消除中间帧复制并优化 MJPEG 有界预取

通过 Bytes 所有权和只读 AVBufferRef 引用池化 NV12 输入,消除中间 AVFrame 的整帧复制,并保留 V4L2 编码包脱离硬件缓冲的处理。

允许输出健康时有界预取 MJPEG,在输出背压时优先解码前丢帧;增加等帧、输出等待、丢帧原因及编码分段耗时统计,提供预取和所有权输入的对照开关。

补充缓冲寿命、只读保护、软件编码回退和队列策略测试及接口说明,保留现有 PTS、解码 worker、音频和加密行为。
This commit is contained in:
mofeng-git
2026-10-01 20:29:06 +08:00
parent 318b58b26a
commit 2f60e61dd5
13 changed files with 994 additions and 41 deletions

View File

@@ -0,0 +1,17 @@
#ifndef FFMPEG_RAM_ENCODE_STATS_H
#define FFMPEG_RAM_ENCODE_STATS_H
#include <stdint.h>
typedef struct RamEncodeStats {
uint64_t input_frames;
uint64_t borrowed_frames;
uint64_t copied_frames;
uint64_t copied_bytes;
uint64_t prepare_us;
uint64_t send_us;
uint64_t receive_us;
uint64_t packet_us;
} RamEncodeStats;
#endif