Add support incoming H264 bitstream #745

This commit is contained in:
Alex X
2023-11-13 22:56:07 +03:00
parent 2d16ee8884
commit aa3c081352
2 changed files with 34 additions and 6 deletions
+8 -6
View File
@@ -70,13 +70,15 @@ func (c *Producer) Start() error {
break
}
pkt := &rtp.Packet{
Header: rtp.Header{Timestamp: core.Now90000()},
Payload: annexb.EncodeToAVCC(buf[:i], true),
}
c.Receivers[0].WriteRTP(pkt)
if len(c.Receivers) > 0 {
pkt := &rtp.Packet{
Header: rtp.Header{Timestamp: core.Now90000()},
Payload: annexb.EncodeToAVCC(buf[:i], true),
}
c.Receivers[0].WriteRTP(pkt)
//log.Printf("[AVC] %v, len: %d", h264.Types(pkt.Payload), len(pkt.Payload))
//log.Printf("[AVC] %v, len: %d", h264.Types(pkt.Payload), len(pkt.Payload))
}
buf = buf[i:]
}