From a934e02e9a8be5abcab99f37f4c6eed3c6a8c998 Mon Sep 17 00:00:00 2001 From: saxon Date: Thu, 3 Jan 2019 12:06:51 +1030 Subject: [PATCH] revid: using switch in rtpSender.send logic rather than if-else --- revid/senders.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index 0cb61ee8..4a8e2db8 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -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