优化代码

整理代码
This commit is contained in:
xiongziliang 2022-11-12 21:59:48 +08:00
parent 6ffbcbfde5
commit 946945ce7b
16 changed files with 22 additions and 40 deletions

View File

@ -1,12 +0,0 @@
language: cpp
sudo: required
dist: trusty
compiler:
- clang
os:
- linux
script:
- ./build_for_linux.sh

@ -1 +1 @@
Subproject commit 844b866368fcbc4547c36474cc9d36479350bda3
Subproject commit 21fdfe4a6553356f1b01f7dde326535ba23aef45

View File

@ -1 +0,0 @@
theme: jekyll-theme-cayman

View File

@ -57,8 +57,8 @@ public:
~NotImplemented() override = default;
};
MediaSourceEvent() {};
virtual ~MediaSourceEvent() {};
MediaSourceEvent() = default;
virtual ~MediaSourceEvent() = default;
// 获取媒体源类型
virtual MediaOriginType getOriginType(MediaSource &sender) const { return MediaOriginType::unknown; }

View File

@ -41,7 +41,7 @@
#endif
#ifndef CHECK
#define CHECK(exp, ...) mediakit::Assert_ThrowCpp(!(exp), #exp, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__)
#define CHECK(exp, ...) ::mediakit::Assert_ThrowCpp(!(exp), #exp, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__)
#endif // CHECK
#ifndef MAX

View File

@ -19,8 +19,6 @@ using namespace toolkit;
namespace mediakit {
MP4Muxer::MP4Muxer() {}
MP4Muxer::~MP4Muxer() {
closeMP4();
}
@ -64,7 +62,7 @@ bool MP4MuxerInterface::haveVideo() const {
uint64_t MP4MuxerInterface::getDuration() const {
uint64_t ret = 0;
for (auto &pr : _codec_to_trackid) {
if (pr.second.stamp.getRelativeStamp() > ret) {
if (pr.second.stamp.getRelativeStamp() > (int64_t)ret) {
ret = pr.second.stamp.getRelativeStamp();
}
}

View File

@ -90,7 +90,7 @@ class MP4Muxer : public MP4MuxerInterface{
public:
typedef std::shared_ptr<MP4Muxer> Ptr;
MP4Muxer();
MP4Muxer() = default;
~MP4Muxer() override;
/**

View File

@ -13,7 +13,7 @@
#if defined(ENABLE_HLS) || defined(ENABLE_RTPPROXY)
#include "mpeg-ts-proto.h"
#include "mpeg-ts.h"
#include "mpeg-muxer.h"
using namespace toolkit;

View File

@ -56,8 +56,8 @@ protected:
class RtmpCodec : public RtmpRing, public FrameDispatcher , public CodecInfo{
public:
typedef std::shared_ptr<RtmpCodec> Ptr;
RtmpCodec(){}
virtual ~RtmpCodec(){}
RtmpCodec() = default;
~RtmpCodec() override = default;
virtual void makeConfigPacket() {};
};

View File

@ -18,7 +18,7 @@
namespace mediakit{
class RtmpMuxer : public MediaSinkInterface{
class RtmpMuxer : public MediaSinkInterface {
public:
typedef std::shared_ptr<RtmpMuxer> Ptr;
@ -26,7 +26,7 @@ public:
*
*/
RtmpMuxer(const TitleMeta::Ptr &title);
virtual ~RtmpMuxer(){}
~RtmpMuxer() override = default;
/**
* SDP字符串

View File

@ -19,8 +19,6 @@ using namespace toolkit;
namespace mediakit{
RtpServer::RtpServer() {}
RtpServer::~RtpServer() {
if (_on_cleanup) {
_on_cleanup();

View File

@ -31,7 +31,7 @@ public:
using onRecv = std::function<void(const toolkit::Buffer::Ptr &buf)>;
enum TcpMode { NONE = 0, PASSIVE, ACTIVE };
RtpServer();
RtpServer() = default;
~RtpServer();
/**

View File

@ -24,7 +24,7 @@ namespace mediakit{
class MultiCastAddressMaker {
public:
~MultiCastAddressMaker() {}
~MultiCastAddressMaker() = default;
static MultiCastAddressMaker& Instance();
static bool isMultiCastAddress(uint32_t addr);
static std::string toString(uint32_t addr);
@ -32,7 +32,7 @@ public:
std::shared_ptr<uint32_t> obtain(uint32_t max_try = 10);
private:
MultiCastAddressMaker() {};
MultiCastAddressMaker() = default;
void release(uint32_t addr);
private:

View File

@ -22,7 +22,7 @@ class RingDelegateHelper : public toolkit::RingDelegate<RtpPacket::Ptr> {
public:
using onRtp = std::function<void(RtpPacket::Ptr in, bool is_key)> ;
~RingDelegateHelper() override {}
~RingDelegateHelper() override = default;
RingDelegateHelper(onRtp on_rtp) {
_on_rtp = std::move(on_rtp);
@ -39,7 +39,7 @@ private:
/**
* rtsp生成器
*/
class RtspMuxer : public MediaSinkInterface{
class RtspMuxer : public MediaSinkInterface {
public:
using Ptr = std::shared_ptr<RtspMuxer>;
@ -47,8 +47,7 @@ public:
*
*/
RtspMuxer(const TitleSdp::Ptr &title = nullptr);
virtual ~RtspMuxer(){}
~RtspMuxer() override = default;
/**
* SDP字符串

View File

@ -37,7 +37,7 @@ public:
using Ptr = std::shared_ptr<BufferRtp>;
BufferRtp(Buffer::Ptr pkt, size_t offset = 0) : _offset(offset), _rtp(std::move(pkt)) {}
~BufferRtp() override {}
~BufferRtp() override = default;
char *data() const override {
return (char *)_rtp->data() + _offset;

View File

@ -407,9 +407,9 @@ void SrtTransport::handleDropReq(uint8_t *buf, int len, struct sockaddr_storage
if (list.empty()) {
return;
}
uint32_t max_seq = 0;
// uint32_t max_seq = 0;
for (auto& data : list) {
max_seq = data->packet_seq_number;
// max_seq = data->packet_seq_number;
if (_last_pkt_seq + 1 != data->packet_seq_number) {
TraceL << "pkt lost " << _last_pkt_seq + 1 << "->" << data->packet_seq_number;
}
@ -620,9 +620,9 @@ void SrtTransport::handleDataPacket(uint8_t *buf, int len, struct sockaddr_stora
if (list.empty()) {
// when no data ok send nack to sender immediately
} else {
uint32_t last_seq;
// uint32_t last_seq;
for (auto& data : list) {
last_seq = data->packet_seq_number;
// last_seq = data->packet_seq_number;
if (_last_pkt_seq + 1 != data->packet_seq_number) {
TraceL << "pkt lost " << _last_pkt_seq + 1 << "->" << data->packet_seq_number;
}