From ae5c0046dac93c549314fc93c76f3dde2ee875c8 Mon Sep 17 00:00:00 2001 From: Pion <59523206+pionbot@users.noreply.github.com> Date: Fri, 6 Nov 2020 19:54:44 +0000 Subject: [PATCH] Update CI configs to v0.4.12 Update lint scripts and CI configs. --- .golangci.yml | 1 + pkg/media/h264reader/h264reader.go | 4 ++++ pkg/media/h264reader/nalunittype.go | 2 ++ pkg/rtcerr/errors.go | 20 ++++++++++++++++++++ rtptransceiverinit.go | 2 +- sessiondescription_test.go | 2 +- settingengine.go | 2 +- 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8e4185a5..d6162c97 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -72,6 +72,7 @@ linters: - wsl # Whitespace Linter - Forces you to use empty lines! issues: + exclude-use-default: false exclude-rules: # Allow complex tests, better to be self contained - path: _test\.go diff --git a/pkg/media/h264reader/h264reader.go b/pkg/media/h264reader/h264reader.go index 784ccb9c..39cd75fe 100644 --- a/pkg/media/h264reader/h264reader.go +++ b/pkg/media/h264reader/h264reader.go @@ -1,3 +1,4 @@ +// Package h264reader implements a H264 Annex-B Reader package h264reader import ( @@ -83,6 +84,9 @@ func (reader *H264Reader) bitStreamStartsWithH264Prefix() (prefixLength int, e e return 0, errDataIsNotH264Stream } +// NextNAL reads from stream and returns then next NAL, +// and an error if there is incomplete frame data. +// Returns all nil values when no more NALs are available. func (reader *H264Reader) NextNAL() (*NAL, error) { if !reader.nalPrefixParsed { _, err := reader.bitStreamStartsWithH264Prefix() diff --git a/pkg/media/h264reader/nalunittype.go b/pkg/media/h264reader/nalunittype.go index 7a6834d2..6c7293f3 100644 --- a/pkg/media/h264reader/nalunittype.go +++ b/pkg/media/h264reader/nalunittype.go @@ -2,8 +2,10 @@ package h264reader import "strconv" +// NalUnitType is the type of a NAL type NalUnitType uint8 +// Enums for NalUnitTypes const ( NalUnitTypeUnspecified NalUnitType = 0 // Unspecified NalUnitTypeCodedSliceNonIdr NalUnitType = 1 // Coded slice of a non-IDR picture diff --git a/pkg/rtcerr/errors.go b/pkg/rtcerr/errors.go index 0fdac115..aa94b7bf 100644 --- a/pkg/rtcerr/errors.go +++ b/pkg/rtcerr/errors.go @@ -15,6 +15,8 @@ func (e *UnknownError) Error() string { return fmt.Sprintf("UnknownError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *UnknownError) Unwrap() error { return e.Err } @@ -28,6 +30,8 @@ func (e *InvalidStateError) Error() string { return fmt.Sprintf("InvalidStateError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *InvalidStateError) Unwrap() error { return e.Err } @@ -42,6 +46,8 @@ func (e *InvalidAccessError) Error() string { return fmt.Sprintf("InvalidAccessError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *InvalidAccessError) Unwrap() error { return e.Err } @@ -55,6 +61,8 @@ func (e *NotSupportedError) Error() string { return fmt.Sprintf("NotSupportedError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *NotSupportedError) Unwrap() error { return e.Err } @@ -68,6 +76,8 @@ func (e *InvalidModificationError) Error() string { return fmt.Sprintf("InvalidModificationError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *InvalidModificationError) Unwrap() error { return e.Err } @@ -81,6 +91,8 @@ func (e *SyntaxError) Error() string { return fmt.Sprintf("SyntaxError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *SyntaxError) Unwrap() error { return e.Err } @@ -94,6 +106,8 @@ func (e *TypeError) Error() string { return fmt.Sprintf("TypeError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *TypeError) Unwrap() error { return e.Err } @@ -108,6 +122,8 @@ func (e *OperationError) Error() string { return fmt.Sprintf("OperationError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *OperationError) Unwrap() error { return e.Err } @@ -121,6 +137,8 @@ func (e *NotReadableError) Error() string { return fmt.Sprintf("NotReadableError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *NotReadableError) Unwrap() error { return e.Err } @@ -135,6 +153,8 @@ func (e *RangeError) Error() string { return fmt.Sprintf("RangeError: %v", e.Err) } +// Unwrap returns the result of calling the Unwrap method on err, if err's type contains +// an Unwrap method returning error. Otherwise, Unwrap returns nil. func (e *RangeError) Unwrap() error { return e.Err } diff --git a/rtptransceiverinit.go b/rtptransceiverinit.go index 412847ea..b5083cf7 100644 --- a/rtptransceiverinit.go +++ b/rtptransceiverinit.go @@ -7,4 +7,4 @@ type RTPTransceiverInit struct { // Streams []*Track } -type RtpTransceiverInit = RTPTransceiverInit //nolint: stylecheck +type RtpTransceiverInit = RTPTransceiverInit //nolint: stylecheck,golint diff --git a/sessiondescription_test.go b/sessiondescription_test.go index dfe3f7a7..446f69a8 100644 --- a/sessiondescription_test.go +++ b/sessiondescription_test.go @@ -75,5 +75,5 @@ func TestSessionDescription_Unmarshal(t *testing.T) { parsed, err = desc.Unmarshal() assert.NotNil(t, parsed) assert.NoError(t, err) - pc.Close() + assert.NoError(t, pc.Close()) } diff --git a/settingengine.go b/settingengine.go index 31a13f61..81230306 100644 --- a/settingengine.go +++ b/settingengine.go @@ -312,7 +312,7 @@ func (e *SettingEngine) getSDPExtensions() map[SDPSectionType][]sdp.ExtMap { return e.sdpExtensions } -// SetProxyDialer sets the proxy dialer interface based on golang.org/x/net/proxy. +// SetICEProxyDialer sets the proxy dialer interface based on golang.org/x/net/proxy. func (e *SettingEngine) SetICEProxyDialer(d proxy.Dialer) { e.iceProxyDialer = d }