mirror of https://bitbucket.org/ausocean/av.git
Merged in remove-udp-sender (pull request #165)
revid: removed udp sender and anything pertainent to it
This commit is contained in:
commit
02db78cac7
|
@ -232,12 +232,6 @@ func (r *Revid) reset(config Config) error {
|
|||
default:
|
||||
r.destination = append(r.destination, newHttpSender(r.ns, r.config.Logger.Log))
|
||||
}
|
||||
case Udp:
|
||||
s, err := newUdpSender(r.config.RtpAddress, r.config.Logger.Log)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.destination = append(r.destination, s)
|
||||
case Rtp:
|
||||
s, err := newRtpSender(r.config.RtpAddress, r.config.Logger.Log, r.config.FrameRate)
|
||||
if err != nil {
|
||||
|
|
|
@ -388,41 +388,6 @@ func (s *rtmpSender) close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// udpSender implements loadSender for a native udp destination.
|
||||
type udpSender struct {
|
||||
conn net.Conn
|
||||
log func(lvl int8, msg string, args ...interface{})
|
||||
chunk *ring.Chunk
|
||||
}
|
||||
|
||||
func newUdpSender(addr string, log func(lvl int8, msg string, args ...interface{})) (*udpSender, error) {
|
||||
conn, err := net.Dial("udp", addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &udpSender{
|
||||
conn: conn,
|
||||
log: log,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *udpSender) load(c *ring.Chunk) error {
|
||||
s.chunk = c
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *udpSender) send() error {
|
||||
_, err := s.chunk.WriteTo(s.conn)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *udpSender) release() {
|
||||
s.chunk.Close()
|
||||
s.chunk = nil
|
||||
}
|
||||
|
||||
func (s *udpSender) close() error { return nil }
|
||||
|
||||
// TODO: Write restart func for rtpSender
|
||||
// rtpSender implements loadSender for a native udp destination with rtp packetization.
|
||||
type rtpSender struct {
|
||||
|
|
Loading…
Reference in New Issue