From 1800d2f6dabe15b628808476d7ed16018fa2a880 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Mon, 18 Jun 2018 15:15:03 +0930 Subject: [PATCH] revid: use direct access to ring.Chunk bytes --- revid/senders.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index d37e0e4c..6e59a856 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -29,8 +29,6 @@ LICENSE package revid import ( - "bytes" - "fmt" "io" "os" "os/exec" @@ -107,8 +105,6 @@ type httpSender struct { log func(lvl, msg string) - buf []byte - chunk *ring.Chunk } @@ -123,25 +119,16 @@ func newHttpSender(_ string, _ time.Duration, log func(lvl, msg string)) *httpSe func (s *httpSender) load(c *ring.Chunk) error { s.chunk = c - buf := bytes.NewBuffer(s.buf[:0]) - _, err := s.chunk.WriteTo(buf) - s.buf = buf.Bytes() - if err != nil { - return fmt.Errorf("httpSender: %v", err) - } return nil } func (s *httpSender) send() error { pins := netsender.MakePins("V0", "") - pins[0].Value = len(s.buf) - pins[0].Data = s.buf + pins[0].Value = s.chunk.Len() + pins[0].Data = s.chunk.Bytes() pins[0].MimeType = "video/mp2t" _, _, err := s.client.Send(netsender.RequestPoll, pins) - if err != nil { - return err - } - return nil + return err } func (s *httpSender) release() {