mirror of
https://github.com/lkmio/lkm.git
synced 2025-09-27 11:32:26 +08:00
fix: 级联发生崩溃问题;
This commit is contained in:
@@ -81,12 +81,11 @@ func (f *ForwardSink) Write(index int, data []*collections.ReferenceCounter[[]by
|
|||||||
f.rtpBuffer = NewRtpBuffer(1024)
|
f.rtpBuffer = NewRtpBuffer(1024)
|
||||||
}
|
}
|
||||||
|
|
||||||
processedData = make([]*collections.ReferenceCounter[[]byte], 0, len(data))
|
|
||||||
} else if f.rtpBuffer == nil {
|
} else if f.rtpBuffer == nil {
|
||||||
f.rtpBuffer = NewRtpBuffer(1)
|
f.rtpBuffer = NewRtpBuffer(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, datum := range data {
|
for _, datum := range data {
|
||||||
src := datum.Get()
|
src := datum.Get()
|
||||||
counter := f.rtpBuffer.Get()
|
counter := f.rtpBuffer.Get()
|
||||||
bytes := counter.Get()
|
bytes := counter.Get()
|
||||||
@@ -103,7 +102,7 @@ func (f *ForwardSink) Write(index int, data []*collections.ReferenceCounter[[]by
|
|||||||
} else {
|
} else {
|
||||||
counter.ResetData(bytes[:length])
|
counter.ResetData(bytes[:length])
|
||||||
counter.Refer()
|
counter.Refer()
|
||||||
processedData[i] = counter
|
processedData = append(processedData, counter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +168,7 @@ func NewForwardSink(transportType TransportType, protocol TransStreamProtocol, s
|
|||||||
BaseSink: BaseSink{ID: sinkId, SourceID: sourceId, State: SessionStateCreated, Protocol: protocol},
|
BaseSink: BaseSink{ID: sinkId, SourceID: sourceId, State: SessionStateCreated, Protocol: protocol},
|
||||||
transportType: transportType,
|
transportType: transportType,
|
||||||
ssrc: ssrc,
|
ssrc: ssrc,
|
||||||
requireSSRCMatch: true, // 默认要求ssrc一致
|
requireSSRCMatch: false, // 默认允许ssrc可以不一致
|
||||||
}
|
}
|
||||||
|
|
||||||
if transportType == TransportTypeUDP {
|
if transportType == TransportTypeUDP {
|
||||||
|
@@ -23,7 +23,7 @@ func (f *RtpStream) Input(packet *avformat.AVPacket, _ int) ([]*collections.Refe
|
|||||||
bytes := counter.Get()
|
bytes := counter.Get()
|
||||||
binary.BigEndian.PutUint16(bytes, size-2)
|
binary.BigEndian.PutUint16(bytes, size-2)
|
||||||
copy(bytes[2:], packet.Data)
|
copy(bytes[2:], packet.Data)
|
||||||
counter.ResetData(bytes[:2+len(bytes)])
|
counter.ResetData(bytes[:size])
|
||||||
|
|
||||||
// 每帧都当关键帧, 直接发给上级
|
// 每帧都当关键帧, 直接发给上级
|
||||||
return []*collections.ReferenceCounter[[]byte]{counter}, -1, true, nil
|
return []*collections.ReferenceCounter[[]byte]{counter}, -1, true, nil
|
||||||
|
Reference in New Issue
Block a user