diff --git a/api/source/mk_common.cpp b/api/source/mk_common.cpp index 2dba1914..3e3f5ecc 100644 --- a/api/source/mk_common.cpp +++ b/api/source/mk_common.cpp @@ -327,6 +327,7 @@ API_EXPORT uint16_t API_CALL mk_ice_server_start(uint16_t port){ iceServer_udp = std::make_shared(); iceServer_udp->start(port); iceServer_tcp->start(port); + return 0; } catch (std::exception &ex) { iceServer_udp = nullptr; iceServer_tcp = nullptr; diff --git a/ext-codec/AV1.h b/ext-codec/AV1.h index 4e3d16a9..dcf9d1b6 100644 --- a/ext-codec/AV1.h +++ b/ext-codec/AV1.h @@ -57,7 +57,7 @@ public: toolkit::Buffer::Ptr getExtraData() const override; void setExtraData(const uint8_t *data, size_t size) override; protected: - aom_av1_t _context = {0}; + aom_av1_t _context {}; }; } // namespace mediakit diff --git a/ext-codec/G711.cpp b/ext-codec/G711.cpp index 4739a588..c4bf255f 100644 --- a/ext-codec/G711.cpp +++ b/ext-codec/G711.cpp @@ -20,7 +20,7 @@ using namespace toolkit; namespace mediakit { Buffer::Ptr G711Track::getExtraData() const { - struct wave_format_t wav = {0}; + struct wave_format_t wav {}; wav.wFormatTag = getCodecId() == CodecG711A ? WAVE_FORMAT_ALAW : WAVE_FORMAT_MULAW; wav.nChannels = getAudioChannel(); wav.nSamplesPerSec = getAudioSampleRate(); diff --git a/ext-codec/Opus.cpp b/ext-codec/Opus.cpp index 4a34187d..271bd926 100644 --- a/ext-codec/Opus.cpp +++ b/ext-codec/Opus.cpp @@ -28,7 +28,7 @@ void OpusTrack::setExtraData(const uint8_t *data, size_t size) { } Buffer::Ptr OpusTrack::getExtraData() const { - struct opus_head_t opus = { 0 }; + struct opus_head_t opus {}; opus.version = 1; opus.channels = getAudioChannel(); opus.input_sample_rate = getAudioSampleRate(); diff --git a/ext-codec/VP8.h b/ext-codec/VP8.h index 7bdb041b..10009456 100644 --- a/ext-codec/VP8.h +++ b/ext-codec/VP8.h @@ -41,7 +41,7 @@ public: toolkit::Buffer::Ptr getExtraData() const override; void setExtraData(const uint8_t *data, size_t size) override; private: - webm_vpx_t _vpx = {0}; + webm_vpx_t _vpx {}; }; } // namespace mediakit diff --git a/ext-codec/VP8Rtp.cpp b/ext-codec/VP8Rtp.cpp index 4d0ad97e..3f0760ae 100644 --- a/ext-codec/VP8Rtp.cpp +++ b/ext-codec/VP8Rtp.cpp @@ -334,7 +334,7 @@ bool VP8RtpEncoder::inputFrame(const Frame::Ptr &frame) { bool key = frame->keyFrame(); bool mark = false; for (size_t pos = 0; pos < len; pos += pdu_size) { - if (len - pos <= pdu_size) { + if (static_cast(len - pos) <= pdu_size) { pdu_size = len - pos; mark = true; } diff --git a/ext-codec/VP8Rtp.h b/ext-codec/VP8Rtp.h index af876f26..5b4dd0db 100644 --- a/ext-codec/VP8Rtp.h +++ b/ext-codec/VP8Rtp.h @@ -56,9 +56,6 @@ public: using Ptr = std::shared_ptr; bool inputFrame(const Frame::Ptr &frame) override; - -private: - uint16_t _pic_id = 0; }; }//namespace mediakit diff --git a/ext-codec/VP9.h b/ext-codec/VP9.h index d4044735..c99cd70f 100644 --- a/ext-codec/VP9.h +++ b/ext-codec/VP9.h @@ -41,7 +41,7 @@ public: toolkit::Buffer::Ptr getExtraData() const override; void setExtraData(const uint8_t *data, size_t size) override; private: - webm_vpx_t _vpx = {0}; + webm_vpx_t _vpx {}; }; } // namespace mediakit diff --git a/ext-codec/VP9Rtp.cpp b/ext-codec/VP9Rtp.cpp index f4e7397f..e4bfc8e2 100644 --- a/ext-codec/VP9Rtp.cpp +++ b/ext-codec/VP9Rtp.cpp @@ -297,7 +297,7 @@ bool VP9RtpEncoder::inputFrame(const Frame::Ptr &frame) { int pdu_size = getRtpInfo().getMaxSize() - nheader; bool mark = false; - for (size_t pos = 0; pos < len; pos += pdu_size) { + for (int pos = 0; pos < len; pos += pdu_size) { if (len - pos <= pdu_size) { pdu_size = len - pos; header[0] |= kEBit; diff --git a/src/Rtmp/Rtmp.cpp b/src/Rtmp/Rtmp.cpp index ff565f18..6e5d877b 100644 --- a/src/Rtmp/Rtmp.cpp +++ b/src/Rtmp/Rtmp.cpp @@ -60,8 +60,8 @@ uint8_t getCodecFlags(CodecId cid) { #define XX(a, b, c) case a: return static_cast(b); RTMP_CODEC_MAP(XX) #undef XX + default: return 0; } - return 0; } uint32_t getCodecFourCC(CodecId cid) { @@ -69,8 +69,8 @@ uint32_t getCodecFourCC(CodecId cid) { #define XX(a, b, c) case a: return static_cast(c); RTMP_CODEC_MAP(XX) #undef XX + default: return 0; } - return 0; } CodecId getFourccCodec(uint32_t id) { @@ -195,12 +195,10 @@ bool RtmpPacket::isConfigFrame() const { switch (type_id) { case MSG_AUDIO: { switch ((RtmpAudioCodec)getRtmpCodecId()) { - case RtmpAudioCodec::aac: - return (RtmpAACPacketType)buffer[1] == RtmpAACPacketType::aac_config_header; - case RtmpAudioCodec::ex_header: - return (RtmpPacketType)(buffer[0] & 0x0f) == RtmpPacketType::PacketTypeSequenceStart; + case RtmpAudioCodec::aac: return (RtmpAACPacketType)buffer[1] == RtmpAACPacketType::aac_config_header; + case RtmpAudioCodec::ex_header: return (RtmpPacketType)(buffer[0] & 0x0f) == RtmpPacketType::PacketTypeSequenceStart; + default: return false; } - return false; } case MSG_VIDEO: { if (!isVideoKeyFrame()) { diff --git a/tests/test_ps.cpp b/tests/test_ps.cpp index 5a78b228..62a6b621 100644 --- a/tests/test_ps.cpp +++ b/tests/test_ps.cpp @@ -64,7 +64,6 @@ public: private: MultiMediaSourceMuxer::Ptr _muxer; - uint64_t timeStamp = 0; uint64_t timeStamp_last = 0; }; diff --git a/tests/test_rtp_pcap.cpp b/tests/test_rtp_pcap.cpp index 1690b6c3..e5648d5a 100644 --- a/tests/test_rtp_pcap.cpp +++ b/tests/test_rtp_pcap.cpp @@ -83,6 +83,10 @@ struct sniff_tcp { #define TH_URG 0x20 #define TH_ECE 0x40 #define TH_CWR 0x80 + +#if defined(TH_FLAGS) +#undef TH_FLAGS +#endif #define TH_FLAGS (TH_FINTH_SYNTH_RSTTH_ACKTH_URGTH_ECETH_CWR) u_short th_win; /* TCP滑动窗口 */ u_short th_sum; /* 头部校验和 */ @@ -154,7 +158,7 @@ static bool loadFile(const char *path, const EventPoller::Ptr &poller) { return false; } auto total_size = std::make_shared(0); - struct pcap_pkthdr header = {0}; + struct pcap_pkthdr header {}; while (true) { const u_char *pkt_buff = pcap_next(handle.get(), &header); if (!pkt_buff) {