streaming

Media streaming and broadcast systems in Go
Log | Files | Refs | README | LICENSE

commit 8d2c4bc42dfbbe01d8d7cfd968ca60c8048ae6f9
parent 2e4d2483483becc6c7c2bb0350b3693ad7382931
Author: Oliver Lowe <o@olowe.co>
Date:   Sat, 10 Aug 2024 17:28:12 +1000

rtp: correct string values for PCM audio payload types

Diffstat:
Mcmd/autx/autx.go | 2+-
Mrtp/rtp.go | 13++++++++-----
Msdp/example_test.go | 6+++---
3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/cmd/autx/autx.go b/cmd/autx/autx.go @@ -53,7 +53,7 @@ func main() { if err != nil { log.Fatal(err) } - session.Clock = 44100 // 44.1KHz, not the audio sample rate. + session.Clock = rtp.ClockPCMAudio // not the audio sample rate. origin := sdp.Origin{ ID: sdp.Now(), diff --git a/rtp/rtp.go b/rtp/rtp.go @@ -80,9 +80,9 @@ const ( type PayloadType uint8 const ( - PayloadL16Stereo PayloadType = 10 - PayloadL16Mono PayloadType = 11 - PayloadMP2T PayloadType = 33 + PayloadL16Stereo PayloadType = 10 + PayloadL16Mono PayloadType = 11 + PayloadMP2T PayloadType = 33 // ... ) @@ -103,13 +103,16 @@ func (t PayloadType) String() string { switch t { case PayloadMP2T: return "MP2T" + case PayloadL16Stereo, PayloadL16Mono: + return fmt.Sprintf("%d", t) } return "unknown" } const ( - ClockMP2T = 90000 // 90KHz - ClockText = 1000 // 1KHz + ClockMP2T = 90000 // 90KHz + ClockPCMAudio = 44100 // 44.1KHz + ClockText = 1000 // 1KHz ) type Extension struct { diff --git a/sdp/example_test.go b/sdp/example_test.go @@ -27,10 +27,10 @@ func Example() { Type: sdp.MediaTypeAudio, Port: 6969, Transport: sdp.ProtoRTP, - Format: []string{fmt.Sprintf("%d", rtp.PayloadL16Mono)}, + Format: []string{rtp.PayloadL16Mono.String()}, Attributes: []string{ - fmt.Sprintf("rtpmap:%d", rtp.PayloadL16Mono), - fmt.Sprintf("L16/%d", 22050), + "rtpmap:" + rtp.PayloadL16Mono.String(), + "L16/22050", }, }, },