#1261, Support _definst_ for Wowza. 3.0.44

pull/1304/head
winlin 6 years ago
commit 24f46f5085

@ -184,6 +184,7 @@ Please select according to languages:
### V3 changes
* v3.0, 2018-11-11, Merge [#1261][bug #1261], Support `_definst_` for Wowza. 3.0.44
* v3.0, 2018-08-26, SRS [console](https://github.com/ossrs/srs-ngb) support both [Chinese](http://ossrs.net:1985/console/ng_index.html) and [English](http://ossrs.net:1985/console/en_index.html).
* v3.0, 2018-08-25, Fix [#1093][bug #1093], Support HLS encryption. 3.0.42
* v3.0, 2018-08-25, Fix [#1051][bug #1051], Drop ts when republishing stream. 3.0.41
@ -234,6 +235,8 @@ Please select according to languages:
### V2 changes
* v2.0, 2018-11-11, Merge [#1261][bug #1261], Support `_definst_` for Wowza. 2.0.260
* v2.0, 2018-11-11, Merge [#1263][bug #1263], Fix string trim bug. 2.0.259
* <strong>v2.0, 2018-10-28, [2.0 release5(2.0.258)][r2.0r5] released. 86916 lines.</strong>
* v2.0, 2018-10-28, Fix [#1250][bug #1250], Support build on OSX10.14 Mojave. 2.0.258
* v2.0, 2018-10-08, Merge [#1236][bug #1236], Fix sleep bug in us. 2.0.257
@ -1460,6 +1463,8 @@ Winlin
[bug #1237]: https://github.com/ossrs/srs/issues/1237
[bug #1236]: https://github.com/ossrs/srs/issues/1236
[bug #1250]: https://github.com/ossrs/srs/issues/1250
[bug #1263]: https://github.com/ossrs/srs/issues/1263
[bug #1261]: https://github.com/ossrs/srs/issues/1261
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
[bug #735]: https://github.com/ossrs/srs/issues/735

@ -27,7 +27,7 @@
// current release version
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 43
#define VERSION_REVISION 44
// generated by configure, only macros.
#include <srs_auto_headers.hpp>

@ -303,7 +303,7 @@ string srs_string_trim_end(string str, string trim_chars)
ret.erase(ret.end() - 1);
// ok, matched, should reset the search
i = 0;
i = -1;
}
}
@ -321,7 +321,7 @@ string srs_string_trim_start(string str, string trim_chars)
ret.erase(ret.begin());
// ok, matched, should reset the search
i = 0;
i = -1;
}
}
@ -340,7 +340,7 @@ string srs_string_remove(string str, string remove_chars)
it = ret.erase(it);
// ok, matched, should reset the search
i = 0;
i = -1;
} else {
++it;
}
@ -350,6 +350,32 @@ string srs_string_remove(string str, string remove_chars)
return ret;
}
string srs_erase_first_substr(string str, string erase_string)
{
std::string ret = str;
size_t pos = ret.find(erase_string);
if (pos != std::string::npos) {
ret.erase(pos, erase_string.length());
}
return ret;
}
string srs_erase_last_substr(string str, string erase_string)
{
std::string ret = str;
size_t pos = ret.rfind(erase_string);
if (pos != std::string::npos) {
ret.erase(pos, erase_string.length());
}
return ret;
}
bool srs_string_ends_with(string str, string flag)
{
const size_t pos = str.rfind(flag);

@ -79,6 +79,10 @@ extern std::string srs_string_trim_end(std::string str, std::string trim_chars);
extern std::string srs_string_trim_start(std::string str, std::string trim_chars);
// remove char in remove_chars of str
extern std::string srs_string_remove(std::string str, std::string remove_chars);
// remove first substring from str
extern std::string srs_erase_first_substr(std::string str, std::string erase_string);
// remove last substring from str
extern std::string srs_erase_last_substr(std::string str, std::string erase_string);
// whether string end with
extern bool srs_string_ends_with(std::string str, std::string flag);
extern bool srs_string_ends_with(std::string str, std::string flag0, std::string flag1);

@ -63,6 +63,10 @@ void srs_vhost_resolve(string& vhost, string& app, string& param)
app = srs_string_replace(app, "&&", "?");
app = srs_string_replace(app, "=", "?");
if (srs_string_ends_with(app, "/_definst_")) {
app = srs_erase_last_substr(app, "/_definst_");
}
if ((pos = app.find("?")) != std::string::npos) {
std::string query = app.substr(pos + 1);
app = app.substr(0, pos);

@ -1408,6 +1408,15 @@ VOID TEST(KernelUtilityTest, UtilityString)
str1 = srs_string_replace(str, "o", "XX");
EXPECT_STREQ("HellXX, WXXrld! HellXX, SRS!", str1.c_str());
str1 = srs_string_trim_start(str, "x");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
str1 = srs_string_trim_start(str, "S!R");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
str1 = srs_string_trim_start(str, "lHe");
EXPECT_STREQ("o, World! Hello, SRS!", str1.c_str());
str1 = srs_string_trim_end(str, "x");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
@ -1415,7 +1424,7 @@ VOID TEST(KernelUtilityTest, UtilityString)
str1 = srs_string_trim_end(str, "He");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
str1 = srs_string_trim_end(str, "HeS!R");
str1 = srs_string_trim_end(str, "S!R");
EXPECT_STREQ("Hello, World! Hello, ", str1.c_str());
str1 = srs_string_remove(str, "x");
@ -1426,6 +1435,18 @@ VOID TEST(KernelUtilityTest, UtilityString)
str1 = srs_string_remove(str, "ol");
EXPECT_STREQ("He, Wrd! He, SRS!", str1.c_str());
str1 = srs_erase_first_substr(str, "Hello");
EXPECT_STREQ(", World! Hello, SRS!", str1.c_str());
str1 = srs_erase_first_substr(str, "XX");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
str1 = srs_erase_last_substr(str, "Hello");
EXPECT_STREQ("Hello, World! , SRS!", str1.c_str());
str1 = srs_erase_last_substr(str, "XX");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
EXPECT_FALSE(srs_string_ends_with("Hello", "x"));
EXPECT_TRUE(srs_string_ends_with("Hello", "o"));

@ -556,6 +556,16 @@ VOID TEST(ProtocolUtilityTest, DiscoveryTcUrl)
EXPECT_STREQ("live", app.c_str());
EXPECT_STREQ("show", stream.c_str());
EXPECT_EQ(19351, port);
// _definst_ at the end of app
tcUrl = "rtmp://winlin.cn/live/_definst_"; stream= "show";
srs_discovery_tc_url(tcUrl, schema, ip, vhost, app, stream, port, param);
EXPECT_STREQ("rtmp", schema.c_str());
EXPECT_STREQ("winlin.cn", ip.c_str());
EXPECT_STREQ("winlin.cn", vhost.c_str());
EXPECT_STREQ("live", app.c_str());
EXPECT_STREQ("show", stream.c_str());
EXPECT_EQ(1935, port);
}
/**

Loading…
Cancel
Save