Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean-Der committed Feb 1, 2024
1 parent 3a28b34 commit 25623bf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/whip/relay_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (h *WHIPRelayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}()

path := strings.TrimLeft(r.URL.Path, "/whip/")
path := strings.TrimLeft(r.URL.Path, "/whip/") //nolint
v := strings.Split(path, "/")
if len(v) != 2 {
err = psrpc.NewErrorf(psrpc.NotFound, "invalid path")
Expand Down
8 changes: 4 additions & 4 deletions pkg/whip/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (s *WHIPServer) handleError(err error, w http.ResponseWriter) {
switch {
case errors.As(err, &psrpcErr):
w.WriteHeader(psrpcErr.ToHttp())
w.Write([]byte(psrpcErr.Error()))
_, _ = w.Write([]byte(psrpcErr.Error()))
case err == nil:
// Nothing, we already responded
default:
Expand All @@ -235,9 +235,9 @@ func (s *WHIPServer) handleNewWhipClient(w http.ResponseWriter, r *http.Request,
return err
}

logger.Debugw("new whip request", "streamKey", streamKey, "sdpOffer", string(sdpOffer.Bytes()))
logger.Debugw("new whip request", "streamKey", streamKey, "sdpOffer", sdpOffer.String())

resourceId, sdp, err := s.createStream(streamKey, string(sdpOffer.Bytes()))
resourceId, sdp, err := s.createStream(streamKey, sdpOffer.String())
if err != nil {
return err
}
Expand All @@ -246,7 +246,7 @@ func (s *WHIPServer) handleNewWhipClient(w http.ResponseWriter, r *http.Request,
w.Header().Set("Content-Type", "application/sdp")
w.Header().Set("Location", fmt.Sprintf("/%s/%s/%s", app, streamKey, resourceId))
w.WriteHeader(http.StatusCreated)
w.Write([]byte(sdp))
_, _ = w.Write([]byte(sdp))

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/whip/whip_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func newMediaEngine() (*webrtc.MediaEngine, error) {
}
}

videoRTCPFeedback := []webrtc.RTCPFeedback{{"goog-remb", ""}, {"ccm", "fir"}, {"nack", ""}, {"nack", "pli"}}
videoRTCPFeedback := []webrtc.RTCPFeedback{{Type: "goog-remb", Parameter: ""}, {Type: "ccm", Parameter: "fir"}, {Type: "nack", Parameter: ""}, {Type: "nack", Parameter: "pli"}}

for _, codec := range []webrtc.RTPCodecParameters{
{
Expand Down
5 changes: 1 addition & 4 deletions pkg/whip/whip_track_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,12 @@ func (t *whipTrackHandler) startRTPReceiver(onDone func(err error)) {
select {
case <-t.fuse.Watch():
t.logger.Debugw("stopping rtp receiver")
err = nil
return
default:
err = t.processRTPPacket()
switch err {
case nil:
case io.EOF:
err = nil
return
default:
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
Expand Down Expand Up @@ -256,7 +254,7 @@ func (t *whipTrackHandler) mediaWriterWorker(onDone func(err error)) {
case nil, errors.ErrPrerollBufferReset:
// continue
case io.EOF:
err = nil
err = nil //nolint
return
default:
t.logger.Warnw("error writing media", err)
Expand Down Expand Up @@ -287,7 +285,6 @@ func (t *whipTrackHandler) startRTCPReceiver() {
case err == nil:
// continue
case err == io.EOF:
err = nil
return
default:
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
Expand Down

0 comments on commit 25623bf

Please sign in to comment.