mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-25 11:12:21 +08:00
适配ZLToolKit代码,简化程序退出流程代码
This commit is contained in:
@@ -26,18 +26,14 @@
|
||||
|
||||
#include "UDPServer.h"
|
||||
#include "Util/TimeTicker.h"
|
||||
#include "Util/onceToken.h"
|
||||
|
||||
using namespace toolkit;
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
UDPServer &UDPServer::Instance() {
|
||||
static UDPServer *instance(new UDPServer());
|
||||
return *instance;
|
||||
}
|
||||
void UDPServer::Destory() {
|
||||
delete &UDPServer::Instance();
|
||||
}
|
||||
|
||||
INSTANCE_IMP(UDPServer);
|
||||
|
||||
UDPServer::UDPServer() {
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
#ifndef RTSP_UDPSERVER_H_
|
||||
#define RTSP_UDPSERVER_H_
|
||||
|
||||
#include <mutex>
|
||||
#include <stdint.h>
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include "Util/util.h"
|
||||
@@ -40,18 +41,23 @@ using namespace toolkit;
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
class UDPServer {
|
||||
class UDPServer : public std::enable_shared_from_this<UDPServer> {
|
||||
public:
|
||||
typedef function< bool(int, const Buffer::Ptr &, struct sockaddr *)> onRecvData;
|
||||
UDPServer();
|
||||
virtual ~UDPServer();
|
||||
~UDPServer();
|
||||
static UDPServer &Instance();
|
||||
static void Destory();
|
||||
|
||||
/**
|
||||
* 废弃的接口,无实际操作
|
||||
* @deprecated
|
||||
*/
|
||||
static void Destory(){};
|
||||
|
||||
Socket::Ptr getSock(const char *strLocalIp, int iTrackIndex,uint16_t iLocalPort = 0);
|
||||
void listenPeer(const char *strPeerIp, void *pSelf, const onRecvData &cb);
|
||||
void stopListenPeer(const char *strPeerIp, void *pSelf);
|
||||
private:
|
||||
UDPServer();
|
||||
void onRcvData(int iTrackId, const Buffer::Ptr &pBuf,struct sockaddr *pPeerAddr);
|
||||
void onErr(const string &strKey,const SockException &err);
|
||||
unordered_map<string, Socket::Ptr> _mapUpdSock;
|
||||
|
||||
@@ -142,7 +142,7 @@ bool H264RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WarnL << "不支持的rtp类型:" << nal.type << " " << rtppack->sequence;
|
||||
WarnL << "不支持的rtp类型:" << (int)nal.type << " " << rtppack->sequence;
|
||||
return false;
|
||||
// 29 FU-B 单NAL单元B模式
|
||||
// 24 STAP-A 单一时间的组合包
|
||||
|
||||
Reference in New Issue
Block a user