Ran go fmt

This commit is contained in:
saxon 2018-07-12 00:50:18 +09:30
parent 24eac36bbd
commit 46cff84322
1 changed files with 15 additions and 17 deletions

View File

@ -43,9 +43,9 @@ import "C"
import ( import (
"errors" "errors"
"log"
"strconv" "strconv"
"unsafe" "unsafe"
"log"
) )
const ( const (
@ -62,7 +62,6 @@ type Session interface {
// session provides parameters required for an rtmp communication session. // session provides parameters required for an rtmp communication session.
type session struct { type session struct {
rtmp *C.RTMP rtmp *C.RTMP
url string url string
timeout uint timeout uint
} }
@ -126,7 +125,6 @@ func (s *session) rtmpWrite(r *C.RTMP, buf []byte) int {
} }
if buf[0] == 'F' && buf[1] == 'L' && buf[2] == 'V' { if buf[0] == 'F' && buf[1] == 'L' && buf[2] == 'V' {
// buf += 13
buf = buf[13:] buf = buf[13:]
s2 -= 13 s2 -= 13
} }
@ -168,11 +166,13 @@ func (s *session) rtmpWrite(r *C.RTMP, buf []byte) int {
&av_setDataFrame)) &av_setDataFrame))
// C-code: pkt.m_nBytesRead enc - pkt.m_body // C-code: pkt.m_nBytesRead enc - pkt.m_body
pkt.m_nBytesRead = (C.uint)(uintptr(enc)-uintptr(unsafe.Pointer(pkt.m_body))) pkt.m_nBytesRead = (C.uint)(uintptr(enc) -
uintptr(unsafe.Pointer(pkt.m_body)))
} }
} else { } else {
//C-code: enc = pkt.m_body + pkt.m_nBytesRead //C-code: enc = pkt.m_body + pkt.m_nBytesRead
enc = unsafe.Pointer(uintptr(unsafe.Pointer(pkt.m_body)) + uintptr(pkt.m_nBytesRead)) enc = unsafe.Pointer(uintptr(unsafe.Pointer(pkt.m_body)) +
uintptr(pkt.m_nBytesRead))
} }
num = int(pkt.m_nBodySize - pkt.m_nBytesRead) num = int(pkt.m_nBodySize - pkt.m_nBytesRead)
@ -197,7 +197,6 @@ func (s *session) rtmpWrite(r *C.RTMP, buf []byte) int {
if ret == 0 { if ret == 0 {
return -1 return -1
} }
// buf += 4
buf = buf[4:] buf = buf[4:]
s2 -= 4 s2 -= 4
if s2 < 0 { if s2 < 0 {
@ -208,7 +207,6 @@ func (s *session) rtmpWrite(r *C.RTMP, buf []byte) int {
return size + s2 return size + s2
} }
func (s *session) writeFrame(data []byte) uint { func (s *session) writeFrame(data []byte) uint {
if C.RTMP_IsConnected(s.rtmp) <= 0 { if C.RTMP_IsConnected(s.rtmp) <= 0 {
return 1 return 1