diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a6bde46b..c875c137 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,6 +32,5 @@ jobs: go-version: "1.20" - run: | - go mod download go mod tidy git diff --exit-code diff --git a/README.md b/README.md index 0e732f1d..28e482b4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - # gortsplib [![Test](https://github.com/aler9/gortsplib/workflows/test/badge.svg)](https://github.com/aler9/gortsplib/actions?query=workflow:test) diff --git a/client.go b/client.go index b07cd4bf..7010126e 100644 --- a/client.go +++ b/client.go @@ -162,12 +162,12 @@ type Client struct { // This can be a security issue. // It defaults to false. AnyPortEnable bool - // the stream transport (UDP, Multicast or TCP). + // transport protocol (UDP, Multicast or TCP). // If nil, it is chosen automatically (first UDP, then, if it fails, TCP). // It defaults to nil. Transport *Transport // If the client is reading with UDP, it must receive - // at least a packet within this timeout. + // at least a packet within this timeout, otherwise it switches to TCP. // It defaults to 3 seconds. InitialUDPReadTimeout time.Duration // read buffer count. diff --git a/examples/client-publish-options/main.go b/examples/client-publish-options/main.go index 0e063b76..cb2ea0ac 100644 --- a/examples/client-publish-options/main.go +++ b/examples/client-publish-options/main.go @@ -48,7 +48,7 @@ func main() { // Client allows to set additional client options c := &gortsplib.Client{ - // the stream transport (UDP or TCP). If nil, it is chosen automatically + // transport protocol (UDP or TCP). If nil, it is chosen automatically Transport: nil, // timeout of read operations ReadTimeout: 10 * time.Second, diff --git a/examples/client-read-options/main.go b/examples/client-read-options/main.go index ea7425c7..d81144c7 100644 --- a/examples/client-read-options/main.go +++ b/examples/client-read-options/main.go @@ -19,7 +19,7 @@ import ( func main() { // Client allows to set additional client options c := &gortsplib.Client{ - // the stream transport (UDP, Multicast or TCP). If nil, it is chosen automatically + // transport protocol (UDP, Multicast or TCP). If nil, it is chosen automatically Transport: nil, // timeout of read operations ReadTimeout: 10 * time.Second, diff --git a/pkg/format/format.go b/pkg/format/format.go index c88a3cf6..c07877fb 100644 --- a/pkg/format/format.go +++ b/pkg/format/format.go @@ -32,7 +32,8 @@ func getCodecAndClock(rtpMap string) (string, string) { return parts2[0], parts2[1] } -// Format is a RTSP format. +// Format is a format of a media. +// It defines a codec and a payload type used to ship the media. type Format interface { // String returns a description of the format. String() string @@ -48,7 +49,7 @@ type Format interface { // Marshal encodes the format in SDP format. Marshal() (string, string) - // PTSEqualsDTS checks whether PTS is equal to DTS in the RTP packet. + // PTSEqualsDTS checks whether PTS is equal to DTS in RTP packets. PTSEqualsDTS(*rtp.Packet) bool } diff --git a/pkg/format/g711.go b/pkg/format/g711.go index 9cc090ec..f93167a7 100644 --- a/pkg/format/g711.go +++ b/pkg/format/g711.go @@ -6,7 +6,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtpsimpleaudio" ) -// G711 is a G711 format, encoded with mu-law or A-law. +// G711 is a format that uses the G711 codec, encoded with mu-law or A-law. type G711 struct { // whether to use mu-law. Otherwise, A-law is used. MULaw bool diff --git a/pkg/format/g722.go b/pkg/format/g722.go index 474acb6a..bea86999 100644 --- a/pkg/format/g722.go +++ b/pkg/format/g722.go @@ -6,7 +6,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtpsimpleaudio" ) -// G722 is a G722 format. +// G722 is a format that uses the G722 codec. type G722 struct{} // String implements Format. diff --git a/pkg/format/generic.go b/pkg/format/generic.go index 8fd679fa..ca4fea34 100644 --- a/pkg/format/generic.go +++ b/pkg/format/generic.go @@ -61,7 +61,7 @@ type Generic struct { ClockRat int } -// Init initializes a Generic. +// Init computes the clock rate of the format. It it mandatory to call it. func (t *Generic) Init() error { t.ClockRat, _ = findClockRate(t.PayloadTyp, t.RTPMap) return nil diff --git a/pkg/format/h264.go b/pkg/format/h264.go index 17027aef..bf8453eb 100644 --- a/pkg/format/h264.go +++ b/pkg/format/h264.go @@ -70,7 +70,7 @@ func rtpH264ContainsIDR(pkt *rtp.Packet) bool { } } -// H264 is a H264 format. +// H264 is a format that uses the H264 codec. type H264 struct { PayloadTyp uint8 SPS []byte diff --git a/pkg/format/h265.go b/pkg/format/h265.go index 19e6840d..6e5c5f72 100644 --- a/pkg/format/h265.go +++ b/pkg/format/h265.go @@ -12,7 +12,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtph265" ) -// H265 is a H265 format. +// H265 is a format that uses the H265 codec. type H265 struct { PayloadTyp uint8 VPS []byte diff --git a/pkg/format/lpcm.go b/pkg/format/lpcm.go index 939de55c..b58822dc 100644 --- a/pkg/format/lpcm.go +++ b/pkg/format/lpcm.go @@ -9,7 +9,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtplpcm" ) -// LPCM is an uncompressed, Linear PCM format. +// LPCM is a format that uses the uncompressed, Linear PCM codec. type LPCM struct { PayloadTyp uint8 BitDepth int diff --git a/pkg/format/mjpeg.go b/pkg/format/mjpeg.go index c019b8f5..4c2481f5 100644 --- a/pkg/format/mjpeg.go +++ b/pkg/format/mjpeg.go @@ -6,7 +6,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtpmjpeg" ) -// MJPEG is a Motion-JPEG format. +// MJPEG is a format that uses the Motion-JPEG codec. type MJPEG struct{} // String implements Format. diff --git a/pkg/format/mpeg2_audio.go b/pkg/format/mpeg2_audio.go index 3c9a6206..f1460877 100644 --- a/pkg/format/mpeg2_audio.go +++ b/pkg/format/mpeg2_audio.go @@ -4,7 +4,7 @@ import ( "github.com/pion/rtp" ) -// MPEG2Audio is a MPEG-1 or MPEG-2 audio format. +// MPEG2Audio is a format that uses a MPEG-1 or MPEG-2 audio codec. type MPEG2Audio struct{} // String implements Format. diff --git a/pkg/format/mpeg2_video.go b/pkg/format/mpeg2_video.go index e5db07d1..89b74df9 100644 --- a/pkg/format/mpeg2_video.go +++ b/pkg/format/mpeg2_video.go @@ -4,7 +4,7 @@ import ( "github.com/pion/rtp" ) -// MPEG2Video is a MPEG-1 or MPEG-2 video format. +// MPEG2Video is a format that uses a MPEG-1 or MPEG-2 video codec. type MPEG2Video struct{} // String implements Format. diff --git a/pkg/format/mpeg4_audio.go b/pkg/format/mpeg4_audio.go index a9cab25f..e878097b 100644 --- a/pkg/format/mpeg4_audio.go +++ b/pkg/format/mpeg4_audio.go @@ -12,7 +12,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtpmpeg4audio" ) -// MPEG4Audio is a MPEG-4 audio format. +// MPEG4Audio is a format that uses a MPEG-4 audio codec. type MPEG4Audio struct { PayloadTyp uint8 Config *mpeg4audio.Config diff --git a/pkg/format/opus.go b/pkg/format/opus.go index 11462ddd..1e65573e 100644 --- a/pkg/format/opus.go +++ b/pkg/format/opus.go @@ -10,7 +10,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtpsimpleaudio" ) -// Opus is a Opus format. +// Opus is a format that uses the Opus codec. type Opus struct { PayloadTyp uint8 SampleRate int diff --git a/pkg/format/vorbis.go b/pkg/format/vorbis.go index 3f02a306..987382de 100644 --- a/pkg/format/vorbis.go +++ b/pkg/format/vorbis.go @@ -9,7 +9,7 @@ import ( "github.com/pion/rtp" ) -// Vorbis is a Vorbis format. +// Vorbis is a format that uses the Vorbis codec. type Vorbis struct { PayloadTyp uint8 SampleRate int diff --git a/pkg/format/vp8.go b/pkg/format/vp8.go index a0a2f73f..20df8bc7 100644 --- a/pkg/format/vp8.go +++ b/pkg/format/vp8.go @@ -10,7 +10,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtpvp8" ) -// VP8 is a VP8 format. +// VP8 is a format that uses the VP8 codec. type VP8 struct { PayloadTyp uint8 MaxFR *int diff --git a/pkg/format/vp9.go b/pkg/format/vp9.go index 8acbc76e..ca5c141a 100644 --- a/pkg/format/vp9.go +++ b/pkg/format/vp9.go @@ -10,7 +10,7 @@ import ( "github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtpvp9" ) -// VP9 is a VP9 format. +// VP9 is a format that uses the VP9 codec. type VP9 struct { PayloadTyp uint8 MaxFR *int diff --git a/pkg/media/media.go b/pkg/media/media.go index 3164f0b6..774a2061 100644 --- a/pkg/media/media.go +++ b/pkg/media/media.go @@ -58,7 +58,8 @@ const ( TypeApplication Type = "application" ) -// Media is a media stream. It contains one or more format. +// Media is a media stream. +// It contains one or more formats. type Media struct { // Media type. Type Type