Encoding primary packet only if red encoding don't have enough space (#1196)
* Encoding primary packet only if red encoding don't have enough space * clean code
This commit is contained in:
@@ -131,6 +131,16 @@ func (r *RedReceiver) encodeRedForPrimary(pkt *rtp.Packet, redPayload []byte) (i
|
||||
}
|
||||
|
||||
func encodeRedForPrimary(redPkts []*rtp.Packet, primary *rtp.Packet, redPayload []byte) (int, error) {
|
||||
payloadSize := len(primary.Payload) + 1
|
||||
for _, p := range redPkts {
|
||||
payloadSize += len(p.Payload) + 4
|
||||
}
|
||||
|
||||
// if required payload size is larger than the redPayload buffer, encode the primary packet only
|
||||
if payloadSize > len(redPayload) {
|
||||
redPkts = redPkts[:0]
|
||||
}
|
||||
|
||||
var index int
|
||||
for _, p := range redPkts {
|
||||
/* RED payload https://datatracker.ietf.org/doc/html/rfc2198#section-3
|
||||
|
||||
Reference in New Issue
Block a user