mirror of https://bitbucket.org/ausocean/av.git
Merge branch 'master' into audio-mts-encoder
This commit is contained in:
commit
669a7d3c22
|
@ -74,10 +74,10 @@ func (p *Pkt) Bytes(buf []byte) []byte {
|
|||
if p.X {
|
||||
headerExtensionLen = int(4 + 4*len(p.Extension.Header))
|
||||
}
|
||||
requiredPktLen := defaultHeadSize + uint8(4*p.CC) + uint8(headerExtensionLen) + uint8(len(p.Payload)) + uint8(len(p.Padding))
|
||||
requiredPktLen := defaultHeadSize + int(4*p.CC) + headerExtensionLen + len(p.Payload) + len(p.Padding)
|
||||
|
||||
// Create new space if no buffer is given, or it doesn't have sufficient capacity.
|
||||
if buf == nil || requiredPktLen > uint8(cap(buf)) {
|
||||
if buf == nil || requiredPktLen > cap(buf) {
|
||||
buf = make([]byte, requiredPktLen, defPktSize)
|
||||
}
|
||||
buf = buf[:requiredPktLen]
|
||||
|
|
|
@ -282,5 +282,11 @@ func newRtpSender(addr string, log func(lvl int8, msg string, args ...interface{
|
|||
|
||||
// Write implements io.Writer.
|
||||
func (s *rtpSender) Write(d []byte) (int, error) {
|
||||
return s.encoder.Write(s.data)
|
||||
s.data = make([]byte, len(d))
|
||||
copy(s.data, d)
|
||||
_, err := s.encoder.Write(s.data)
|
||||
if err != nil {
|
||||
s.log(logger.Warning, pkg+"rtpSender: write error", err.Error())
|
||||
}
|
||||
return len(d), nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue