removed mutex

This commit is contained in:
Saxon1 2018-04-26 16:04:47 +09:30
parent 45f33f3d3a
commit 5847aad552
2 changed files with 4 additions and 2 deletions

View File

@ -314,6 +314,10 @@ func (r *revid) packClips() {
// Keep clearing output chan until out buffer has some space // Keep clearing output chan until out buffer has some space
for clip, err = r.ringBuffer.Get(); err != nil; { for clip, err = r.ringBuffer.Get(); err != nil; {
r.flushData() r.flushData()
r.Log(Debug,"Ending rtmp session")
r.rtmpInst.EndSession()
r.Log(Debug, "Creating new session")
r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout)
rtmpError := r.rtmpInst.StartSession() rtmpError := r.rtmpInst.StartSession()
if rtmpError != nil { if rtmpError != nil {
r.Log(Error, rtmpError.Error()) r.Log(Error, rtmpError.Error())

View File

@ -82,8 +82,6 @@ func (s *rtmpSession) StartSession() error {
// WriteFrame writes a frame (flv tag) to the rtmp connection // WriteFrame writes a frame (flv tag) to the rtmp connection
// TODO: Remove mutex // TODO: Remove mutex
func (s *rtmpSession) WriteFrame(data []byte, dataLength uint) error { func (s *rtmpSession) WriteFrame(data []byte, dataLength uint) error {
s.mutex.Lock()
defer s.mutex.Unlock()
if s.running { if s.running {
dataCopy := make([]byte, len(data)) dataCopy := make([]byte, len(data))
copy(dataCopy, data) copy(dataCopy, data)