精简api命名

This commit is contained in:
xia-chu 2021-05-07 14:01:24 +08:00
parent 2e8a7be5ea
commit 9f25392f69
2 changed files with 4 additions and 4 deletions

View File

@ -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));

View File

@ -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) {}