清掉 5 个确认没人调用的遗留函数
staticcheck 的 U1000 一直报这 5 个,逐个核对过引用(含同名方法、测试、字符串调用、反射): - runFFmpeg:runFFmpegWith 的薄包装,没有任何调用点 - isLiveOn(uid int):包级函数没人用,实际在跑的始终是 streamer.isLiveOn() 方法 - quitRecord:需要收尾的地方都直接 updateLiveInfo(..., isRecording = false) - setLiveInfo:整体覆盖 liveInfo,早已被 updateLiveInfo(原地改部分字段)取代 - isRecording(liveID):字段 info.isRecording 到处都在直接用 上一轮那个 jobActive 虽然也是 U1000,但它是「本该接上却漏接」的护栏(接回后 P0 的并发问题才解决),所以这次删之前特意确认这 5 个不是同类情况:它们都有 等价且更合适的现役替代实现。 验证:gofmt -l 空;go vet ./... 空;go build ./... 通过;go test ./... 全绿(11.3s); staticcheck -checks=all 的 U1000 归零。
This commit is contained in:
@@ -933,14 +933,9 @@ func buildEncoders(bitrate int, ffmpegFile string) []videoEncoder {
|
||||
return encoders
|
||||
}
|
||||
|
||||
// 运行 ffmpeg,输出直接透传到控制台
|
||||
// ffmpeg 的进度回调:已输出时长(秒)、实时倍速、帧率、已写出字节
|
||||
type ffmpegProgress func(outSec, speed, fps float64, totalSize int64)
|
||||
|
||||
func runFFmpeg(ffmpegFile string, args []string, dir string) error {
|
||||
return runFFmpegWith(ffmpegFile, args, dir, nil)
|
||||
}
|
||||
|
||||
// 跑一次 ffmpeg。cb 不为空时加 -progress pipe:1 取结构化进度;
|
||||
// ffmpeg 自己的统计行仍在 stderr 里,照旧进日志,单独用命令行时不会少东西。
|
||||
func runFFmpegWith(ffmpegFile string, args []string, dir string, cb ffmpegProgress) error {
|
||||
|
||||
Reference in New Issue
Block a user