improve performance

This commit is contained in:
aler9
2022-04-10 15:10:30 +02:00
parent 3123346397
commit ff34f5ac1d
6 changed files with 23 additions and 19 deletions

View File

@@ -218,10 +218,12 @@ func (st *ServerStream) readerSetInactive(ss *ServerSession) {
// WritePacketRTP writes a RTP packet to all the readers of the stream.
func (st *ServerStream) WritePacketRTP(trackID int, pkt *rtp.Packet, ptsEqualsDTS bool) {
byts, err := pkt.Marshal()
byts := make([]byte, maxPacketSize)
n, err := pkt.MarshalTo(byts)
if err != nil {
return
}
byts = byts[:n]
track := st.stTracks[trackID]
now := time.Now()