mirror of https://bitbucket.org/ausocean/av.git
revid: using switch in rtpSender.send logic rather than if-else
This commit is contained in:
parent
e12f3e0b41
commit
a934e02e9a
|
@ -391,11 +391,12 @@ func (s *rtpSender) load(c *ring.Chunk) error {
|
||||||
|
|
||||||
func (s *rtpSender) send(d []byte) error {
|
func (s *rtpSender) send(d []byte) error {
|
||||||
var err error
|
var err error
|
||||||
if d != nil {
|
switch {
|
||||||
|
case d != nil:
|
||||||
_, err = s.encoder.Write(d)
|
_, err = s.encoder.Write(d)
|
||||||
} else if s.chunk != nil {
|
case s.chunk != nil:
|
||||||
_, err = s.chunk.WriteTo(s.encoder)
|
_, err = s.chunk.WriteTo(s.encoder)
|
||||||
} else {
|
default:
|
||||||
err = errors.New("no data provided, but rtpSender chunk is empty")
|
err = errors.New("no data provided, but rtpSender chunk is empty")
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue