-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
43 lines (38 loc) · 873 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package camera
import "github.com/brutella/hc/rtp"
func streamVideoProfile(cfg rtp.StreamConfiguration) string {
switch cfg.Video.CodecParams.Profiles[0].Id {
case rtp.VideoCodecProfileMain:
return "main"
default:
return "high"
}
}
func streamVideoCodecLevel(cfg rtp.StreamConfiguration) string {
switch cfg.Video.CodecParams.Levels[0].Level {
case rtp.VideoCodecLevel3_1:
return "3.1"
case rtp.VideoCodecLevel3_2:
return "3.2"
default:
return "4.0"
}
}
func streamVideoMTP(se rtp.SetupEndpoints) int {
switch se.ControllerAddr.IPVersion {
case rtp.IPAddrVersionv4:
return 1378
default:
return 1228
}
}
func streamAudioSampleRate(cfg rtp.StreamConfiguration) int {
switch cfg.Audio.CodecParams.Samplerate {
case rtp.AudioCodecSampleRate16Khz:
return 16000
case rtp.AudioCodecSampleRate24Khz:
return 24000
default:
return 8000
}
}