Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make mpeg4 clock rate configurable #693

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 8 additions & 2 deletions pkg/format/mpeg4_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// Specification: https://datatracker.ietf.org/doc/html/rfc6416#section-7.1
type MPEG4Video struct {
PayloadTyp uint8
SampleRate int
ProfileLevelID int
Config []byte

Expand All @@ -27,6 +28,11 @@
f.PayloadTyp = ctx.payloadType
f.ProfileLevelID = 1 // default value imposed by specification

var err error
if f.SampleRate, err = strconv.Atoi(ctx.clock); err != nil {
return fmt.Errorf("could not parse clock rate: %v", err)

Check failure on line 33 in pkg/format/mpeg4_video.go

View workflow job for this annotation

GitHub Actions / golangci-lint

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
}

for key, val := range ctx.fmtp {
switch key {
case "profile-level-id":
Expand Down Expand Up @@ -61,7 +67,7 @@

// ClockRate implements Format.
func (f *MPEG4Video) ClockRate() int {
return 90000
return f.SampleRate
}

// PayloadType implements Format.
Expand All @@ -71,7 +77,7 @@

// RTPMap implements Format.
func (f *MPEG4Video) RTPMap() string {
return "MP4V-ES/90000"
return "MP4V-ES/" + strconv.FormatInt(int64(f.SampleRate), 10)
}

// FMTP implements Format.
Expand Down
Loading