diff --git a/api/source/mk_player.cpp b/api/source/mk_player.cpp index 078f7140..82adc411 100755 --- a/api/source/mk_player.cpp +++ b/api/source/mk_player.cpp @@ -24,7 +24,7 @@ public: MediaPlayerForC(){ _player = std::make_shared(); } - ~MediaPlayerForC(){} + ~MediaPlayerForC() = default; MediaPlayer *operator->(){ return _player.get(); diff --git a/server/main.cpp b/server/main.cpp index 27f0b422..3b5dfe2c 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -260,16 +260,16 @@ int start_main(int argc,char *argv[]) { auto shellSrv = std::make_shared(); //rtsp[s]服务器, 可用于诸如亚马逊echo show这样的设备访问 - auto rtspSrv = std::make_shared();; - auto rtspSSLSrv = std::make_shared();; + auto rtspSrv = std::make_shared(); + auto rtspSSLSrv = std::make_shared(); //rtmp[s]服务器 - auto rtmpSrv = std::make_shared();; - auto rtmpsSrv = std::make_shared();; + auto rtmpSrv = std::make_shared(); + auto rtmpsSrv = std::make_shared(); //http[s]服务器 - auto httpSrv = std::make_shared();; - auto httpsSrv = std::make_shared();; + auto httpSrv = std::make_shared(); + auto httpsSrv = std::make_shared(); #if defined(ENABLE_RTPPROXY) //GB28181 rtp推流端口,支持UDP/TCP diff --git a/src/Extension/Track.h b/src/Extension/Track.h index c2fe2477..e7aa2b7c 100644 --- a/src/Extension/Track.h +++ b/src/Extension/Track.h @@ -24,9 +24,8 @@ namespace mediakit{ class Track : public FrameDispatcher , public CodecInfo{ public: using Ptr = std::shared_ptr; - Track(){} - - virtual ~Track(){} + Track() = default; + virtual ~Track() = default; /** * 是否准备好,准备好才能获取譬如sps pps等信息 @@ -177,8 +176,8 @@ private: class TrackSource{ public: - TrackSource(){} - virtual ~TrackSource(){} + TrackSource() = default; + virtual ~TrackSource() = default; /** * 获取全部的Track diff --git a/src/Http/HttpBody.cpp b/src/Http/HttpBody.cpp index faa6a3a0..a2442750 100644 --- a/src/Http/HttpBody.cpp +++ b/src/Http/HttpBody.cpp @@ -189,7 +189,7 @@ public: _data = map_addr.get() + offset; _size = size; } - ~BufferMmap() override {}; + ~BufferMmap() override = default; //返回数据长度 char *data() const override { return _data; } size_t size() const override { return _size; } diff --git a/src/Http/HttpBody.h b/src/Http/HttpBody.h index 51052a8e..a23de2b1 100644 --- a/src/Http/HttpBody.h +++ b/src/Http/HttpBody.h @@ -30,9 +30,9 @@ namespace mediakit { class HttpBody : public std::enable_shared_from_this{ public: using Ptr = std::shared_ptr; - HttpBody(){} + HttpBody() = default; - virtual ~HttpBody(){} + virtual ~HttpBody() = default; /** * 剩余数据大小,如果返回-1, 那么就不设置content-length @@ -151,7 +151,7 @@ public: * @param boundary boundary字符串 */ HttpMultiFormBody(const HttpArgs &args,const std::string &filePath,const std::string &boundary = "0xKhTmLbOuNdArY"); - virtual ~HttpMultiFormBody(){} + virtual ~HttpMultiFormBody() = default; int64_t remainSize() override ; toolkit::Buffer::Ptr readData(size_t size) override; diff --git a/src/Http/HttpCookie.h b/src/Http/HttpCookie.h index cf478f5c..60e3fbcb 100644 --- a/src/Http/HttpCookie.h +++ b/src/Http/HttpCookie.h @@ -27,8 +27,8 @@ class HttpCookie { public: using Ptr = std::shared_ptr; friend class HttpCookieStorage; - HttpCookie(){} - ~HttpCookie(){} + HttpCookie() = default; + ~HttpCookie() = default; void setPath(const std::string &path); void setHost(const std::string &host); @@ -52,12 +52,14 @@ private: */ class HttpCookieStorage{ public: - ~HttpCookieStorage(){} + ~HttpCookieStorage() = default; static HttpCookieStorage &Instance(); void set(const HttpCookie::Ptr &cookie); std::vector get(const std::string &host,const std::string &path); + private: - HttpCookieStorage(){}; + HttpCookieStorage() = default; + private: std::unordered_map > > _all_cookie; std::mutex _mtx_cookie; diff --git a/src/Http/HttpFileManager.h b/src/Http/HttpFileManager.h index d30b89b3..330b9fa1 100644 --- a/src/Http/HttpFileManager.h +++ b/src/Http/HttpFileManager.h @@ -24,8 +24,8 @@ public: typedef std::function HttpResponseInvokerLambda0; typedef std::function HttpResponseInvokerLambda1; - HttpResponseInvokerImp(){} - ~HttpResponseInvokerImp(){} + HttpResponseInvokerImp() = default; + ~HttpResponseInvokerImp() = default; template HttpResponseInvokerImp(const C &c):HttpResponseInvokerImp(typename toolkit::function_traits::stl_function_type(c)) {} HttpResponseInvokerImp(const HttpResponseInvokerLambda0 &lambda); diff --git a/src/Http/HttpRequestSplitter.h b/src/Http/HttpRequestSplitter.h index a36fdf6b..5ad78bea 100644 --- a/src/Http/HttpRequestSplitter.h +++ b/src/Http/HttpRequestSplitter.h @@ -18,8 +18,8 @@ namespace mediakit { class HttpRequestSplitter { public: - HttpRequestSplitter(){}; - virtual ~HttpRequestSplitter(){}; + HttpRequestSplitter() = default; + virtual ~HttpRequestSplitter() = default; /** * 添加数据 diff --git a/src/Http/WebSocketClient.h b/src/Http/WebSocketClient.h index c5230800..737ebcda 100644 --- a/src/Http/WebSocketClient.h +++ b/src/Http/WebSocketClient.h @@ -37,7 +37,7 @@ public: template ClientTypeImp(ArgsType &&...args) : ClientType(std::forward(args)...) {} - ~ClientTypeImp() override {}; + ~ClientTypeImp() override = default; protected: /** diff --git a/src/Http/WebSocketSession.h b/src/Http/WebSocketSession.h index 83d7da73..c8d8b432 100644 --- a/src/Http/WebSocketSession.h +++ b/src/Http/WebSocketSession.h @@ -82,7 +82,7 @@ template,HttpSessionType,DataType>{ public: WebSocketSession(const toolkit::Socket::Ptr &pSock) : WebSocketSessionBase,HttpSessionType,DataType>(pSock){} - virtual ~WebSocketSession(){} + virtual ~WebSocketSession() = default; }; #endif //ZLMEDIAKIT_WEBSOCKETSESSION_H diff --git a/src/Http/WebSocketSplitter.h b/src/Http/WebSocketSplitter.h index ee29f447..72b71664 100644 --- a/src/Http/WebSocketSplitter.h +++ b/src/Http/WebSocketSplitter.h @@ -51,7 +51,7 @@ public: //根据内存地址设置掩码随机数 _mask.assign((uint8_t*)(&ptr), (uint8_t*)(&ptr) + 4); } - virtual ~WebSocketHeader(){} + virtual ~WebSocketHeader() = default; public: bool _fin; @@ -71,7 +71,7 @@ public: WebSocketBuffer(WebSocketHeader::Type headType, bool fin, ARGS &&...args) : toolkit::BufferString(std::forward(args)...), _fin(fin), _head_type(headType){} - ~WebSocketBuffer() override {} + ~WebSocketBuffer() override = default; WebSocketHeader::Type headType() const { return _head_type; } @@ -84,8 +84,8 @@ private: class WebSocketSplitter : public WebSocketHeader{ public: - WebSocketSplitter(){} - virtual ~WebSocketSplitter(){} + WebSocketSplitter() = default; + virtual ~WebSocketSplitter() = default; /** * 输入数据以便解包webSocket数据以及处理粘包问题 diff --git a/src/Record/MPEG.h b/src/Record/MPEG.h index 86a5b93f..4cb456db 100644 --- a/src/Record/MPEG.h +++ b/src/Record/MPEG.h @@ -86,7 +86,7 @@ namespace mediakit { class MpegMuxer : public MediaSinkInterface { public: - MpegMuxer(bool is_ps) {}; + MpegMuxer(bool is_ps) = default; ~MpegMuxer() override = default; bool addTrack(const Track::Ptr &track) override { return false; } void resetTracks() override {} diff --git a/src/Rtcp/Rtcp.cpp b/src/Rtcp/Rtcp.cpp index 30060c03..a31df64d 100644 --- a/src/Rtcp/Rtcp.cpp +++ b/src/Rtcp/Rtcp.cpp @@ -242,11 +242,9 @@ vector RtcpHeader::loadFromBytes(char *data, size_t len) { class BufferRtcp : public Buffer { public: BufferRtcp(std::shared_ptr rtcp) { _rtcp = std::move(rtcp); } - - ~BufferRtcp() override {} + ~BufferRtcp() override = default; char *data() const override { return (char *)_rtcp.get(); } - size_t size() const override { return _rtcp->getSize(); } private: diff --git a/src/Rtmp/Rtmp.h b/src/Rtmp/Rtmp.h index 3f01e088..55802549 100644 --- a/src/Rtmp/Rtmp.h +++ b/src/Rtmp/Rtmp.h @@ -207,8 +207,8 @@ class Metadata : public CodecInfo{ public: using Ptr = std::shared_ptr; - Metadata():_metadata(AMF_OBJECT){} - virtual ~Metadata(){} + Metadata(): _metadata(AMF_OBJECT) {} + virtual ~Metadata() = default; const AMFValue &getMetadata() const{ return _metadata; } @@ -239,7 +239,7 @@ public: using Ptr = std::shared_ptr; VideoMeta(const VideoTrack::Ptr &video); - virtual ~VideoMeta(){} + virtual ~VideoMeta() = default; CodecId getCodecId() const override{ return _codecId; @@ -253,8 +253,7 @@ public: using Ptr = std::shared_ptr; AudioMeta(const AudioTrack::Ptr &audio); - - virtual ~AudioMeta(){} + virtual ~AudioMeta() = default; CodecId getCodecId() const override{ return _codecId; diff --git a/src/Rtmp/RtmpProtocol.cpp b/src/Rtmp/RtmpProtocol.cpp index a4899d66..386f5205 100644 --- a/src/Rtmp/RtmpProtocol.cpp +++ b/src/Rtmp/RtmpProtocol.cpp @@ -181,13 +181,13 @@ void RtmpProtocol::sendRequest(int cmd, const string& str) { class BufferPartial : public Buffer { public: - BufferPartial(const Buffer::Ptr &buffer, size_t offset, size_t size){ + BufferPartial(const Buffer::Ptr &buffer, size_t offset, size_t size) { _buffer = buffer; _data = buffer->data() + offset; _size = size; } - ~BufferPartial() override{} + ~BufferPartial() override = default; char *data() const override { return _data; diff --git a/src/Rtp/RtpSplitter.cpp b/src/Rtp/RtpSplitter.cpp index 594d689b..f7175b30 100644 --- a/src/Rtp/RtpSplitter.cpp +++ b/src/Rtp/RtpSplitter.cpp @@ -13,12 +13,8 @@ #include "RtpSplitter.h" namespace mediakit{ -static const char kEHOME_MAGIC[] = "\x01\x00\x01\x00"; static const int kEHOME_OFFSET = 256; -RtpSplitter::RtpSplitter() {} -RtpSplitter::~RtpSplitter() {} - ssize_t RtpSplitter::onRecvHeader(const char *data,size_t len){ //忽略偏移量 data += _offset; @@ -38,11 +34,10 @@ static bool isEhome(const char *data, size_t len){ if (len < 4) { return false; } - if((data[0] == 0x01) && (data[1] == 0x00) && (data[2] >=0x01)){ + if ((data[0] == 0x01) && (data[1] == 0x00) && (data[2] >= 0x01)) { return true; } return false; - //return memcmp(data, kEHOME_MAGIC, sizeof(kEHOME_MAGIC) - 1) == 0; } const char *RtpSplitter::onSearchPacketTail(const char *data, size_t len) { diff --git a/src/Rtp/RtpSplitter.h b/src/Rtp/RtpSplitter.h index 5e0c51e6..9401691e 100644 --- a/src/Rtp/RtpSplitter.h +++ b/src/Rtp/RtpSplitter.h @@ -18,8 +18,8 @@ namespace mediakit{ class RtpSplitter : public HttpRequestSplitter{ public: - RtpSplitter(); - ~RtpSplitter() override; + RtpSplitter() = default; + ~RtpSplitter() override = default; protected: /** diff --git a/src/Rtp/TSDecoder.h b/src/Rtp/TSDecoder.h index d693827e..fb306502 100644 --- a/src/Rtp/TSDecoder.h +++ b/src/Rtp/TSDecoder.h @@ -25,7 +25,7 @@ class TSSegment : public HttpRequestSplitter { public: typedef std::function onSegment; TSSegment(size_t size = TS_PACKET_SIZE) : _size(size){} - ~TSSegment(){} + ~TSSegment() = default; void setOnSegment(onSegment cb); static bool isTSPacket(const char *data, size_t len); diff --git a/src/Rtsp/RtpCodec.h b/src/Rtsp/RtpCodec.h index 141f34da..b1acde58 100644 --- a/src/Rtsp/RtpCodec.h +++ b/src/Rtsp/RtpCodec.h @@ -74,7 +74,7 @@ public: _interleaved = interleaved; } - virtual ~RtpInfo() {} + virtual ~RtpInfo() = default; //返回rtp负载最大长度 size_t getMaxSize() const { diff --git a/src/Rtsp/Rtsp.h b/src/Rtsp/Rtsp.h index 5e7370c6..6bb19d8d 100644 --- a/src/Rtsp/Rtsp.h +++ b/src/Rtsp/Rtsp.h @@ -237,9 +237,9 @@ class SdpParser { public: using Ptr = std::shared_ptr; - SdpParser() {} + SdpParser() = default; SdpParser(const std::string &sdp) { load(sdp); } - ~SdpParser() {} + ~SdpParser() = default; void load(const std::string &sdp); bool available() const; @@ -268,7 +268,7 @@ public: _payload_type = payload_type; } - virtual ~Sdp(){} + virtual ~Sdp() = default; /** * 获取sdp字符串 diff --git a/src/Rtsp/RtspSplitter.h b/src/Rtsp/RtspSplitter.h index ab310eb4..ca9daed2 100644 --- a/src/Rtsp/RtspSplitter.h +++ b/src/Rtsp/RtspSplitter.h @@ -18,8 +18,8 @@ namespace mediakit{ class RtspSplitter : public HttpRequestSplitter{ public: - RtspSplitter(){} - virtual ~RtspSplitter(){} + RtspSplitter() = default; + virtual ~RtspSplitter() = default; /** * 是否允许接收rtp包