Do not start forwarding on an out-of-order packet. (#2917)
It is possible that old packets arrive on receiver. If subscriber starts on that, the first packet time would be incorrect. Do not start forwarding on out-of-order packets.
This commit is contained in:
@@ -66,6 +66,7 @@ type ExtPacket struct {
|
|||||||
RawPacket []byte
|
RawPacket []byte
|
||||||
DependencyDescriptor *ExtDependencyDescriptor
|
DependencyDescriptor *ExtDependencyDescriptor
|
||||||
AbsCaptureTimeExt *act.AbsCaptureTime
|
AbsCaptureTimeExt *act.AbsCaptureTime
|
||||||
|
IsOutOfOrder bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Buffer contains all packets
|
// Buffer contains all packets
|
||||||
@@ -763,6 +764,7 @@ func (b *Buffer) getExtPacket(rtpPacket *rtp.Packet, arrivalTime int64, flowStat
|
|||||||
Spatial: InvalidLayerSpatial,
|
Spatial: InvalidLayerSpatial,
|
||||||
Temporal: InvalidLayerTemporal,
|
Temporal: InvalidLayerTemporal,
|
||||||
},
|
},
|
||||||
|
IsOutOfOrder: flowState.IsOutOfOrder,
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rtpPacket.Payload) == 0 {
|
if len(rtpPacket.Payload) == 0 {
|
||||||
|
|||||||
@@ -745,7 +745,8 @@ func (d *DownTrack) maxLayerNotifierWorker() {
|
|||||||
|
|
||||||
// WriteRTP writes an RTP Packet to the DownTrack
|
// WriteRTP writes an RTP Packet to the DownTrack
|
||||||
func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error {
|
func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error {
|
||||||
if !d.writable.Load() {
|
if !d.writable.Load() || (extPkt.IsOutOfOrder && !d.rtpStats.IsActive()) {
|
||||||
|
// do not start on an out-of-order packet
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,7 +802,7 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error {
|
|||||||
// the corresponding sequence number is received.
|
// the corresponding sequence number is received.
|
||||||
// The extreme case is all packets containing the play out delay are lost and
|
// The extreme case is all packets containing the play out delay are lost and
|
||||||
// all of them retransmitted and an RTCP Receiver Report received for those
|
// all of them retransmitted and an RTCP Receiver Report received for those
|
||||||
// retransmited sequence numbers. But, that is highly improbable, if not impossible.
|
// retransmitted sequence numbers. But, that is highly improbable, if not impossible.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var actBytes []byte
|
var actBytes []byte
|
||||||
|
|||||||
Reference in New Issue
Block a user