mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 07:37:07 +08:00
server: implement sessions
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/aler9/gortsplib/pkg/base"
|
||||
)
|
||||
|
||||
// ErrClientWrongState is returned in case of a wrong client state.
|
||||
// ErrClientWrongState is an error that can be returned by a client.
|
||||
type ErrClientWrongState struct {
|
||||
AllowedList []fmt.Stringer
|
||||
State fmt.Stringer
|
||||
@@ -18,7 +18,7 @@ func (e ErrClientWrongState) Error() string {
|
||||
e.AllowedList, e.State)
|
||||
}
|
||||
|
||||
// ErrClientSessionHeaderInvalid is returned in case of an invalid session header.
|
||||
// ErrClientSessionHeaderInvalid is an error that can be returned by a client.
|
||||
type ErrClientSessionHeaderInvalid struct {
|
||||
Err error
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func (e ErrClientSessionHeaderInvalid) Error() string {
|
||||
return fmt.Sprintf("invalid session header: %v", e.Err)
|
||||
}
|
||||
|
||||
// ErrClientWrongStatusCode is returned in case of a wrong status code.
|
||||
// ErrClientWrongStatusCode is an error that can be returned by a client.
|
||||
type ErrClientWrongStatusCode struct {
|
||||
Code base.StatusCode
|
||||
Message string
|
||||
@@ -39,7 +39,7 @@ func (e ErrClientWrongStatusCode) Error() string {
|
||||
return fmt.Sprintf("wrong status code: %d (%s)", e.Code, e.Message)
|
||||
}
|
||||
|
||||
// ErrClientContentTypeMissing is returned in case the Content-Type header is missing.
|
||||
// ErrClientContentTypeMissing is an error that can be returned by a client.
|
||||
type ErrClientContentTypeMissing struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -47,7 +47,7 @@ func (e ErrClientContentTypeMissing) Error() string {
|
||||
return "Content-Type header is missing"
|
||||
}
|
||||
|
||||
// ErrClientContentTypeUnsupported is returned in case the Content-Type header is unsupported.
|
||||
// ErrClientContentTypeUnsupported is an error that can be returned by a client.
|
||||
type ErrClientContentTypeUnsupported struct {
|
||||
CT base.HeaderValue
|
||||
}
|
||||
@@ -57,7 +57,7 @@ func (e ErrClientContentTypeUnsupported) Error() string {
|
||||
return fmt.Sprintf("unsupported Content-Type header '%v'", e.CT)
|
||||
}
|
||||
|
||||
// ErrClientCannotReadPublishAtSameTime is returned when the client is trying to read and publish at the same time.
|
||||
// ErrClientCannotReadPublishAtSameTime is an error that can be returned by a client.
|
||||
type ErrClientCannotReadPublishAtSameTime struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -65,7 +65,7 @@ func (e ErrClientCannotReadPublishAtSameTime) Error() string {
|
||||
return "cannot read and publish at the same time"
|
||||
}
|
||||
|
||||
// ErrClientCannotSetupTracksDifferentURLs is returned when the client is trying to setup tracks with different base URLs.
|
||||
// ErrClientCannotSetupTracksDifferentURLs is an error that can be returned by a client.
|
||||
type ErrClientCannotSetupTracksDifferentURLs struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -73,7 +73,7 @@ func (e ErrClientCannotSetupTracksDifferentURLs) Error() string {
|
||||
return "cannot setup tracks with different base URLs"
|
||||
}
|
||||
|
||||
// ErrClientUDPPortsZero is returned when one of the UDP ports is zero.
|
||||
// ErrClientUDPPortsZero is an error that can be returned by a client.
|
||||
type ErrClientUDPPortsZero struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -81,7 +81,7 @@ func (e ErrClientUDPPortsZero) Error() string {
|
||||
return "rtpPort and rtcpPort must be both zero or non-zero"
|
||||
}
|
||||
|
||||
// ErrClientUDPPortsNotConsecutive is returned when the two UDP ports are not consecutive.
|
||||
// ErrClientUDPPortsNotConsecutive is an error that can be returned by a client.
|
||||
type ErrClientUDPPortsNotConsecutive struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -89,7 +89,7 @@ func (e ErrClientUDPPortsNotConsecutive) Error() string {
|
||||
return "rtcpPort must be rtpPort + 1"
|
||||
}
|
||||
|
||||
// ErrClientServerPortsZero is returned when one of the server ports is zero.
|
||||
// ErrClientServerPortsZero is an error that can be returned by a client.
|
||||
type ErrClientServerPortsZero struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -97,7 +97,7 @@ func (e ErrClientServerPortsZero) Error() string {
|
||||
return "server ports must be both zero or both not zero"
|
||||
}
|
||||
|
||||
// ErrClientServerPortsNotProvided is returned in case the server ports have not been provided.
|
||||
// ErrClientServerPortsNotProvided is an error that can be returned by a client.
|
||||
type ErrClientServerPortsNotProvided struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -105,7 +105,7 @@ func (e ErrClientServerPortsNotProvided) Error() string {
|
||||
return "server ports have not been provided. Use AnyPortEnable to communicate with this server"
|
||||
}
|
||||
|
||||
// ErrClientTransportHeaderInvalid is returned in case the transport header is invalid.
|
||||
// ErrClientTransportHeaderInvalid is an error that can be returned by a client.
|
||||
type ErrClientTransportHeaderInvalid struct {
|
||||
Err error
|
||||
}
|
||||
@@ -115,7 +115,7 @@ func (e ErrClientTransportHeaderInvalid) Error() string {
|
||||
return fmt.Sprintf("invalid transport header: %v", e.Err)
|
||||
}
|
||||
|
||||
// ErrClientTransportHeaderNoInterleavedIDs is returned in case the transport header doesn't contain interleaved IDs.
|
||||
// ErrClientTransportHeaderNoInterleavedIDs is an error that can be returned by a client.
|
||||
type ErrClientTransportHeaderNoInterleavedIDs struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -123,7 +123,7 @@ func (e ErrClientTransportHeaderNoInterleavedIDs) Error() string {
|
||||
return "transport header does not contain interleaved IDs"
|
||||
}
|
||||
|
||||
// ErrClientTransportHeaderWrongInterleavedIDs is returned in case the transport header contains wrong interleaved IDs.
|
||||
// ErrClientTransportHeaderWrongInterleavedIDs is an error that can be returned by a client.
|
||||
type ErrClientTransportHeaderWrongInterleavedIDs struct {
|
||||
Expected [2]int
|
||||
Value [2]int
|
||||
@@ -134,7 +134,7 @@ func (e ErrClientTransportHeaderWrongInterleavedIDs) Error() string {
|
||||
return fmt.Sprintf("wrong interleaved IDs, expected %v, got %v", e.Expected, e.Value)
|
||||
}
|
||||
|
||||
// ErrClientNoUDPPacketsRecently is returned when no UDP packets have been received recently.
|
||||
// ErrClientNoUDPPacketsRecently is an error that can be returned by a client.
|
||||
type ErrClientNoUDPPacketsRecently struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -142,8 +142,7 @@ func (e ErrClientNoUDPPacketsRecently) Error() string {
|
||||
return "no UDP packets received (maybe there's a firewall/NAT in between)"
|
||||
}
|
||||
|
||||
// ErrClientUDPTimeout is returned when timeout has exceeded but UDP packets have been received previously
|
||||
// but now nothing is being received.
|
||||
// ErrClientUDPTimeout is an error that can be returned by a client.
|
||||
type ErrClientUDPTimeout struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -151,7 +150,7 @@ func (e ErrClientUDPTimeout) Error() string {
|
||||
return "UDP timeout"
|
||||
}
|
||||
|
||||
// ErrClientTCPTimeout is returned when timeout has exceeded.
|
||||
// ErrClientTCPTimeout is an error that can be returned by a client.
|
||||
type ErrClientTCPTimeout struct{}
|
||||
|
||||
// Error implements the error interface.
|
||||
@@ -159,7 +158,7 @@ func (e ErrClientTCPTimeout) Error() string {
|
||||
return "TCP timeout"
|
||||
}
|
||||
|
||||
// ErrClientRTPInfoInvalid is returned in case of an invalid RTP-Info.
|
||||
// ErrClientRTPInfoInvalid is an error that can be returned by a client.
|
||||
type ErrClientRTPInfoInvalid struct {
|
||||
Err error
|
||||
}
|
||||
|
Reference in New Issue
Block a user