mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 23:02:45 +08:00
remove base.MustParseURL
This commit is contained in:
@@ -39,7 +39,7 @@ func TestClientPublishSerial(t *testing.T) {
|
||||
req, err := readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Options, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -56,7 +56,7 @@ func TestClientPublishSerial(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Announce, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -66,7 +66,7 @@ func TestClientPublishSerial(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Setup, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
|
||||
var inTH headers.Transport
|
||||
err = inTH.Read(req.Header["Transport"])
|
||||
@@ -112,7 +112,7 @@ func TestClientPublishSerial(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Record, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -154,7 +154,7 @@ func TestClientPublishSerial(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Teardown, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -663,7 +663,7 @@ func TestClientPublishAutomaticProtocol(t *testing.T) {
|
||||
req, err := readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Options, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -680,7 +680,7 @@ func TestClientPublishAutomaticProtocol(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Announce, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -725,7 +725,7 @@ func TestClientPublishAutomaticProtocol(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Record, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
|
@@ -63,7 +63,7 @@ func TestClientReadTracks(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Describe, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -79,7 +79,7 @@ func TestClientReadTracks(t *testing.T) {
|
||||
req, err := readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Setup, req.Method)
|
||||
require.Equal(t, base.MustParseURL(fmt.Sprintf("rtsp://localhost:8554/teststream/trackID=%d", i)), req.URL)
|
||||
require.Equal(t, mustParseURL(fmt.Sprintf("rtsp://localhost:8554/teststream/trackID=%d", i)), req.URL)
|
||||
|
||||
var inTH headers.Transport
|
||||
err = inTH.Read(req.Header["Transport"])
|
||||
@@ -107,7 +107,7 @@ func TestClientReadTracks(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Play, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream/"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream/"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -117,7 +117,7 @@ func TestClientReadTracks(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Teardown, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream/"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream/"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -147,17 +147,17 @@ func TestClientReadTracks(t *testing.T) {
|
||||
require.Equal(t, Tracks{
|
||||
{
|
||||
ID: 0,
|
||||
BaseURL: base.MustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
BaseURL: mustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
Media: track1.Media,
|
||||
},
|
||||
{
|
||||
ID: 1,
|
||||
BaseURL: base.MustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
BaseURL: mustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
Media: track2.Media,
|
||||
},
|
||||
{
|
||||
ID: 2,
|
||||
BaseURL: base.MustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
BaseURL: mustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
Media: track3.Media,
|
||||
},
|
||||
}, conn.Tracks())
|
||||
@@ -208,7 +208,7 @@ func TestClientRead(t *testing.T) {
|
||||
req, err := readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Options, req.Method)
|
||||
require.Equal(t, base.MustParseURL(scheme+"://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL(scheme+"://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -225,7 +225,7 @@ func TestClientRead(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Describe, req.Method)
|
||||
require.Equal(t, base.MustParseURL(scheme+"://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL(scheme+"://localhost:8554/teststream"), req.URL)
|
||||
|
||||
track, err := NewTrackH264(96, []byte("123456"), []byte("123456"))
|
||||
require.NoError(t, err)
|
||||
@@ -243,7 +243,7 @@ func TestClientRead(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Setup, req.Method)
|
||||
require.Equal(t, base.MustParseURL(scheme+"://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
require.Equal(t, mustParseURL(scheme+"://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
|
||||
var inTH headers.Transport
|
||||
err = inTH.Read(req.Header["Transport"])
|
||||
@@ -288,7 +288,7 @@ func TestClientRead(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Play, req.Method)
|
||||
require.Equal(t, base.MustParseURL(scheme+"://localhost:8554/teststream/"), req.URL)
|
||||
require.Equal(t, mustParseURL(scheme+"://localhost:8554/teststream/"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -337,7 +337,7 @@ func TestClientRead(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Teardown, req.Method)
|
||||
require.Equal(t, base.MustParseURL(scheme+"://localhost:8554/teststream/"), req.URL)
|
||||
require.Equal(t, mustParseURL(scheme+"://localhost:8554/teststream/"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -416,7 +416,7 @@ func TestClientReadNoContentBase(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Describe, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
track, err := NewTrackH264(96, []byte("123456"), []byte("123456"))
|
||||
require.NoError(t, err)
|
||||
@@ -433,7 +433,7 @@ func TestClientReadNoContentBase(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Setup, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
|
||||
var inTH headers.Transport
|
||||
err = inTH.Read(req.Header["Transport"])
|
||||
@@ -460,7 +460,7 @@ func TestClientReadNoContentBase(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Play, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -470,7 +470,7 @@ func TestClientReadNoContentBase(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Teardown, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream"), req.URL)
|
||||
|
||||
err = base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
@@ -775,7 +775,7 @@ func TestClientReadAutomaticProtocol(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Setup, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
|
||||
var inTH headers.Transport
|
||||
err = inTH.Read(req.Header["Transport"])
|
||||
@@ -826,7 +826,7 @@ func TestClientReadAutomaticProtocol(t *testing.T) {
|
||||
req, err = readRequest(bconn.Reader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, base.Setup, req.Method)
|
||||
require.Equal(t, base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
require.Equal(t, mustParseURL("rtsp://localhost:8554/teststream/trackID=0"), req.URL)
|
||||
|
||||
inTH = headers.Transport{}
|
||||
err = inTH.Read(req.Header["Transport"])
|
||||
|
@@ -12,6 +12,14 @@ import (
|
||||
"github.com/aler9/gortsplib/pkg/base"
|
||||
)
|
||||
|
||||
func mustParseURL(s string) *base.URL {
|
||||
u, err := base.ParseURL(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func readRequest(br *bufio.Reader) (*base.Request, error) {
|
||||
var req base.Request
|
||||
err := req.Read(br)
|
||||
|
@@ -9,6 +9,14 @@ import (
|
||||
"github.com/aler9/gortsplib/pkg/headers"
|
||||
)
|
||||
|
||||
func mustParseURL(s string) *base.URL {
|
||||
u, err := base.ParseURL(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func TestAuth(t *testing.T) {
|
||||
for _, c1 := range []struct {
|
||||
name string
|
||||
@@ -56,7 +64,7 @@ func TestAuth(t *testing.T) {
|
||||
}())
|
||||
require.NoError(t, err)
|
||||
authorization := se.GenerateHeader(base.Announce,
|
||||
base.MustParseURL(func() string {
|
||||
mustParseURL(func() string {
|
||||
if conf == "wrongurl" {
|
||||
return "rtsp://myhost/my1path"
|
||||
}
|
||||
@@ -64,7 +72,7 @@ func TestAuth(t *testing.T) {
|
||||
}()))
|
||||
|
||||
err = va.ValidateHeader(authorization, base.Announce,
|
||||
base.MustParseURL("rtsp://myhost/mypath"), nil)
|
||||
mustParseURL("rtsp://myhost/mypath"), nil)
|
||||
|
||||
if conf != "nofail" {
|
||||
require.Error(t, err)
|
||||
@@ -96,10 +104,10 @@ func TestAuthVLC(t *testing.T) {
|
||||
se, err := NewSender(va.GenerateHeader(), "testuser", "testpass")
|
||||
require.NoError(t, err)
|
||||
authorization := se.GenerateHeader(base.Announce,
|
||||
base.MustParseURL(ca.clientURL))
|
||||
mustParseURL(ca.clientURL))
|
||||
|
||||
err = va.ValidateHeader(authorization, base.Announce,
|
||||
base.MustParseURL(ca.serverURL), base.MustParseURL(ca.clientURL))
|
||||
mustParseURL(ca.serverURL), mustParseURL(ca.clientURL))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
}
|
||||
@@ -130,10 +138,10 @@ func TestAuthHashed(t *testing.T) {
|
||||
}())
|
||||
require.NoError(t, err)
|
||||
authorization := va.GenerateHeader(base.Announce,
|
||||
base.MustParseURL("rtsp://myhost/mypath"))
|
||||
mustParseURL("rtsp://myhost/mypath"))
|
||||
|
||||
err = se.ValidateHeader(authorization, base.Announce,
|
||||
base.MustParseURL("rtsp://myhost/mypath"), nil)
|
||||
mustParseURL("rtsp://myhost/mypath"), nil)
|
||||
|
||||
if conf != "nofail" {
|
||||
require.Error(t, err)
|
||||
|
@@ -22,7 +22,7 @@ var casesRequest = []struct {
|
||||
"\r\n"),
|
||||
Request{
|
||||
Method: "OPTIONS",
|
||||
URL: MustParseURL("rtsp://example.com/media.mp4"),
|
||||
URL: mustParseURL("rtsp://example.com/media.mp4"),
|
||||
Header: Header{
|
||||
"CSeq": HeaderValue{"1"},
|
||||
"Require": HeaderValue{"implicit-play"},
|
||||
@@ -38,7 +38,7 @@ var casesRequest = []struct {
|
||||
"\r\n"),
|
||||
Request{
|
||||
Method: "DESCRIBE",
|
||||
URL: MustParseURL("rtsp://example.com/media.mp4"),
|
||||
URL: mustParseURL("rtsp://example.com/media.mp4"),
|
||||
Header: Header{
|
||||
"Accept": HeaderValue{"application/sdp"},
|
||||
"CSeq": HeaderValue{"2"},
|
||||
@@ -53,7 +53,7 @@ var casesRequest = []struct {
|
||||
"\r\n"),
|
||||
Request{
|
||||
Method: "DESCRIBE",
|
||||
URL: MustParseURL("rtsp://192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
URL: mustParseURL("rtsp://192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
Header: Header{
|
||||
"Accept": HeaderValue{"application/sdp"},
|
||||
"CSeq": HeaderValue{"3"},
|
||||
@@ -82,7 +82,7 @@ var casesRequest = []struct {
|
||||
"m=video 2232 RTP/AVP 31\n"),
|
||||
Request{
|
||||
Method: "ANNOUNCE",
|
||||
URL: MustParseURL("rtsp://example.com/media.mp4"),
|
||||
URL: mustParseURL("rtsp://example.com/media.mp4"),
|
||||
Header: Header{
|
||||
"CSeq": HeaderValue{"7"},
|
||||
"Date": HeaderValue{"23 Jan 1997 15:35:06 GMT"},
|
||||
@@ -116,7 +116,7 @@ var casesRequest = []struct {
|
||||
"jitter\n"),
|
||||
Request{
|
||||
Method: "GET_PARAMETER",
|
||||
URL: MustParseURL("rtsp://example.com/media.mp4"),
|
||||
URL: mustParseURL("rtsp://example.com/media.mp4"),
|
||||
Header: Header{
|
||||
"CSeq": HeaderValue{"9"},
|
||||
"Content-Type": HeaderValue{"text/parameters"},
|
||||
@@ -253,7 +253,7 @@ func TestRequestWriteErrors(t *testing.T) {
|
||||
bw := bufio.NewWriterSize(&limitedBuffer{cap: ca.cap}, 1)
|
||||
err := Request{
|
||||
Method: "ANNOUNCE",
|
||||
URL: MustParseURL("rtsp://example.com/media.mp4"),
|
||||
URL: mustParseURL("rtsp://example.com/media.mp4"),
|
||||
Header: Header{
|
||||
"CSeq": HeaderValue{"7"},
|
||||
},
|
||||
|
@@ -43,15 +43,6 @@ func ParseURL(s string) (*URL, error) {
|
||||
return (*URL)(u), nil
|
||||
}
|
||||
|
||||
// MustParseURL is like ParseURL but panics in case of errors.
|
||||
func MustParseURL(s string) *URL {
|
||||
u, err := ParseURL(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u *URL) String() string {
|
||||
return (*url.URL)(u).String()
|
||||
|
@@ -6,6 +6,14 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func mustParseURL(s string) *URL {
|
||||
u, err := ParseURL(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func TestURLError(t *testing.T) {
|
||||
for _, ca := range []struct {
|
||||
name string
|
||||
@@ -46,27 +54,27 @@ func TestURLRTSPPath(t *testing.T) {
|
||||
b string
|
||||
}{
|
||||
{
|
||||
MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
"teststream",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://localhost:8554/test/stream"),
|
||||
mustParseURL("rtsp://localhost:8554/test/stream"),
|
||||
"test/stream",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp"),
|
||||
"test",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
"te!st",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
"user=tmp&password=BagRep1!&channel=1&stream=0.sdp",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://localhost:8554/teststream?query1?query2"),
|
||||
mustParseURL("rtsp://localhost:8554/teststream?query1?query2"),
|
||||
"teststream",
|
||||
},
|
||||
} {
|
||||
@@ -77,7 +85,7 @@ func TestURLRTSPPath(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestURLClone(t *testing.T) {
|
||||
u := MustParseURL("rtsp://localhost:8554/test/stream")
|
||||
u := mustParseURL("rtsp://localhost:8554/test/stream")
|
||||
u2 := u.Clone()
|
||||
u.Host = "otherhost"
|
||||
|
||||
@@ -95,7 +103,7 @@ func TestURLClone(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestURLErrorRTSPPath(t *testing.T) {
|
||||
u := MustParseURL("rtsp://localhost:8554")
|
||||
u := mustParseURL("rtsp://localhost:8554")
|
||||
_, ok := u.RTSPPath()
|
||||
require.Equal(t, false, ok)
|
||||
}
|
||||
@@ -106,23 +114,23 @@ func TestURLRTSPPathAndQuery(t *testing.T) {
|
||||
b string
|
||||
}{
|
||||
{
|
||||
MustParseURL("rtsp://localhost:8554/teststream/trackID=1"),
|
||||
mustParseURL("rtsp://localhost:8554/teststream/trackID=1"),
|
||||
"teststream/trackID=1",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://localhost:8554/test/stream/trackID=1"),
|
||||
mustParseURL("rtsp://localhost:8554/test/stream/trackID=1"),
|
||||
"test/stream/trackID=1",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp/trackID=1"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp/trackID=1"),
|
||||
"test?user=tmp&password=BagRep1&channel=1&stream=0.sdp/trackID=1",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1"),
|
||||
"te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1",
|
||||
},
|
||||
{
|
||||
MustParseURL("rtsp://192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1"),
|
||||
"user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=1",
|
||||
},
|
||||
} {
|
||||
|
@@ -28,7 +28,7 @@ func TestServerPublishErrorAnnounce(t *testing.T) {
|
||||
"missing content-type",
|
||||
base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
},
|
||||
@@ -39,7 +39,7 @@ func TestServerPublishErrorAnnounce(t *testing.T) {
|
||||
"invalid content-type",
|
||||
base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"aa"},
|
||||
@@ -51,7 +51,7 @@ func TestServerPublishErrorAnnounce(t *testing.T) {
|
||||
"invalid tracks",
|
||||
base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -64,7 +64,7 @@ func TestServerPublishErrorAnnounce(t *testing.T) {
|
||||
"no tracks",
|
||||
base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -94,7 +94,7 @@ func TestServerPublishErrorAnnounce(t *testing.T) {
|
||||
"invalid URL 1",
|
||||
base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -133,7 +133,7 @@ func TestServerPublishErrorAnnounce(t *testing.T) {
|
||||
"invalid URL 2",
|
||||
base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -172,7 +172,7 @@ func TestServerPublishErrorAnnounce(t *testing.T) {
|
||||
"invalid URL 3",
|
||||
base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -347,7 +347,7 @@ func TestServerPublishSetupPath(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/" + ca.path),
|
||||
URL: mustParseURL("rtsp://localhost:8554/" + ca.path),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -372,7 +372,7 @@ func TestServerPublishSetupPath(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL(ca.url),
|
||||
URL: mustParseURL(ca.url),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": th.Write(),
|
||||
@@ -428,7 +428,7 @@ func TestServerPublishErrorSetupDifferentPaths(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -453,7 +453,7 @@ func TestServerPublishErrorSetupDifferentPaths(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/test2stream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/test2stream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": th.Write(),
|
||||
@@ -510,7 +510,7 @@ func TestServerPublishErrorSetupTrackTwice(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -535,7 +535,7 @@ func TestServerPublishErrorSetupTrackTwice(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": th.Write(),
|
||||
@@ -547,7 +547,7 @@ func TestServerPublishErrorSetupTrackTwice(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Transport": th.Write(),
|
||||
@@ -612,7 +612,7 @@ func TestServerPublishErrorRecordPartialTracks(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -637,7 +637,7 @@ func TestServerPublishErrorRecordPartialTracks(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": th.Write(),
|
||||
@@ -649,7 +649,7 @@ func TestServerPublishErrorRecordPartialTracks(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Record,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -762,7 +762,7 @@ func TestServerPublish(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -795,7 +795,7 @@ func TestServerPublish(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -823,7 +823,7 @@ func TestServerPublish(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Record,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -887,7 +887,7 @@ func TestServerPublish(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Teardown,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -952,7 +952,7 @@ func TestServerPublishErrorWrongProtocol(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -977,7 +977,7 @@ func TestServerPublishErrorWrongProtocol(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -993,7 +993,7 @@ func TestServerPublishErrorWrongProtocol(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Record,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -1054,7 +1054,7 @@ func TestServerPublishRTCPReport(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -1079,7 +1079,7 @@ func TestServerPublishRTCPReport(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -1095,7 +1095,7 @@ func TestServerPublishRTCPReport(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Record,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -1215,7 +1215,7 @@ func TestServerPublishTimeout(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -1246,7 +1246,7 @@ func TestServerPublishTimeout(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -1262,7 +1262,7 @@ func TestServerPublishTimeout(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Record,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -1342,7 +1342,7 @@ func TestServerPublishWithoutTeardown(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -1373,7 +1373,7 @@ func TestServerPublishWithoutTeardown(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -1389,7 +1389,7 @@ func TestServerPublishWithoutTeardown(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Record,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -1461,7 +1461,7 @@ func TestServerPublishUDPChangeConn(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -1486,7 +1486,7 @@ func TestServerPublishUDPChangeConn(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -1498,7 +1498,7 @@ func TestServerPublishUDPChangeConn(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Record,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -1517,7 +1517,7 @@ func TestServerPublishUDPChangeConn(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.GetParameter,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Session": base.HeaderValue{sxID},
|
||||
|
@@ -95,7 +95,7 @@ func TestServerReadSetupPath(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL(ca.url),
|
||||
URL: mustParseURL(ca.url),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": th.Write(),
|
||||
@@ -148,7 +148,7 @@ func TestServerReadErrorSetupDifferentPaths(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": th.Write(),
|
||||
@@ -161,7 +161,7 @@ func TestServerReadErrorSetupDifferentPaths(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/test12stream/trackID=1"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/test12stream/trackID=1"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": th.Write(),
|
||||
@@ -215,7 +215,7 @@ func TestServerReadErrorSetupTrackTwice(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": th.Write(),
|
||||
@@ -228,7 +228,7 @@ func TestServerReadErrorSetupTrackTwice(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Transport": th.Write(),
|
||||
@@ -345,7 +345,7 @@ func TestServerRead(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -375,7 +375,7 @@ func TestServerRead(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -434,7 +434,7 @@ func TestServerRead(t *testing.T) {
|
||||
// ping with OPTIONS
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Options,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"4"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -446,7 +446,7 @@ func TestServerRead(t *testing.T) {
|
||||
// ping with GET_PARAMETER
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.GetParameter,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"5"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -458,7 +458,7 @@ func TestServerRead(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Teardown,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"6"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -529,7 +529,7 @@ func TestServerReadTCPResponseBeforeFrames(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -551,7 +551,7 @@ func TestServerReadTCPResponseBeforeFrames(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -595,7 +595,7 @@ func TestServerReadPlayPlay(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -617,7 +617,7 @@ func TestServerReadPlayPlay(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -628,7 +628,7 @@ func TestServerReadPlayPlay(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -697,7 +697,7 @@ func TestServerReadPlayPausePlay(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -719,7 +719,7 @@ func TestServerReadPlayPausePlay(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -730,7 +730,7 @@ func TestServerReadPlayPausePlay(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Pause,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -741,7 +741,7 @@ func TestServerReadPlayPausePlay(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -806,7 +806,7 @@ func TestServerReadPlayPausePause(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -828,7 +828,7 @@ func TestServerReadPlayPausePause(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -839,7 +839,7 @@ func TestServerReadPlayPausePause(t *testing.T) {
|
||||
|
||||
err = base.Request{
|
||||
Method: base.Pause,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -853,7 +853,7 @@ func TestServerReadPlayPausePause(t *testing.T) {
|
||||
|
||||
err = base.Request{
|
||||
Method: base.Pause,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -927,7 +927,7 @@ func TestServerReadTimeout(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -938,7 +938,7 @@ func TestServerReadTimeout(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -1024,7 +1024,7 @@ func TestServerReadWithoutTeardown(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -1035,7 +1035,7 @@ func TestServerReadWithoutTeardown(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -1104,7 +1104,7 @@ func TestServerReadUDPChangeConn(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": inTH.Write(),
|
||||
@@ -1115,7 +1115,7 @@ func TestServerReadUDPChangeConn(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -1134,7 +1134,7 @@ func TestServerReadUDPChangeConn(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.GetParameter,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Session": base.HeaderValue{sxID},
|
||||
|
@@ -542,7 +542,7 @@ func TestServerCSeq(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Options,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"5"},
|
||||
},
|
||||
@@ -575,7 +575,7 @@ func TestServerErrorCSeqMissing(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Options,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/"),
|
||||
Header: base.Header{},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@@ -606,7 +606,7 @@ func TestServerErrorInvalidMethod(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: "INVALID",
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
},
|
||||
@@ -649,7 +649,7 @@ func TestServerErrorTCPTwoConnOneSession(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn1, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -671,7 +671,7 @@ func TestServerErrorTCPTwoConnOneSession(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn1, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -687,7 +687,7 @@ func TestServerErrorTCPTwoConnOneSession(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn2, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -741,7 +741,7 @@ func TestServerErrorTCPOneConnTwoSessions(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -763,7 +763,7 @@ func TestServerErrorTCPOneConnTwoSessions(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": res.Header["Session"],
|
||||
@@ -774,7 +774,7 @@ func TestServerErrorTCPOneConnTwoSessions(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -826,7 +826,7 @@ func TestServerGetSetParameter(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Options,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
},
|
||||
@@ -836,7 +836,7 @@ func TestServerGetSetParameter(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.SetParameter,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"12"},
|
||||
},
|
||||
@@ -847,7 +847,7 @@ func TestServerGetSetParameter(t *testing.T) {
|
||||
|
||||
res, err = writeReqReadRes(bconn, base.Request{
|
||||
Method: base.GetParameter,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
},
|
||||
@@ -897,7 +897,7 @@ func TestServerErrorInvalidSession(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: method,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
},
|
||||
@@ -939,7 +939,7 @@ func TestServerSessionClose(t *testing.T) {
|
||||
|
||||
err = base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -987,7 +987,7 @@ func TestServerSessionAutoClose(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Transport": headers.Transport{
|
||||
@@ -1074,7 +1074,7 @@ func TestServerErrorInvalidPath(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Announce,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"1"},
|
||||
"Content-Type": base.HeaderValue{"application/sdp"},
|
||||
@@ -1089,7 +1089,7 @@ func TestServerErrorInvalidPath(t *testing.T) {
|
||||
if method == base.Play || method == base.Record || method == base.Pause {
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Setup,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/trackID=0"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": base.HeaderValue{sxID},
|
||||
@@ -1119,7 +1119,7 @@ func TestServerErrorInvalidPath(t *testing.T) {
|
||||
if method == base.Pause {
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: base.Play,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
URL: mustParseURL("rtsp://localhost:8554/teststream/"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"2"},
|
||||
"Session": base.HeaderValue{sxID},
|
||||
@@ -1131,7 +1131,7 @@ func TestServerErrorInvalidPath(t *testing.T) {
|
||||
|
||||
res, err := writeReqReadRes(bconn, base.Request{
|
||||
Method: method,
|
||||
URL: base.MustParseURL("rtsp://localhost:8554"),
|
||||
URL: mustParseURL("rtsp://localhost:8554"),
|
||||
Header: base.Header{
|
||||
"CSeq": base.HeaderValue{"3"},
|
||||
"Session": base.HeaderValue{sxID},
|
||||
|
@@ -98,8 +98,8 @@ func TestTrackURL(t *testing.T) {
|
||||
[]byte("v=0\r\n" +
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
},
|
||||
{
|
||||
"absolute control",
|
||||
@@ -107,8 +107,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:rtsp://localhost/path/trackID=7"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/trackID=7"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/trackID=7"),
|
||||
},
|
||||
{
|
||||
"relative control",
|
||||
@@ -116,8 +116,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:trackID=5"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/trackID=5"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/trackID=5"),
|
||||
},
|
||||
{
|
||||
"relative control, subpath",
|
||||
@@ -125,8 +125,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:trackID=5"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/sub/path/"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/sub/path/trackID=5"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/sub/path/"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/sub/path/trackID=5"),
|
||||
},
|
||||
{
|
||||
"relative control, url without slash",
|
||||
@@ -134,8 +134,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:trackID=5"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/sub/path"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/sub/path/trackID=5"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/sub/path"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/sub/path/trackID=5"),
|
||||
},
|
||||
{
|
||||
"relative control, url with query",
|
||||
@@ -143,8 +143,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:trackID=5"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp/trackID=5"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp/trackID=5"),
|
||||
},
|
||||
{
|
||||
"relative control, url with special chars and query",
|
||||
@@ -152,8 +152,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:trackID=5"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=5"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=5"),
|
||||
},
|
||||
{
|
||||
"relative control, url with query without question mark",
|
||||
@@ -161,8 +161,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:trackID=5"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
base.MustParseURL("rtsp://myuser:mypass@192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=5"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp/trackID=5"),
|
||||
},
|
||||
{
|
||||
"relative control, control is query",
|
||||
@@ -170,8 +170,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:?ctype=video"),
|
||||
base.MustParseURL("rtsp://192.168.1.99:554/test"),
|
||||
base.MustParseURL("rtsp://192.168.1.99:554/test?ctype=video"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/test"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/test?ctype=video"),
|
||||
},
|
||||
{
|
||||
"relative control, control is query and no path",
|
||||
@@ -179,8 +179,8 @@ func TestTrackURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:?ctype=video"),
|
||||
base.MustParseURL("rtsp://192.168.1.99:554/"),
|
||||
base.MustParseURL("rtsp://192.168.1.99:554/?ctype=video"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/"),
|
||||
mustParseURL("rtsp://192.168.1.99:554/?ctype=video"),
|
||||
},
|
||||
} {
|
||||
t.Run(ca.name, func(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user