Commit 946945ce by xiongziliang

优化代码

整理代码
parent 6ffbcbfd
language: cpp
sudo: required
dist: trusty
compiler:
- clang
os:
- linux
script:
- ./build_for_linux.sh
ZLToolKit @ 21fdfe4a
Subproject commit 844b866368fcbc4547c36474cc9d36479350bda3
Subproject commit 21fdfe4a6553356f1b01f7dde326535ba23aef45
theme: jekyll-theme-cayman
\ No newline at end of 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; }
......
......@@ -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
......
......@@ -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();
}
}
......
......@@ -90,7 +90,7 @@ class MP4Muxer : public MP4MuxerInterface{
public:
typedef std::shared_ptr<MP4Muxer> Ptr;
MP4Muxer();
MP4Muxer() = default;
~MP4Muxer() override;
/**
......
......@@ -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;
......
......@@ -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() {};
};
......
......@@ -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字符串
......
......@@ -19,8 +19,6 @@ using namespace toolkit;
namespace mediakit{
RtpServer::RtpServer() {}
RtpServer::~RtpServer() {
if (_on_cleanup) {
_on_cleanup();
......
......@@ -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();
/**
......
......@@ -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:
......
......@@ -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字符串
......
......@@ -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;
......
......@@ -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;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论