add StreamProtocol; fix docs

This commit is contained in:
aler9
2020-07-19 17:42:53 +02:00
parent 6806ec79c0
commit 511d109e8d
4 changed files with 49 additions and 23 deletions

View File

@@ -11,6 +11,51 @@ const (
rtspMaxContentLength = 4096
)
// StreamProtocol is the protocol of a stream
type StreamProtocol int
const (
// invalid protocol
StreamProtocolInvalid StreamProtocol = iota
// UDP protocol
StreamProtocolUdp
// TCP protocol
StreamProtocolTcp
)
// String implements fmt.Stringer
func (sp StreamProtocol) String() string {
if sp == StreamProtocolUdp {
return "udp"
}
return "tcp"
}
// StreamType is the type of a stream.
type StreamType int
const (
// stream that contains RTP packets
StreamTypeRtp StreamType = iota + 1
// stream that contains RTCP packets
StreamTypeRtcp
)
// String implements fmt.Stringer
func (st StreamType) String() string {
switch st {
case StreamTypeRtp:
return "RTP"
case StreamTypeRtcp:
return "RTCP"
}
return "UNKNOWN"
}
func readBytesLimited(rb *bufio.Reader, delim byte, n int) ([]byte, error) {
for i := 1; i <= n; i++ {
byts, err := rb.Peek(i)