Skip to content

Commit

Permalink
[feat] customize pub支持叠加静音音频数据
Browse files Browse the repository at this point in the history
  • Loading branch information
q191201771 committed Apr 24, 2022
1 parent 09f903d commit d2b80a4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/logic/group__in.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ func (group *Group) AddCustomizePubSession(streamName string) (ICustomizePubSess
)
}

group.customizePubSession.WithOnRtmpMsg(group.OnReadRtmpAvMsg)
if group.config.RtmpConfig.AddDummyAudioEnable {
group.dummyAudioFilter = remux.NewDummyAudioFilter(group.UniqueKey, group.config.RtmpConfig.AddDummyAudioWaitAudioMs, group.OnReadRtmpAvMsg)
group.customizePubSession.WithOnRtmpMsg(group.dummyAudioFilter.OnReadRtmpAvMsg)
} else {
group.customizePubSession.WithOnRtmpMsg(group.OnReadRtmpAvMsg)
}

return group.customizePubSession, nil
}

Expand All @@ -63,7 +69,9 @@ func (group *Group) AddRtmpPubSession(session *rtmp.ServerSession) error {
)
}

// TODO(chef): 为rtmp pull以及rtsp也添加叠加静音音频的功能
// TODO(chef): feat 为其他输入流也添加假音频。比如rtmp pull以及rtsp
// TODO(chef): refactor 可考虑抽象出一个输入流的配置块
// TODO(chef): refactor 考虑放入addIn中
if group.config.RtmpConfig.AddDummyAudioEnable {
// TODO(chef): 从整体控制和锁关系来说,应该让pub的数据回调到group中进锁后再让数据流入filter
// TODO(chef): 这里用OnReadRtmpAvMsg正确吗,是否会重复进锁
Expand Down

0 comments on commit d2b80a4

Please sign in to comment.