diff --git a/internal/rtmp/conn.go b/internal/rtmp/conn.go index b0d4124b..af2d3d12 100644 --- a/internal/rtmp/conn.go +++ b/internal/rtmp/conn.go @@ -84,13 +84,13 @@ func getTcURL(u *url.URL) string { return nu.String() + app } -func createURL(tcurl, app, play string) (*url.URL, error) { +func createURL(tcURL string, app string, play string) (*url.URL, error) { u, err := url.ParseRequestURI("/" + app + "/" + play) if err != nil { return nil, err } - tu, err := url.Parse(tcurl) + tu, err := url.Parse(tcURL) if err != nil { return nil, err } @@ -365,6 +365,8 @@ func (c *Conn) InitializeServer() (*url.URL, bool, error) { } } + tcURL = strings.Trim(tcURL, "'") + err = c.mrw.Write(&message.MsgSetWindowAckSize{ Value: 2500000, }) diff --git a/internal/rtmp/conn_test.go b/internal/rtmp/conn_test.go index c8c5c2f1..7c969ef7 100644 --- a/internal/rtmp/conn_test.go +++ b/internal/rtmp/conn_test.go @@ -259,7 +259,11 @@ func TestInitializeClient(t *testing.T) { } func TestInitializeServer(t *testing.T) { - for _, ca := range []string{"read", "publish"} { + for _, ca := range []string{ + "read", + "publish", + "publish neko", + } { t.Run(ca, func(t *testing.T) { ln, err := net.Listen("tcp", "127.0.0.1:9121") require.NoError(t, err) @@ -280,7 +284,7 @@ func TestInitializeServer(t *testing.T) { Host: "127.0.0.1:9121", Path: "//stream/", }, u) - require.Equal(t, ca == "publish", isPublishing) + require.Equal(t, ca == "publish" || ca == "publish neko", isPublishing) close(done) }() @@ -295,6 +299,11 @@ func TestInitializeServer(t *testing.T) { mrw := message.NewReadWriter(bc, true) + tcURL := "rtmp://127.0.0.1:9121/stream" + if ca == "publish neko" { + tcURL = "'rtmp://127.0.0.1:9121/stream" + } + err = mrw.Write(&message.MsgCommandAMF0{ ChunkStreamID: 3, Name: "connect", @@ -303,7 +312,7 @@ func TestInitializeServer(t *testing.T) { flvio.AMFMap{ {K: "app", V: "/stream"}, {K: "flashVer", V: "LNX 9,0,124,2"}, - {K: "tcUrl", V: "rtmp://127.0.0.1:9121/stream"}, + {K: "tcUrl", V: tcURL}, {K: "fpad", V: false}, {K: "capabilities", V: 15}, {K: "audioCodecs", V: 4071},