Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

prevent wrong results in format comparisons or when formats are used as keys #673

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/format/g722.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import (

// G722 is the RTP format for the G722 codec.
// Specification: https://datatracker.ietf.org/doc/html/rfc3551
type G722 struct{}
type G722 struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

func (f *G722) unmarshal(_ *unmarshalContext) error {
return nil
Expand Down
7 changes: 6 additions & 1 deletion pkg/format/mjpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import (

// MJPEG is the RTP format for the Motion-JPEG codec.
// Specification: https://datatracker.ietf.org/doc/html/rfc2435
type MJPEG struct{}
type MJPEG struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

func (f *MJPEG) unmarshal(_ *unmarshalContext) error {
return nil
Expand Down
7 changes: 6 additions & 1 deletion pkg/format/mpeg1_audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import (

// MPEG1Audio is the RTP format for a MPEG-1/2 Audio codec.
// Specification: https://datatracker.ietf.org/doc/html/rfc2250
type MPEG1Audio struct{}
type MPEG1Audio struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

func (f *MPEG1Audio) unmarshal(_ *unmarshalContext) error {
return nil
Expand Down
7 changes: 6 additions & 1 deletion pkg/format/mpeg1_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import (

// MPEG1Video is the RTP format for a MPEG-1/2 Video codec.
// Specification: https://datatracker.ietf.org/doc/html/rfc2250
type MPEG1Video struct{}
type MPEG1Video struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

func (f *MPEG1Video) unmarshal(_ *unmarshalContext) error {
return nil
Expand Down
7 changes: 6 additions & 1 deletion pkg/format/mpegts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import (

// MPEGTS is the RTP format for MPEG-TS.
// Specification: https://datatracker.ietf.org/doc/html/rfc2250
type MPEGTS struct{}
type MPEGTS struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

func (f *MPEGTS) unmarshal(_ *unmarshalContext) error {
return nil
Expand Down