diff --git a/plugin.go b/plugin.go index 0324c16..c613775 100644 --- a/plugin.go +++ b/plugin.go @@ -244,7 +244,13 @@ func (opt *Plugin) Pull(streamPath string, url string, puller IPuller, save bool var NoPushConfigErr = errors.New("no push config") func (opt *Plugin) Push(streamPath string, url string, pusher IPusher, save bool) (err error) { - opt.Info("push", zap.String("path", streamPath), zap.String("url", url)) + zp, zu := zap.String("path", streamPath), zap.String("url", url) + opt.Info("push", zp, zu) + defer func() { + if err != nil { + opt.Error("push faild", zap.Error(err)) + } + }() conf, ok := opt.Config.(config.PushConfig) if !ok { return NoPushConfigErr @@ -262,9 +268,13 @@ func (opt *Plugin) Push(streamPath string, url string, pusher IPusher, save bool } go func() { - defer opt.Info("stop push", zap.String("remoteURL", url)) + defer opt.Info("push finished", zp, zu) for pusher.Reconnect() { - if pusher.Push(); !pusher.IsClosed() { + opt.Info("start push", zp, zu) + if err = pusher.Push(); !pusher.IsClosed() { + if err != nil { + opt.Info("stop push", zp, zu, zap.Error(err)) + } if err = pusher.Connect(); err != nil { return } diff --git a/subscriber.go b/subscriber.go index afa9e09..663586b 100644 --- a/subscriber.go +++ b/subscriber.go @@ -329,7 +329,7 @@ func (s *Subscriber) sendAudioDecConf() { type IPusher interface { ISubscriber - Push() + Push() error Connect() error init(string, string, *config.Push) Reconnect() bool diff --git a/track/h265.go b/track/h265.go index f826bb5..62c6643 100644 --- a/track/h265.go +++ b/track/h265.go @@ -65,7 +65,7 @@ func (vt *H265) WriteSlice(slice NALUSlice) { codec.NAL_UNIT_CODED_SLICE_CRA: vt.Video.Media.RingBuffer.Value.IFrame = true fallthrough - case 0, 1, 2, 3, 4, 5, 6, 7, 9, codec.NAL_UNIT_SEI: + case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, codec.NAL_UNIT_SEI: vt.Video.Media.WriteSlice(slice) default: vt.Video.Stream.Warn("h265 slice type not supported", zap.Uint("type", uint(slice.H265Type()))) @@ -177,7 +177,7 @@ func (vt *H265) Flush() { } out = append(out, buf) for _, bufs := range buffers[1:] { - buf := []byte{firstByte, firstBuffer[0][1], byte(naluType) >> 1} + buf := []byte{firstByte, firstBuffer[0][1], byte(naluType)} for _, sp := range bufs { buf = append(buf, sp...) }