change signature of rtp encoders and decoders

This commit is contained in:
aler9
2022-03-20 11:30:04 +01:00
parent ba99421e74
commit e7aca99c73
13 changed files with 175 additions and 110 deletions

View File

@@ -51,10 +51,11 @@ func main() {
panic("H264 track not found")
}
// setup decoder
dec := rtph264.NewDecoder()
// setup RTP->H264 decoder
rtpDec := &rtph264.Decoder{}
rtpDec.Init()
// setup encoder
// setup H264->MPEGTS encoder
enc, err := newMPEGTSEncoder(sps, pps)
if err != nil {
panic(err)
@@ -67,7 +68,7 @@ func main() {
}
// decode H264 NALUs from the RTP packet
nalus, pts, err := dec.DecodeUntilMarker(pkt)
nalus, pts, err := rtpDec.DecodeUntilMarker(pkt)
if err != nil {
return
}