格式化代码

This commit is contained in:
ziyue 2022-08-05 17:55:48 +08:00
parent ba947cb6b5
commit 663d167837

View File

@ -22,48 +22,40 @@ namespace mediakit {
const char *rtcpTypeToStr(RtcpType type) {
switch (type) {
#define SWITCH_CASE(key, value) \
case RtcpType::key: \
return #value "(" #key ")";
case RtcpType::key: return #value "(" #key ")";
RTCP_PT_MAP(SWITCH_CASE)
#undef SWITCH_CASE
default:
return "unknown rtcp pt";
default: return "unknown rtcp pt";
}
}
const char *sdesTypeToStr(SdesType type) {
switch (type) {
#define SWITCH_CASE(key, value) \
case SdesType::key: \
return #value "(" #key ")";
case SdesType::key: return #value "(" #key ")";
SDES_TYPE_MAP(SWITCH_CASE)
#undef SWITCH_CASE
default:
return "unknown source description type";
default: return "unknown source description type";
}
}
const char *psfbTypeToStr(PSFBType type) {
switch (type) {
#define SWITCH_CASE(key, value) \
case PSFBType::key: \
return #value "(" #key ")";
case PSFBType::key: return #value "(" #key ")";
PSFB_TYPE_MAP(SWITCH_CASE)
#undef SWITCH_CASE
default:
return "unknown payload-specific fb message fmt type";
default: return "unknown payload-specific fb message fmt type";
}
}
const char *rtpfbTypeToStr(RTPFBType type) {
switch (type) {
#define SWITCH_CASE(key, value) \
case RTPFBType::key: \
return #value "(" #key ")";
case RTPFBType::key: return #value "(" #key ")";
RTPFB_TYPE_MAP(SWITCH_CASE)
#undef SWITCH_CASE
default:
return "unknown transport layer feedback messages fmt type";
default: return "unknown transport layer feedback messages fmt type";
}
}
@ -152,8 +144,7 @@ string RtcpHeader::dumpString() const {
return rtcp->dumpString();
}
default:
return StrPrinter << dumpHeader() << hexdump((char *)this + sizeof(*this), getSize() - sizeof(*this));
default: return StrPrinter << dumpHeader() << hexdump((char *)this + sizeof(*this), getSize() - sizeof(*this));
}
}
@ -220,8 +211,7 @@ void RtcpHeader::net2Host(size_t len) {
}
break;
}
default:
throw std::runtime_error(StrPrinter << "未处理的rtcp包:" << rtcpTypeToStr((RtcpType)this->pt));
default: throw std::runtime_error(StrPrinter << "未处理的rtcp包:" << rtcpTypeToStr((RtcpType)this->pt));
}
}
@ -596,7 +586,8 @@ string RtcpFB::dumpString() const {
break;
}
default: {
printer << "fci:" << psfbTypeToStr((PSFBType)report_count) << " " << hexdump(getFciPtr(), getFciSize());
printer << "fci:" << psfbTypeToStr((PSFBType)report_count) << " "
<< hexdump(getFciPtr(), getFciSize());
break;
}
}
@ -615,15 +606,14 @@ string RtcpFB::dumpString() const {
break;
}
default: {
printer << "fci:" << rtpfbTypeToStr((RTPFBType)report_count) << " " << hexdump(getFciPtr(), getFciSize());
printer << "fci:" << rtpfbTypeToStr((RTPFBType)report_count) << " "
<< hexdump(getFciPtr(), getFciSize());
break;
}
}
break;
}
default: /*不可达*/
assert(0);
break;
default: /*不可达*/ assert(0); break;
}
return std::move(printer);
}