mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTMP: Refine code for gussing stream by app.
This commit is contained in:
parent
96add9be3d
commit
9bd3c51818
4 changed files with 79 additions and 22 deletions
|
@ -3574,3 +3574,50 @@ VOID TEST(ProtocolRTMPTest, DiscoveryTcUrl)
|
|||
}
|
||||
}
|
||||
|
||||
VOID TEST(ProtocolRTMPTest, GuessingStream)
|
||||
{
|
||||
// Stream in app without params.
|
||||
if (true) {
|
||||
string app = "live/livestream", param = "", stream = "";
|
||||
srs_guess_stream_by_app(app, param, stream);
|
||||
EXPECT_STREQ("live", app.c_str());
|
||||
EXPECT_STREQ("livestream", stream.c_str());
|
||||
}
|
||||
|
||||
// Stream in app with params.
|
||||
if (true) {
|
||||
string app = "live/livestream", param = "?secret=xxx", stream = "";
|
||||
srs_guess_stream_by_app(app, param, stream);
|
||||
EXPECT_STREQ("live", app.c_str());
|
||||
EXPECT_STREQ("livestream", stream.c_str());
|
||||
EXPECT_STREQ("?secret=xxx", param.c_str());
|
||||
}
|
||||
|
||||
// Stream in app with params.
|
||||
if (true) {
|
||||
string app = "live/livestream?secret=xxx", param = "", stream = "";
|
||||
srs_guess_stream_by_app(app, param, stream);
|
||||
EXPECT_STREQ("live", app.c_str());
|
||||
EXPECT_STREQ("livestream", stream.c_str());
|
||||
EXPECT_STREQ("?secret=xxx", param.c_str());
|
||||
}
|
||||
|
||||
// Stream in param.
|
||||
if (true) {
|
||||
string app = "live", param = "?secret=xxx/livestream", stream = "";
|
||||
srs_guess_stream_by_app(app, param, stream);
|
||||
EXPECT_STREQ("live", app.c_str());
|
||||
EXPECT_STREQ("livestream", stream.c_str());
|
||||
EXPECT_STREQ("?secret=xxx", param.c_str());
|
||||
}
|
||||
|
||||
// No stream.
|
||||
if (true) {
|
||||
string app = "live", param = "?secret=xxx", stream = "";
|
||||
srs_guess_stream_by_app(app, param, stream);
|
||||
EXPECT_STREQ("live", app.c_str());
|
||||
EXPECT_STREQ("", stream.c_str());
|
||||
EXPECT_STREQ("?secret=xxx", param.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue