Removed packet member from Session.

This commit is contained in:
scruzin 2019-01-07 20:16:11 +10:30
parent 8ed3c04186
commit 0b869523b4
2 changed files with 3 additions and 7 deletions

View File

@ -54,7 +54,6 @@ const (
) )
const ( const (
// av_setDataFrame is a static const global in rtmp.c
setDataFrame = "@setDataFrame" setDataFrame = "@setDataFrame"
av__checkbw = "_checkbw" av__checkbw = "_checkbw"
@ -870,8 +869,6 @@ leave:
return nil return nil
} }
// int HandShake(RTMP* r, int FP9HandShake);
// rtmp.c +3744
func handshake(s *Session, FP9HandShake int32) error { func handshake(s *Session, FP9HandShake int32) error {
var clientbuf [RTMP_SIG_SIZE + 1]byte var clientbuf [RTMP_SIG_SIZE + 1]byte
clientsig := clientbuf[1:] clientsig := clientbuf[1:]
@ -937,7 +934,7 @@ func handshake(s *Session, FP9HandShake int32) error {
// write prepares data to write then sends it. // write prepares data to write then sends it.
func (s *Session) write(buf []byte) error { func (s *Session) write(buf []byte) error {
var pkt = &s.write var pkt packet
var enc []byte var enc []byte
size := len(buf) size := len(buf)
var num int var num int
@ -974,7 +971,7 @@ func (s *Session) write(buf []byte) error {
pkt.bodySize += 16 pkt.bodySize += 16
} }
resizePacket(pkt, pkt.bodySize, headerType) resizePacket(&pkt, pkt.bodySize, headerType)
enc = pkt.body[:pkt.bodySize] enc = pkt.body[:pkt.bodySize]
if pkt.packetType == RTMP_PACKET_TYPE_INFO { if pkt.packetType == RTMP_PACKET_TYPE_INFO {
@ -997,7 +994,7 @@ func (s *Session) write(buf []byte) error {
pkt.bytesRead += uint32(num) pkt.bytesRead += uint32(num)
buf = buf[num:] buf = buf[num:]
if pkt.bytesRead == pkt.bodySize { if pkt.bytesRead == pkt.bodySize {
err := sendPacket(s, pkt, 0) err := sendPacket(s, &pkt, 0)
pkt.body = nil pkt.body = nil
pkt.bytesRead = 0 pkt.bytesRead = 0
if err != nil { if err != nil {

View File

@ -62,7 +62,6 @@ type Session struct {
audioCodecs float64 audioCodecs float64
videoCodecs float64 videoCodecs float64
encoding float64 encoding float64
write packet
defered []byte defered []byte
link link link link
} }