mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 04:08:57 +08:00
优化代码
整理代码
This commit is contained in:
parent
6ffbcbfde5
commit
946945ce7b
12
.travis.yml
12
.travis.yml
@ -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
|
@ -1 +0,0 @@
|
|||||||
theme: jekyll-theme-cayman
|
|
@ -57,8 +57,8 @@ public:
|
|||||||
~NotImplemented() override = default;
|
~NotImplemented() override = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
MediaSourceEvent() {};
|
MediaSourceEvent() = default;
|
||||||
virtual ~MediaSourceEvent() {};
|
virtual ~MediaSourceEvent() = default;
|
||||||
|
|
||||||
// 获取媒体源类型
|
// 获取媒体源类型
|
||||||
virtual MediaOriginType getOriginType(MediaSource &sender) const { return MediaOriginType::unknown; }
|
virtual MediaOriginType getOriginType(MediaSource &sender) const { return MediaOriginType::unknown; }
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CHECK
|
#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
|
#endif // CHECK
|
||||||
|
|
||||||
#ifndef MAX
|
#ifndef MAX
|
||||||
|
@ -19,8 +19,6 @@ using namespace toolkit;
|
|||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
MP4Muxer::MP4Muxer() {}
|
|
||||||
|
|
||||||
MP4Muxer::~MP4Muxer() {
|
MP4Muxer::~MP4Muxer() {
|
||||||
closeMP4();
|
closeMP4();
|
||||||
}
|
}
|
||||||
@ -64,7 +62,7 @@ bool MP4MuxerInterface::haveVideo() const {
|
|||||||
uint64_t MP4MuxerInterface::getDuration() const {
|
uint64_t MP4MuxerInterface::getDuration() const {
|
||||||
uint64_t ret = 0;
|
uint64_t ret = 0;
|
||||||
for (auto &pr : _codec_to_trackid) {
|
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();
|
ret = pr.second.stamp.getRelativeStamp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class MP4Muxer : public MP4MuxerInterface{
|
|||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<MP4Muxer> Ptr;
|
typedef std::shared_ptr<MP4Muxer> Ptr;
|
||||||
|
|
||||||
MP4Muxer();
|
MP4Muxer() = default;
|
||||||
~MP4Muxer() override;
|
~MP4Muxer() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#if defined(ENABLE_HLS) || defined(ENABLE_RTPPROXY)
|
#if defined(ENABLE_HLS) || defined(ENABLE_RTPPROXY)
|
||||||
|
|
||||||
#include "mpeg-ts-proto.h"
|
#include "mpeg-ts.h"
|
||||||
#include "mpeg-muxer.h"
|
#include "mpeg-muxer.h"
|
||||||
|
|
||||||
using namespace toolkit;
|
using namespace toolkit;
|
||||||
|
@ -56,8 +56,8 @@ protected:
|
|||||||
class RtmpCodec : public RtmpRing, public FrameDispatcher , public CodecInfo{
|
class RtmpCodec : public RtmpRing, public FrameDispatcher , public CodecInfo{
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<RtmpCodec> Ptr;
|
typedef std::shared_ptr<RtmpCodec> Ptr;
|
||||||
RtmpCodec(){}
|
RtmpCodec() = default;
|
||||||
virtual ~RtmpCodec(){}
|
~RtmpCodec() override = default;
|
||||||
virtual void makeConfigPacket() {};
|
virtual void makeConfigPacket() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace mediakit{
|
namespace mediakit{
|
||||||
|
|
||||||
class RtmpMuxer : public MediaSinkInterface{
|
class RtmpMuxer : public MediaSinkInterface {
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<RtmpMuxer> Ptr;
|
typedef std::shared_ptr<RtmpMuxer> Ptr;
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ public:
|
|||||||
* 构造函数
|
* 构造函数
|
||||||
*/
|
*/
|
||||||
RtmpMuxer(const TitleMeta::Ptr &title);
|
RtmpMuxer(const TitleMeta::Ptr &title);
|
||||||
virtual ~RtmpMuxer(){}
|
~RtmpMuxer() override = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完整的SDP字符串
|
* 获取完整的SDP字符串
|
||||||
|
@ -19,8 +19,6 @@ using namespace toolkit;
|
|||||||
|
|
||||||
namespace mediakit{
|
namespace mediakit{
|
||||||
|
|
||||||
RtpServer::RtpServer() {}
|
|
||||||
|
|
||||||
RtpServer::~RtpServer() {
|
RtpServer::~RtpServer() {
|
||||||
if (_on_cleanup) {
|
if (_on_cleanup) {
|
||||||
_on_cleanup();
|
_on_cleanup();
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
using onRecv = std::function<void(const toolkit::Buffer::Ptr &buf)>;
|
using onRecv = std::function<void(const toolkit::Buffer::Ptr &buf)>;
|
||||||
enum TcpMode { NONE = 0, PASSIVE, ACTIVE };
|
enum TcpMode { NONE = 0, PASSIVE, ACTIVE };
|
||||||
|
|
||||||
RtpServer();
|
RtpServer() = default;
|
||||||
~RtpServer();
|
~RtpServer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ namespace mediakit{
|
|||||||
|
|
||||||
class MultiCastAddressMaker {
|
class MultiCastAddressMaker {
|
||||||
public:
|
public:
|
||||||
~MultiCastAddressMaker() {}
|
~MultiCastAddressMaker() = default;
|
||||||
static MultiCastAddressMaker& Instance();
|
static MultiCastAddressMaker& Instance();
|
||||||
static bool isMultiCastAddress(uint32_t addr);
|
static bool isMultiCastAddress(uint32_t addr);
|
||||||
static std::string toString(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);
|
std::shared_ptr<uint32_t> obtain(uint32_t max_try = 10);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MultiCastAddressMaker() {};
|
MultiCastAddressMaker() = default;
|
||||||
void release(uint32_t addr);
|
void release(uint32_t addr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -22,7 +22,7 @@ class RingDelegateHelper : public toolkit::RingDelegate<RtpPacket::Ptr> {
|
|||||||
public:
|
public:
|
||||||
using onRtp = std::function<void(RtpPacket::Ptr in, bool is_key)> ;
|
using onRtp = std::function<void(RtpPacket::Ptr in, bool is_key)> ;
|
||||||
|
|
||||||
~RingDelegateHelper() override {}
|
~RingDelegateHelper() override = default;
|
||||||
|
|
||||||
RingDelegateHelper(onRtp on_rtp) {
|
RingDelegateHelper(onRtp on_rtp) {
|
||||||
_on_rtp = std::move(on_rtp);
|
_on_rtp = std::move(on_rtp);
|
||||||
@ -39,7 +39,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* rtsp生成器
|
* rtsp生成器
|
||||||
*/
|
*/
|
||||||
class RtspMuxer : public MediaSinkInterface{
|
class RtspMuxer : public MediaSinkInterface {
|
||||||
public:
|
public:
|
||||||
using Ptr = std::shared_ptr<RtspMuxer>;
|
using Ptr = std::shared_ptr<RtspMuxer>;
|
||||||
|
|
||||||
@ -47,8 +47,7 @@ public:
|
|||||||
* 构造函数
|
* 构造函数
|
||||||
*/
|
*/
|
||||||
RtspMuxer(const TitleSdp::Ptr &title = nullptr);
|
RtspMuxer(const TitleSdp::Ptr &title = nullptr);
|
||||||
|
~RtspMuxer() override = default;
|
||||||
virtual ~RtspMuxer(){}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完整的SDP字符串
|
* 获取完整的SDP字符串
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
using Ptr = std::shared_ptr<BufferRtp>;
|
using Ptr = std::shared_ptr<BufferRtp>;
|
||||||
|
|
||||||
BufferRtp(Buffer::Ptr pkt, size_t offset = 0) : _offset(offset), _rtp(std::move(pkt)) {}
|
BufferRtp(Buffer::Ptr pkt, size_t offset = 0) : _offset(offset), _rtp(std::move(pkt)) {}
|
||||||
~BufferRtp() override {}
|
~BufferRtp() override = default;
|
||||||
|
|
||||||
char *data() const override {
|
char *data() const override {
|
||||||
return (char *)_rtp->data() + _offset;
|
return (char *)_rtp->data() + _offset;
|
||||||
|
@ -407,9 +407,9 @@ void SrtTransport::handleDropReq(uint8_t *buf, int len, struct sockaddr_storage
|
|||||||
if (list.empty()) {
|
if (list.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t max_seq = 0;
|
// uint32_t max_seq = 0;
|
||||||
for (auto& data : list) {
|
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) {
|
if (_last_pkt_seq + 1 != data->packet_seq_number) {
|
||||||
TraceL << "pkt lost " << _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()) {
|
if (list.empty()) {
|
||||||
// when no data ok send nack to sender immediately
|
// when no data ok send nack to sender immediately
|
||||||
} else {
|
} else {
|
||||||
uint32_t last_seq;
|
// uint32_t last_seq;
|
||||||
for (auto& data : list) {
|
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) {
|
if (_last_pkt_seq + 1 != data->packet_seq_number) {
|
||||||
TraceL << "pkt lost " << _last_pkt_seq + 1 << "->" << data->packet_seq_number;
|
TraceL << "pkt lost " << _last_pkt_seq + 1 << "->" << data->packet_seq_number;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user