1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix demo script, start nginx. fix warning of utest on ubuntu14

This commit is contained in:
winlin 2014-06-29 10:03:29 +08:00
parent e6f524281c
commit ee07210105
7 changed files with 92 additions and 71 deletions

View file

@ -24,11 +24,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_protocol_utility.hpp>
#include <stdlib.h>
using namespace std;
#include <srs_kernel_log.hpp>
#include <srs_kernel_utility.hpp>
void srs_vhost_resolve(std::string& vhost, std::string& app)
void srs_vhost_resolve(string& vhost, string& app)
{
app = srs_string_replace(app, "...", "?");
@ -71,3 +72,24 @@ void srs_random_generate(char* bytes, int size)
bytes[i] = cdata[rand() % (sizeof(cdata) - 1)];
}
}
string srs_generate_tc_url(string ip, string vhost, string app, string port)
{
string tcUrl = "rtmp://";
if (vhost == RTMP_VHOST_DEFAULT) {
tcUrl += ip;
} else {
tcUrl += vhost;
}
if (port != RTMP_DEFAULT_PORT) {
tcUrl += ":";
tcUrl += port;
}
tcUrl += "/";
tcUrl += app;
return tcUrl;
}

View file

@ -31,9 +31,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string>
// default vhost for rtmp
// default vhost of rtmp
#define RTMP_VHOST_DEFAULT "__defaultVhost__"
// default port of rtmp
#define RTMP_DEFAULT_PORT "1935"
// the default chunk size for system.
@ -45,6 +45,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// app...vhost...request_vhost
extern void srs_vhost_resolve(std::string& vhost, std::string& app);
// generate ramdom data for handshake.
extern void srs_random_generate(char* bytes, int size);
// generate the tcUrl.
extern std::string srs_generate_tc_url(std::string ip, std::string vhost, std::string app, std::string port);
#endif