diff --git a/pkg/kasa/producer.go b/pkg/kasa/producer.go index cbad1028..bcca1678 100644 --- a/pkg/kasa/producer.go +++ b/pkg/kasa/producer.go @@ -12,6 +12,7 @@ import ( "github.com/AlexxIT/go2rtc/pkg/core" "github.com/AlexxIT/go2rtc/pkg/h264" "github.com/AlexxIT/go2rtc/pkg/h264/annexb" + "github.com/AlexxIT/go2rtc/pkg/multipart" "github.com/AlexxIT/go2rtc/pkg/tcp" "github.com/pion/rtp" ) @@ -69,7 +70,7 @@ func (c *Producer) Start() error { } for { - header, body, err := tcp.NextMultipart(c.reader) + header, body, err := multipart.Next(c.reader) if err != nil { return err } @@ -130,7 +131,7 @@ func (c *Producer) probe() error { timeout := time.Now().Add(core.ProbeTimeout) for (waitVideo || waitAudio) && time.Now().Before(timeout) { - header, body, err := tcp.NextMultipart(c.reader) + header, body, err := multipart.Next(c.reader) if err != nil { return err } diff --git a/pkg/tcp/multipart.go b/pkg/multipart/multipart.go similarity index 91% rename from pkg/tcp/multipart.go rename to pkg/multipart/multipart.go index bc13c45b..aea1b828 100644 --- a/pkg/tcp/multipart.go +++ b/pkg/multipart/multipart.go @@ -1,4 +1,4 @@ -package tcp +package multipart import ( "bufio" @@ -10,7 +10,7 @@ import ( "strings" ) -func NextMultipart(rd *bufio.Reader) (http.Header, []byte, error) { +func Next(rd *bufio.Reader) (http.Header, []byte, error) { for { // search next boundary and skip empty lines s, err := rd.ReadString('\n') diff --git a/pkg/multipart/producer.go b/pkg/multipart/producer.go index 9ab268fe..70a2c547 100644 --- a/pkg/multipart/producer.go +++ b/pkg/multipart/producer.go @@ -6,7 +6,6 @@ import ( "io" "github.com/AlexxIT/go2rtc/pkg/core" - "github.com/AlexxIT/go2rtc/pkg/tcp" "github.com/pion/rtp" ) @@ -46,7 +45,7 @@ func (c *Producer) Start() error { mjpeg := c.Receivers[0] for { - _, body, err := tcp.NextMultipart(c.reader) + _, body, err := Next(c.reader) if err != nil { return err }