-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SRT: url supports multiple QueryStrings (#2908)
* SRT: parse srt url to supports multiple QueryStrings.(#2893) * SRT: url supports multiple QueryStrings by comma-separated key-value pairs with no nesting (#2893) * SRT: url supports multiple QueryStrings by comma-separated key-value pairs with no nesting (#2893) * SRT: Add comments for url. * Add utest for SRT URL parsing. * Update README. Co-authored-by: winlin <winlin@vip.126.com>
- Loading branch information
1 parent
06cff31
commit 210cdf0
Showing
8 changed files
with
180 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ | |
|
||
#define VERSION_MAJOR 4 | ||
#define VERSION_MINOR 0 | ||
#define VERSION_REVISION 249 | ||
#define VERSION_REVISION 250 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// Copyright (c) 2013-2021 Winlin | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
#include <srs_utest_srt.hpp> | ||
|
||
#include <srs_kernel_error.hpp> | ||
#include <srt_conn.hpp> | ||
|
||
#include <vector> | ||
using namespace std; | ||
|
||
VOID TEST(ProtocolSrtTest, SrtGetStreamInfoNormal) { | ||
int mode; string vhost; string subpath; | ||
|
||
if (true) { | ||
EXPECT_TRUE(get_streamid_info("#!::r=live/livestream,key1=value1,key2=value2", mode, vhost, subpath)); | ||
EXPECT_EQ(PULL_SRT_MODE, mode); | ||
EXPECT_STREQ("", vhost.c_str()); | ||
EXPECT_STREQ("live/livestream?key1=value1&key2=value2", subpath.c_str()); | ||
} | ||
|
||
if (true) { | ||
EXPECT_TRUE(get_streamid_info("#!::h=host.com,r=live/livestream,key1=value1,key2=value2", mode, vhost, subpath)); | ||
EXPECT_EQ(PULL_SRT_MODE, mode); | ||
EXPECT_STREQ("host.com", vhost.c_str()); | ||
EXPECT_STREQ("live/livestream?vhost=host.com&key1=value1&key2=value2", subpath.c_str()); | ||
} | ||
} | ||
|
||
VOID TEST(ProtocolSrtTest, SrtGetStreamInfoMethod) { | ||
int mode; string vhost; string subpath; | ||
|
||
if (true) { | ||
EXPECT_TRUE(get_streamid_info("#!::r=live/livestream,m=request", mode, vhost, subpath)); | ||
EXPECT_EQ(PULL_SRT_MODE, mode); | ||
EXPECT_STREQ("live/livestream", subpath.c_str()); | ||
} | ||
|
||
if (true) { | ||
EXPECT_TRUE(get_streamid_info("#!::r=live/livestream,m=publish", mode, vhost, subpath)); | ||
EXPECT_EQ(PUSH_SRT_MODE, mode); | ||
EXPECT_STREQ("live/livestream", subpath.c_str()); | ||
} | ||
} | ||
|
||
VOID TEST(ProtocolSrtTest, SrtGetStreamInfoCompatible) { | ||
int mode; string vhost; string subpath; | ||
|
||
if (true) { | ||
EXPECT_TRUE(get_streamid_info("#!::h=live/livestream,m=request", mode, vhost, subpath)); | ||
EXPECT_EQ(PULL_SRT_MODE, mode); | ||
EXPECT_STREQ("", vhost.c_str()); | ||
EXPECT_STREQ("live/livestream", subpath.c_str()); | ||
} | ||
|
||
if (true) { | ||
EXPECT_TRUE(get_streamid_info("#!::h=live/livestream,m=publish", mode, vhost, subpath)); | ||
EXPECT_EQ(PUSH_SRT_MODE, mode); | ||
EXPECT_STREQ("", vhost.c_str()); | ||
EXPECT_STREQ("live/livestream", subpath.c_str()); | ||
} | ||
|
||
if (true) { | ||
EXPECT_TRUE(get_streamid_info("#!::h=srs.srt.com.cn/live/livestream,m=request", mode, vhost, subpath)); | ||
EXPECT_EQ(PULL_SRT_MODE, mode); | ||
EXPECT_STREQ("srs.srt.com.cn", vhost.c_str()); | ||
EXPECT_STREQ("live/livestream?vhost=srs.srt.com.cn", subpath.c_str()); | ||
} | ||
|
||
if (true) { | ||
EXPECT_TRUE(get_streamid_info("#!::h=srs.srt.com.cn/live/livestream,m=publish", mode, vhost, subpath)); | ||
EXPECT_EQ(PUSH_SRT_MODE, mode); | ||
EXPECT_STREQ("srs.srt.com.cn", vhost.c_str()); | ||
EXPECT_STREQ("live/livestream?vhost=srs.srt.com.cn", subpath.c_str()); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Copyright (c) 2013-2021 Winlin | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
#ifndef SRS_UTEST_SRT_HPP | ||
#define SRS_UTEST_SRT_HPP | ||
|
||
/* | ||
#include <srs_utest_srt.hpp> | ||
*/ | ||
#include <srs_utest.hpp> | ||
|
||
#endif | ||
|