使用rtsp拉流时将参数传入订阅者

This commit is contained in:
dexter
2023-01-02 21:12:45 +08:00
parent 187335d311
commit 7f4bfe4c78
4 changed files with 31 additions and 41 deletions

View File

@@ -16,6 +16,9 @@ type RTSPSubscriber struct {
func (s *RTSPSubscriber) OnEvent(event any) {
switch v := event.(type) {
case *track.Video:
if s.Video.Track != nil {
return
}
switch v.CodecID {
case codec.CodecID_H264:
extra := v.DecoderConfiguration.Raw
@@ -33,6 +36,9 @@ func (s *RTSPSubscriber) OnEvent(event any) {
}
s.AddTrack(v)
case *track.Audio:
if s.Audio.Track != nil {
return
}
switch v.CodecID {
case codec.CodecID_AAC:
var mpegConf mpeg4audio.Config