修复clang下编译警告和错误

This commit is contained in:
xiongziliang 2021-05-08 19:33:51 +08:00
parent e81d91988d
commit 0377796c03
6 changed files with 10 additions and 11 deletions

View File

@ -236,7 +236,6 @@ public:
}
private:
std::size_t _size;
std::shared_ptr<RtcpHeader> _rtcp;
};
@ -604,7 +603,7 @@ std::shared_ptr<RtcpBye> RtcpBye::create(const std::vector<uint32_t> &ssrcs, con
setupHeader(ptr, RtcpType::RTCP_BYE, ssrcs.size(), bytes);
setupPadding(ptr, bytes - real_size);
auto *ssrc_ptr = &(((RtcpBye *) ptr)->ssrc);
auto ssrc_ptr = ((RtcpBye *) ptr)->ssrc;
for (auto ssrc : ssrcs) {
*ssrc_ptr = htonl(ssrc);
++ssrc_ptr;
@ -623,7 +622,7 @@ std::shared_ptr<RtcpBye> RtcpBye::create(const std::vector<uint32_t> &ssrcs, con
vector<uint32_t *> RtcpBye::getSSRC() {
vector<uint32_t *> ret;
uint32_t *ssrc_ptr = &ssrc;
auto ssrc_ptr = ssrc;
for (size_t i = 0; i < report_count; ++i) {
ret.emplace_back(ssrc_ptr);
ssrc_ptr += 1;
@ -652,7 +651,7 @@ string RtcpBye::dumpString() const {
void RtcpBye::net2Host(size_t size) {
static const size_t kMinSize = sizeof(RtcpHeader);
CHECK_MIN_SIZE(size, kMinSize);
uint32_t *ssrc_ptr = &ssrc;
auto ssrc_ptr = ssrc;
size_t offset = kMinSize;
size_t i = 0;
for (; i < report_count && offset + sizeof(ssrc) <= size; ++i) {

View File

@ -622,7 +622,7 @@ class RtcpBye : public RtcpHeader {
public:
friend class RtcpHeader;
/* 变长根据count决定有多少个ssrc */
uint32_t ssrc;
uint32_t ssrc[1];
/** 中间可能有若干个 ssrc **/

View File

@ -149,7 +149,7 @@ string FCI_REMB::dumpString() const {
for (auto &ssrc : ((FCI_REMB *) this)->getSSRC()) {
printer << ssrc << " ";
}
return printer;
return std::move(printer);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -130,7 +130,7 @@ static bool isOneByteExt<RtpExtOneByte>(){
}
template<typename Type>
static void appendExt(map<uint8_t, RtpExt> &ret, uint8_t *ptr, const uint8_t *end) {
void appendExt(map<uint8_t, RtpExt> &ret, uint8_t *ptr, const uint8_t *end) {
while (ptr < end) {
auto ext = reinterpret_cast<Type *>(ptr);
if (ext->getId() == (uint8_t) RtpExtType::padding) {
@ -191,7 +191,7 @@ map<uint8_t/*id*/, RtpExt/*data*/> RtpExt::getExtValue(const RtpHeader *header)
XX(encrypt, "urn:ietf:params:rtp-hdrext:encrypt")
#define XX(type, url) {RtpExtType::type , url},
static unordered_map<RtpExtType/*id*/, string/*ext*/> s_type_to_url = {RTP_EXT_MAP(XX)};
static map<RtpExtType/*id*/, string/*ext*/> s_type_to_url = {RTP_EXT_MAP(XX)};
#undef XX
@ -353,7 +353,7 @@ uint32_t RtpExt::getAbsSendTime() const {
uint16_t RtpExt::getTransportCCSeq() const {
CHECK(_type == RtpExtType::transport_cc && size() >= 2);
uint16_t ret;
ret |= (*this)[0] << 8;
ret = (*this)[0] << 8;
ret |= (*this)[1];
return ret;
}

View File

@ -667,7 +667,7 @@ static void changeRtpExtId(const RtpPacket::Ptr &rtp, const Type &map) {
auto header = rtp->getHeader();
auto ext_map = RtpExt::getExtValue(header);
for (auto &pr : ext_map) {
auto it = map.find((Type::key_type) pr.first);
auto it = map.find((typename Type::key_type) (pr.first));
if (it == map.end()) {
WarnL << "未处理的rtp ext, 类型不识别:" << (int) pr.first;
pr.second.clearExt();

View File

@ -226,7 +226,7 @@ private:
//根据推流端rtcp的ssrc获取相关信息
unordered_map<uint32_t, RtpPayloadInfo*> _rtp_info_ssrc;
//发送rtp时需要修改rtp ext id
unordered_map<RtpExtType, uint8_t> _rtp_ext_type_to_id;
map<RtpExtType, uint8_t> _rtp_ext_type_to_id;
//接收rtp时需要修改rtp ext id
unordered_map<uint8_t, RtpExtType> _rtp_ext_id_to_type;
};