revid: using switch in rtpSender.send logic rather than if-else

This commit is contained in:
saxon 2019-01-03 12:06:51 +10:30
parent e12f3e0b41
commit a934e02e9a
1 changed files with 4 additions and 3 deletions

View File

@ -391,11 +391,12 @@ func (s *rtpSender) load(c *ring.Chunk) error {
func (s *rtpSender) send(d []byte) error {
var err error
if d != nil {
switch {
case d != nil:
_, err = s.encoder.Write(d)
} else if s.chunk != nil {
case s.chunk != nil:
_, err = s.chunk.WriteTo(s.encoder)
} else {
default:
err = errors.New("no data provided, but rtpSender chunk is empty")
}
return err