mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
格式化代码
This commit is contained in:
parent
ba947cb6b5
commit
663d167837
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +265,7 @@ std::shared_ptr<RtcpSR> RtcpSR::create(size_t item_count) {
|
||||
auto ptr = (RtcpSR *)new char[bytes];
|
||||
setupHeader(ptr, RtcpType::RTCP_SR, item_count, bytes);
|
||||
setupPadding(ptr, bytes - real_size);
|
||||
return std::shared_ptr<RtcpSR>(ptr, [](RtcpSR *ptr) { delete[] (char *)ptr; });
|
||||
return std::shared_ptr<RtcpSR>(ptr, [](RtcpSR *ptr) { delete[](char *) ptr; });
|
||||
}
|
||||
|
||||
string RtcpSR::getNtpStamp() const {
|
||||
@ -406,7 +396,7 @@ std::shared_ptr<RtcpRR> RtcpRR::create(size_t item_count) {
|
||||
auto ptr = (RtcpRR *)new char[bytes];
|
||||
setupHeader(ptr, RtcpType::RTCP_RR, item_count, bytes);
|
||||
setupPadding(ptr, bytes - real_size);
|
||||
return std::shared_ptr<RtcpRR>(ptr, [](RtcpRR *ptr) { delete[] (char *)ptr; });
|
||||
return std::shared_ptr<RtcpRR>(ptr, [](RtcpRR *ptr) { delete[](char *) ptr; });
|
||||
}
|
||||
|
||||
string RtcpRR::dumpString() const {
|
||||
@ -492,7 +482,7 @@ std::shared_ptr<RtcpSdes> RtcpSdes::create(const std::vector<string> &item_text)
|
||||
|
||||
setupHeader(ptr, RtcpType::RTCP_SDES, item_text.size(), bytes);
|
||||
setupPadding(ptr, bytes - real_size);
|
||||
return std::shared_ptr<RtcpSdes>(ptr, [](RtcpSdes *ptr) { delete[] (char *)ptr; });
|
||||
return std::shared_ptr<RtcpSdes>(ptr, [](RtcpSdes *ptr) { delete[](char *) ptr; });
|
||||
}
|
||||
|
||||
string RtcpSdes::dumpString() const {
|
||||
@ -544,7 +534,7 @@ std::shared_ptr<RtcpFB> RtcpFB::create_l(RtcpType type, int fmt, const void *fci
|
||||
}
|
||||
setupHeader(ptr, type, fmt, bytes);
|
||||
setupPadding(ptr, bytes - real_size);
|
||||
return std::shared_ptr<RtcpFB>((RtcpFB *)ptr, [](RtcpFB *ptr) { delete[] (char *)ptr; });
|
||||
return std::shared_ptr<RtcpFB>((RtcpFB *)ptr, [](RtcpFB *ptr) { delete[](char *) ptr; });
|
||||
}
|
||||
|
||||
std::shared_ptr<RtcpFB> RtcpFB::create(PSFBType fmt, const void *fci, size_t fci_len) {
|
||||
@ -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);
|
||||
}
|
||||
@ -656,7 +646,7 @@ std::shared_ptr<RtcpBye> RtcpBye::create(const std::vector<uint32_t> &ssrcs, con
|
||||
memcpy(reason_len_ptr + 1, reason.data(), *reason_len_ptr);
|
||||
}
|
||||
|
||||
return std::shared_ptr<RtcpBye>(ptr, [](RtcpBye *ptr) { delete[] (char *)ptr; });
|
||||
return std::shared_ptr<RtcpBye>(ptr, [](RtcpBye *ptr) { delete[](char *) ptr; });
|
||||
}
|
||||
|
||||
vector<uint32_t *> RtcpBye::getSSRC() {
|
||||
@ -794,7 +784,7 @@ std::shared_ptr<RtcpXRDLRR> RtcpXRDLRR::create(size_t item_count) {
|
||||
auto ptr = (RtcpXRDLRR *)new char[bytes];
|
||||
setupHeader(ptr, RtcpType::RTCP_XR, 0, bytes);
|
||||
setupPadding(ptr, bytes - real_size);
|
||||
return std::shared_ptr<RtcpXRDLRR>(ptr, [](RtcpXRDLRR *ptr) { delete[] (char *)ptr; });
|
||||
return std::shared_ptr<RtcpXRDLRR>(ptr, [](RtcpXRDLRR *ptr) { delete[](char *) ptr; });
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
Loading…
Reference in New Issue
Block a user