Commit 9f25392f by xia-chu

精简api命名

parent 2e8a7be5
......@@ -181,7 +181,7 @@ static unordered_map<RtpExtType/*id*/, string/*ext*/> s_type_to_url = {RTP_EXT_M
static unordered_map<string/*ext*/, RtpExtType/*id*/> s_url_to_type = {RTP_EXT_MAP(XX)};
#undef XX
RtpExtType RtpExt::getRtpExtType(const string &url) {
RtpExtType RtpExt::getExtType(const string &url) {
auto it = s_url_to_type.find(url);
if (it == s_url_to_type.end()) {
throw std::invalid_argument(string("未识别的rtp ext url类型:") + url);
......@@ -189,7 +189,7 @@ RtpExtType RtpExt::getRtpExtType(const string &url) {
return it->second;
}
const string &RtpExt::getRtpExtUrl(RtpExtType type) {
const string &RtpExt::getExtUrl(RtpExtType type) {
auto it = s_type_to_url.find(type);
if (it == s_type_to_url.end()) {
throw std::invalid_argument(string("未识别的rtp ext类型:") + to_string((int) type));
......
......@@ -43,8 +43,8 @@ class RtpExt : public std::string {
public:
~RtpExt() = default;
static map<uint8_t/*id*/, RtpExt/*data*/> getExtValue(const RtpHeader *header, const RtcMedia &media);
static RtpExtType getRtpExtType(const string &url);
static const string& getRtpExtUrl(RtpExtType type);
static RtpExtType getExtType(const string &url);
static const string& getExtUrl(RtpExtType type);
private:
RtpExt(RtpExtType type, const char *str, size_t size) : std::string(str, size), _type(type) {}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论