mirror of https://bitbucket.org/ausocean/av.git
revid: added some commentary
This commit is contained in:
parent
3896a5e804
commit
648b43c50a
|
@ -113,8 +113,13 @@ func (s *minimalHttpSender) send(d []byte) error {
|
|||
// When a loadSender has finished using the *ring.Chunk
|
||||
// it must be Closed.
|
||||
type loadSender interface {
|
||||
// load assigns the *ring.Chunk to the loadSender.
|
||||
// The load call may fail, but must not mutate the
|
||||
// the chunk.
|
||||
load(d []byte) error
|
||||
|
||||
// send performs a destination-specific send
|
||||
// operation. It must not mutate the chunk.
|
||||
send() error
|
||||
|
||||
// release releases the *ring.Chunk.
|
||||
|
@ -136,6 +141,7 @@ type fileSender struct {
|
|||
data []byte
|
||||
}
|
||||
|
||||
// Write implements io.Writer. This will attempt to load and send the data given.
|
||||
func (s *fileSender) Write(d []byte) (int, error) {
|
||||
err := s.load(d)
|
||||
if err != nil {
|
||||
|
@ -185,6 +191,7 @@ type mtsSender struct {
|
|||
curPid int
|
||||
}
|
||||
|
||||
// Write implements io.Writer. This will attempt to load and send the data given.
|
||||
func (s *mtsSender) Write(d []byte) (int, error) {
|
||||
return write(s, d)
|
||||
}
|
||||
|
@ -372,6 +379,7 @@ func newRtmpSender(url string, timeout uint, retries int, log func(lvl int8, msg
|
|||
return s, err
|
||||
}
|
||||
|
||||
// Write implements io.Writer. This will attempt to load and send the data given.
|
||||
func (s *rtmpSender) Write(d []byte) (int, error) {
|
||||
return write(s, d)
|
||||
}
|
||||
|
@ -425,6 +433,7 @@ type rtpSender struct {
|
|||
data []byte
|
||||
}
|
||||
|
||||
// Write implements io.Writer. This will attempt to load and send the data given.
|
||||
func (s *rtpSender) Write(d []byte) (int, error) {
|
||||
return write(s, d)
|
||||
}
|
||||
|
@ -456,6 +465,7 @@ func (s *rtpSender) send() error {
|
|||
return err
|
||||
}
|
||||
|
||||
// write wraps the load and send method for loadSenders.
|
||||
func write(s loadSender, d []byte) (int, error) {
|
||||
err := s.load(d)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue