Skip to content

Commit

Permalink
Fix FLV to RTSP transport after v1.3 AlexxIT#362
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 22, 2023
1 parent e8b22bc commit 5fe07ae
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/rtsp/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,22 @@ func (c *Conn) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiv

// save original codec to sender (can have Codec.Name = ANY)
sender := core.NewSender(media, codec)
sender.Handler = c.packetWriter(codec, channel)
// important to send original codec for valid IsRTP check
sender.Handler = c.packetWriter(track.Codec, channel, codec.PayloadType)
sender.HandleRTP(track)

c.senders = append(c.senders, sender)
return nil
}

func (c *Conn) packetWriter(codec *core.Codec, channel uint8) core.HandlerFunc {
func (c *Conn) packetWriter(codec *core.Codec, channel, payloadType uint8) core.HandlerFunc {
handlerFunc := func(packet *rtp.Packet) {
if c.state == StateNone {
return
}

clone := *packet
clone.Header.PayloadType = codec.PayloadType
clone.Header.PayloadType = payloadType

size := clone.MarshalSize()

Expand Down

0 comments on commit 5fe07ae

Please sign in to comment.