}
```
-另外,当配置文件中的`debug模式`为`true`时,标准包[net/http/pprof](https://pkg.go.dev/net/http/pprof)将在`/debug/pprof/`路径可用,从而可以使用`go tool pprof`工具进行性能调试。
+另外,当配置文件中的`debug模式`为`true`时
+
+- 标准包[net/http/pprof](https://pkg.go.dev/net/http/pprof)将在`/debug/pprof/`路径可用,从而可以使用`go tool pprof`工具进行性能调试。
+- 当录制fmp4时,每1分钟打印m4s池状态
#### 自定义config_K_v.json
func (t *M4SStream) saveStreamM4s() (e error) {
// 同时下载数限制
- var download_limit = &funcCtrl.BlockFuncN{
- Max: 3,
+ var download_limit = &funcCtrl.BlockFuncN{Max: 3}
+
+ if v, ok := t.common.K_v.LoadV(`debug模式`).(bool); ok && v {
+ ctx, can := context.WithCancel(context.Background())
+ defer can()
+ go func() {
+ ticker := time.NewTicker(time.Minute)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case <-ticker.C:
+ }
+ t.log.L(`T: `, fmt.Sprintf("m4sPoolState pooled(%d), nopooled(%d), inuse(%d), nouse(%d), sum(%d)", t.m4s_pool.PoolState()...))
+ }
+ }()
}
//
done := time.AfterFunc(time.Second, func() {
cancelRec()
if conn != nil {
- println(conn.Close())
+ conn.Close()
}
}).Stop
defer done()