fix: report error when can't create file to write

desc: 当无法创建文件时报错
This commit is contained in:
langhuihui
2023-06-11 13:25:25 +08:00
parent fff5aef3c4
commit ab8e03475c
5 changed files with 14 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import (
"strconv"
"time"
"go.uber.org/zap"
. "m7s.live/engine/v4"
)
@@ -40,6 +41,9 @@ func (r *Recorder) OnEvent(event any) {
}
if file, err := r.CreateFileFn(filename, r.append); err == nil {
r.SetIO(file)
} else {
r.Error("create file failed", zap.Error(err))
r.Stop()
}
case AudioFrame:
// 纯音频流的情况下需要切割文件