trying to fix rtmp issues

This commit is contained in:
Saxon1 2018-04-26 16:30:18 +09:30
parent c29d4097e2
commit b9987fe227
2 changed files with 2 additions and 3 deletions

View File

@ -312,7 +312,7 @@ func (r *revid) packClips() {
r.Log(Error, err.Error()) r.Log(Error, err.Error())
r.Log(Warning, "Clearing output chan!") r.Log(Warning, "Clearing output chan!")
// Keep clearing output chan until out buffer has some space // Keep clearing output chan until out buffer has some space
r.rtmpInst.EndSession() //r.rtmpInst.EndSession()
for clip, err = r.ringBuffer.Get(); err != nil; { for clip, err = r.ringBuffer.Get(); err != nil; {
r.flushData() r.flushData()
clip, err = r.ringBuffer.Get() clip, err = r.ringBuffer.Get()
@ -400,7 +400,6 @@ func (r *revid) outputClips() {
r.Log(Error, err2.Error()) r.Log(Error, err2.Error())
if r.config.Output == NativeRtmp && errorCount > 10 { if r.config.Output == NativeRtmp && errorCount > 10 {
r.rtmpInst.EndSession() r.rtmpInst.EndSession()
r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout)
err = r.rtmpInst.StartSession() err = r.rtmpInst.StartSession()
} }
} }

View File

@ -97,10 +97,10 @@ func (s *rtmpSession) WriteFrame(data []byte, dataLength uint) error {
// EndSession terminates the rtmp connection // EndSession terminates the rtmp connection
func (s *rtmpSession) EndSession() error { func (s *rtmpSession) EndSession() error {
if s.running { if s.running {
s.running = false
if !tools.UintToBool(uint(C.RTMP_end_session())) { if !tools.UintToBool(uint(C.RTMP_end_session())) {
return errors.New("RTMP end session error! Check rtmp log for details!") return errors.New("RTMP end session error! Check rtmp log for details!")
} }
s.running = false
} else { } else {
return errors.New("Tried to stop rtmp session, but not running!") return errors.New("Tried to stop rtmp session, but not running!")
} }