support detecting LPCM formats with payload types 10 and 11 (#496)

This commit is contained in:
Alessandro Ros
2024-01-07 13:01:36 +01:00
committed by GitHub
parent 7d30b5f1b7
commit f9eb8e573b
22 changed files with 131 additions and 68 deletions

View File

@@ -9,8 +9,9 @@ import (
"github.com/bluenviron/gortsplib/v4/pkg/format/rtplpcm"
)
// LPCM is a RTP format for the uncompressed, Linear PCM codec.
// LPCM is the RTP format for the LPCM codec.
// Specification: https://datatracker.ietf.org/doc/html/rfc3190
// Specification: https://datatracker.ietf.org/doc/html/rfc3551
type LPCM struct {
PayloadTyp uint8
BitDepth int
@@ -21,6 +22,20 @@ type LPCM struct {
func (f *LPCM) unmarshal(ctx *unmarshalContext) error {
f.PayloadTyp = ctx.payloadType
if ctx.payloadType == 10 {
f.BitDepth = 16
f.SampleRate = 44100
f.ChannelCount = 2
return nil
}
if ctx.payloadType == 11 {
f.BitDepth = 16
f.SampleRate = 44100
f.ChannelCount = 1
return nil
}
switch ctx.codec {
case "l8":
f.BitDepth = 8