Fixed debug mode for C_RTMP_SendPacket().

This commit is contained in:
scruzin 2019-01-06 17:17:51 +10:30
parent 309680f019
commit 9335e2701d
1 changed files with 3 additions and 8 deletions

View File

@ -1431,16 +1431,12 @@ func C_RTMP_SendPacket(r *C_RTMP, packet *C_RTMPPacket, queue int) error {
if debugMode {
if r.Link.conn != nil {
f, err := r.Link.conn.File()
if err != nil {
log.Printf("could not get file: %v", err)
} else {
log.Printf("C_RTMP_SendPacket: fd=%d, size=%v", f.Fd(), nSize)
}
log.Printf("C_RTMP_SendPacket: %v=>%v, size=%v", r.Link.conn.LocalAddr(), r.Link.conn.RemoteAddr(), nSize)
}
}
// TODO(kortschak): Rewrite this horrific peice of premature optimisation.
// NB: RTMP wants packets in chunks which are 128 bytes by default, but the server may request a different size.
for nSize+hSize != 0 {
if nChunkSize > nSize {
nChunkSize = nSize
@ -1450,10 +1446,9 @@ func C_RTMP_SendPacket(r *C_RTMP, packet *C_RTMPPacket, queue int) error {
if err != nil {
return err
}
n := nChunkSize + hSize // Since C_WriteN doesn't return number of bytes written.
nSize -= nChunkSize
origIdx += n
origIdx += nChunkSize + hSize
hSize = 0
if nSize > 0 {