From 529ca0d54708deb7ef6294088350f0be49dfce9c Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 23 Oct 2019 14:38:18 +1030 Subject: [PATCH] codec/h264/extract.go: simplified switch --- codec/h264/extract.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/codec/h264/extract.go b/codec/h264/extract.go index e934de94..7964600a 100644 --- a/codec/h264/extract.go +++ b/codec/h264/extract.go @@ -95,9 +95,9 @@ func (e *Extracter) Extract(dst io.Writer, src io.Reader, delay time.Duration) e buf := make([]byte, maxRTPSize) for { n, err := src.Read(buf) - switch { - case err == nil: // Do nothing. - case err == io.EOF: + switch err { + case nil: // Do nothing. + case io.EOF: return nil default: return fmt.Errorf("source read error: %v\n", err) @@ -143,7 +143,6 @@ func (e *Extracter) Extract(dst io.Writer, src io.Reader, delay time.Duration) e } } } - return nil } // handleSTAPA parses NAL units from an aggregation packet and writes