mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-05 19:08:09 +08:00
初步完成Windows下的移植
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
* Author: xzl
|
||||
*/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <list>
|
||||
#include "RtpBroadCaster.h"
|
||||
#include "Util/util.h"
|
||||
@@ -65,7 +64,7 @@ RtpBroadCaster::~RtpBroadCaster() {
|
||||
RtpBroadCaster::RtpBroadCaster(const string &strLocalIp,const string &strApp,const string &strStream) {
|
||||
auto src = RtspMediaSource::find(strApp, strStream);
|
||||
if(!src){
|
||||
auto strErr = StrPrinter << "未找到媒体源:" << strApp << " " << strStream << endl;
|
||||
auto strErr = StrPrinter << "未找到媒体源:" << strApp << " " << strStream << endl;
|
||||
throw std::runtime_error(strErr);
|
||||
}
|
||||
m_multiAddr = MultiCastAddressMaker::Instance().obtain();
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#ifndef SRC_RTSP_RTPBROADCASTER_H_
|
||||
#define SRC_RTSP_RTPBROADCASTER_H_
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
|
||||
@@ -35,7 +35,7 @@ RtpParser::RtpParser(const string& sdp) {
|
||||
RtspTrack tmp[2];
|
||||
int cnt = parserSDP(sdp, tmp);
|
||||
if (0 == cnt) {
|
||||
throw std::runtime_error("解析SDP失败!");
|
||||
throw std::runtime_error("parse sdp failed");
|
||||
}
|
||||
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
@@ -129,7 +129,7 @@ inline bool RtpParser::inputVideo(const RtpPacket& rtppack,
|
||||
|
||||
if (rtppack.sequence != (uint16_t)(m_h264frame.sequence + 1)) {
|
||||
m_h264frame.data.clear();
|
||||
WarnL << "丢包,帧废弃:" << rtppack.sequence << "," << m_h264frame.sequence;
|
||||
WarnL << "丢包,帧废弃:" << rtppack.sequence << "," << m_h264frame.sequence;
|
||||
return false;
|
||||
}
|
||||
m_h264frame.sequence = rtppack.sequence;
|
||||
@@ -204,7 +204,7 @@ inline void RtpParser::onGetVideoTrack(const RtspTrack& video) {
|
||||
|
||||
string strTmp((char *)SPS_BUF, SPS_LEN);
|
||||
if (!getAVCInfo(strTmp, m_iVideoWidth, m_iVideoHeight, m_fVideoFps)) {
|
||||
throw std::runtime_error("解析SPS失败!");
|
||||
throw std::runtime_error("parse sdp failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#include <cmath>
|
||||
#include <stdarg.h>
|
||||
#include <algorithm>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "Common/config.h"
|
||||
#include "RtspPlayer.h"
|
||||
#include "Device/base64.h"
|
||||
#include "H264/SPSParser.h"
|
||||
#include "Util/mini.h"
|
||||
#include "Util/util.h"
|
||||
#include "Network/sockutil.h"
|
||||
|
||||
using namespace ZL::Util;
|
||||
@@ -127,7 +127,7 @@ void RtspPlayer::onConnect(const SockException &err){
|
||||
teardown();
|
||||
return;
|
||||
}
|
||||
//发送DESCRIBE命令后处理函数:HandleResDESCRIBE
|
||||
//发送DESCRIBE命令后处理函数:HandleResDESCRIBE
|
||||
m_onHandshake = std::bind(&RtspPlayer::HandleResDESCRIBE,this, placeholders::_1);
|
||||
write("DESCRIBE %s RTSP/1.0\r\n"
|
||||
"CSeq: %d\r\n"
|
||||
@@ -345,9 +345,7 @@ void RtspPlayer::HandleResSETUP(const Parser& parser, unsigned int uiTrackIndex)
|
||||
return;
|
||||
}
|
||||
if(((struct sockaddr_in *)addr)->sin_addr.s_addr != srcIP) {
|
||||
char strAddr[32] = {0};
|
||||
inet_ntop(addr->sa_family,(&((struct sockaddr_in *) addr)->sin_addr),strAddr,sizeof(strAddr));
|
||||
WarnL << "收到请他地址的UDP数据:" << strAddr;
|
||||
WarnL << "收到请他地址的UDP数据:" << inet_ntoa(((struct sockaddr_in *) addr)->sin_addr);
|
||||
return;
|
||||
}
|
||||
strongSelf->HandleOneRtp(i,(unsigned char *)buf->data(),buf->size());
|
||||
@@ -404,7 +402,7 @@ void RtspPlayer::pause(bool bPause) {
|
||||
sendPause(bPause,getProgressTime());
|
||||
}
|
||||
|
||||
//注意:当字符串为空时,也会返回一个空字符串
|
||||
//注意:当字符串为空时,也会返回一个空字符串
|
||||
static void split(const string& s, const char *delim, vector<string> &ret) {
|
||||
size_t last = 0;
|
||||
size_t index = s.find_first_of(delim, last);
|
||||
@@ -573,7 +571,7 @@ inline bool RtspPlayer::HandleOneRtp(int iTrackidx, unsigned char *pucData, unsi
|
||||
WarnL << "ssrc错误";
|
||||
if (m_aui32SsrcErrorCnt[iTrackidx]++ > 10) {
|
||||
track.ssrc = rtppt.ssrc;
|
||||
WarnL << "ssrc更换!";
|
||||
WarnL << "ssrc更换!";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#ifndef SRC_RTSPPLAYER_RTSPPLAYER_H_TXT_
|
||||
#define SRC_RTSPPLAYER_RTSPPLAYER_H_TXT_
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include "Rtsp.h"
|
||||
@@ -37,7 +36,7 @@ class RtspPlayer: public PlayerBase,public TcpClient {
|
||||
public:
|
||||
typedef std::shared_ptr<RtspPlayer> Ptr;
|
||||
//设置rtp传输类型,可选项有0(tcp,默认)、1(udp)、2(组播)
|
||||
//设置方法:player[RtspPlayer::kRtpType] = 0/1/2;
|
||||
//设置方法:player[RtspPlayer::kRtpType] = 0/1/2;
|
||||
static const char kRtpType[];
|
||||
|
||||
RtspPlayer();
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* Created on: 2016年8月12日
|
||||
* Author: xzl
|
||||
*/
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <atomic>
|
||||
#include "Common/config.h"
|
||||
#include "UDPServer.h"
|
||||
@@ -106,7 +105,7 @@ void RtspSession::onError(const SockException& err) {
|
||||
lock_guard<recursive_mutex> lock(g_mtxPostter);
|
||||
//为了保证脱离TCPServer后还能正常运作,需要保持本对象的强引用
|
||||
g_mapPostter.emplace(this, dynamic_pointer_cast<RtspSession>(shared_from_this()));
|
||||
TraceL << "quickTime已经不再发送请求";
|
||||
TraceL << "quickTime will not send request any more!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#ifndef SESSION_RTSPSESSION_H_
|
||||
#define SESSION_RTSPSESSION_H_
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -5,13 +5,7 @@
|
||||
* Author: xzl
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <net/if.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include "Common/config.h"
|
||||
#include "Rtmp/Rtmp.h"
|
||||
#include "RtspToRtmpMediaSource.h"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Author: xzl
|
||||
*/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "UDPServer.h"
|
||||
#include "Util/TimeTicker.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user