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

RTC: Refine RTCP packets parsing

This commit is contained in:
winlin 2020-08-11 09:40:27 +08:00
parent 1591318792
commit a728e02b93
5 changed files with 131 additions and 464 deletions

View file

@ -379,20 +379,6 @@ srs_error_t srs_write_large_iovs(ISrsProtocolReadWriter* skt, iovec* iovs, int s
return err;
}
string srs_join_vector_string(vector<string>& vs, string separator)
{
string str = "";
for (int i = 0; i < (int)vs.size(); i++) {
str += vs.at(i);
if (i != (int)vs.size() - 1) {
str += separator;
}
}
return str;
}
bool srs_is_ipv4(string domain)
{
for (int i = 0; i < (int)domain.length(); i++) {

View file

@ -34,6 +34,7 @@
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <srs_kernel_consts.hpp>
@ -108,7 +109,20 @@ extern std::string srs_generate_rtmp_url(std::string server, int port, std::stri
extern srs_error_t srs_write_large_iovs(ISrsProtocolReadWriter* skt, iovec* iovs, int size, ssize_t* pnwrite = NULL);
// join string in vector with indicated separator
extern std::string srs_join_vector_string(std::vector<std::string>& vs, std::string separator);
template <typename T>
std::string srs_join_vector_string(std::vector<T>& vs, std::string separator)
{
std::stringstream ss;
for (int i = 0; i < (int)vs.size(); i++) {
ss << vs.at(i);
if (i != (int)vs.size() - 1) {
ss << separator;
}
}
return ss.str();
}
// Whether domain is an IPv4 address.
extern bool srs_is_ipv4(std::string domain);