app/src/main/java/com/anyun/h264/H264Encoder.java
@@ -88,6 +88,7 @@
    // Context 和清理配置
    private Context context; // Context 对象,用于清理 TF 卡文件
    private long maxH264TotalSizeGB = 100; // 最大 H264 文件总大小(GB),默认 100GB
    private boolean useTFCard = false; // 是否使用 TF 卡输出
    // 网络传输控制
    private boolean enableNetworkTransmission = true; // 是否启用TCP/UDP网络传输
@@ -174,6 +175,13 @@
     */
    public void setContext(Context context) {
        this.context = context;
    }
    /**
     * 设置是否使用 TF 卡
     */
    public void setUseTFCard(boolean useTFCard) {
        this.useTFCard = useTFCard;
    }
    /**
@@ -459,6 +467,16 @@
                fileOutputStream = null;
            }
            
            // 如果使用内部 Flash(非 TF 卡),在创建新文件前检查并清理空间
            if (!useTFCard && context != null) {
                int result = FileUtil.ensureInternalFlashSpaceForH264(context);
                if (result == -1) {
                    Timber.e("Insufficient internal flash space (<800MB) even after cleanup, stop file output");
                    enableFileOutput = false;
                    return false;
                }
            }
            // 检查并清理 TF 卡上的 h264 文件(如果需要)
            if (context != null && outputFileDirectory != null && !outputFileDirectory.isEmpty()) {
                try {