changed redundent data creation

This commit is contained in:
Saxon1 2018-05-03 15:08:10 +09:30
parent e477ee8a65
commit 51ade541c9
1 changed files with 1 additions and 3 deletions

View File

@ -83,9 +83,7 @@ func (s *rtmpSession) StartSession() error {
// TODO: Remove mutex // TODO: Remove mutex
func (s *rtmpSession) WriteFrame(data []byte, dataLength uint) error { func (s *rtmpSession) WriteFrame(data []byte, dataLength uint) error {
if s.running { if s.running {
dataCopy := make([]byte, len(data)) if !tools.UintToBool(uint(C.RTMP_write_frame((*C.char)(unsafe.Pointer(&data[0])), C.uint(dataLength)))) {
copy(dataCopy, data)
if !tools.UintToBool(uint(C.RTMP_write_frame((*C.char)(unsafe.Pointer(&dataCopy[0])), C.uint(dataLength)))) {
return errors.New("RTMP write error! Check rtmp log for details!") return errors.New("RTMP write error! Check rtmp log for details!")
} }
} else { } else {