mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
修复编译问题
This commit is contained in:
parent
b6cbc87712
commit
5d752c89b5
@ -1 +1 @@
|
||||
Subproject commit 3b5de80f9effe28c4a38fef5beec50eadfc916cf
|
||||
Subproject commit 9c5aad98d0eb50903e643eb9965b8bc34cd9f77d
|
@ -371,8 +371,8 @@ void API_CALL on_mk_shell_login(const char *user_name,
|
||||
* @param peer_port 客户端端口号
|
||||
*/
|
||||
void API_CALL on_mk_flow_report(const mk_media_info url_info,
|
||||
uint64_t total_bytes,
|
||||
uint64_t total_seconds,
|
||||
size_t total_bytes,
|
||||
size_t total_seconds,
|
||||
int is_player,
|
||||
const mk_sock_info sender) {
|
||||
char ip[64];
|
||||
|
@ -59,7 +59,7 @@ static bool is_local_ip(const string &ip){
|
||||
return false;
|
||||
}
|
||||
|
||||
void FFmpegSource::setupRecord(bool enable_hls, bool enable_mp4){
|
||||
void FFmpegSource::setupRecordFlag(bool enable_hls, bool enable_mp4){
|
||||
_enable_hls = enable_hls;
|
||||
_enable_mp4 = enable_mp4;
|
||||
}
|
||||
@ -173,7 +173,7 @@ void FFmpegSource::findAsync(int maxWaitMS, const function<void(const MediaSourc
|
||||
NoticeCenter::Instance().delListener(listener_tag,Broadcast::kBroadcastMediaChanged);
|
||||
|
||||
//切换到自己的线程再回复
|
||||
strongSelf->_poller->async([listener_tag,weakSelf,cb](){
|
||||
strongSelf->_poller->async([weakSelf,cb](){
|
||||
auto strongSelf = weakSelf.lock();
|
||||
if(!strongSelf) {
|
||||
return;
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
* @param enable_hls 是否开启hls直播或录制
|
||||
* @param enable_mp4 是否录制mp4
|
||||
*/
|
||||
void setupRecord(bool enable_hls, bool enable_mp4);
|
||||
void setupRecordFlag(bool enable_hls, bool enable_mp4);
|
||||
|
||||
private:
|
||||
void findAsync(int maxWaitMS ,const function<void(const MediaSource::Ptr &src)> &cb);
|
||||
|
@ -51,11 +51,6 @@ string System::execute(const string &cmd) {
|
||||
}
|
||||
|
||||
#if !defined(ANDROID) && !defined(_WIN32)
|
||||
static string addr2line(const string &address) {
|
||||
string cmd = StrPrinter << "addr2line -C -f -e " << exePath() << " " << address;
|
||||
return System::execute(cmd);
|
||||
}
|
||||
|
||||
static void sig_crash(int sig) {
|
||||
signal(sig, SIG_DFL);
|
||||
void *array[MAX_STACK_FRAMES];
|
||||
@ -68,6 +63,10 @@ static void sig_crash(int sig) {
|
||||
std::string symbol(strings[i]);
|
||||
ref.emplace_back(symbol);
|
||||
#if defined(__linux) || defined(__linux__)
|
||||
static auto addr2line = [](const string &address) {
|
||||
string cmd = StrPrinter << "addr2line -C -f -e " << exePath() << " " << address;
|
||||
return System::execute(cmd);
|
||||
};
|
||||
size_t pos1 = symbol.find_first_of("[");
|
||||
size_t pos2 = symbol.find_last_of("]");
|
||||
std::string address = symbol.substr(pos1 + 1, pos2 - pos1 - 1);
|
||||
|
@ -683,7 +683,7 @@ void installWebApi() {
|
||||
lock_guard<decltype(s_ffmpegMapMtx)> lck(s_ffmpegMapMtx);
|
||||
s_ffmpegMap.erase(key);
|
||||
});
|
||||
ffmpeg->setupRecord(enable_hls, enable_mp4);
|
||||
ffmpeg->setupRecordFlag(enable_hls, enable_mp4);
|
||||
ffmpeg->play(src_url, dst_url, timeout_ms, [cb, key](const SockException &ex) {
|
||||
if (ex) {
|
||||
lock_guard<decltype(s_ffmpegMapMtx)> lck(s_ffmpegMapMtx);
|
||||
|
@ -260,7 +260,7 @@ static string getTrackInfoStr(const TrackSource *track_src){
|
||||
break;
|
||||
}
|
||||
}
|
||||
return codec_info;
|
||||
return std::move(codec_info);
|
||||
}
|
||||
|
||||
void MultiMuxerPrivate::onAllTrackReady() {
|
||||
|
@ -83,7 +83,7 @@ void HlsPlayer::playNextTs(bool force){
|
||||
strongSelf->playNextTs(true);
|
||||
} else {
|
||||
//下一个切片慢点播放
|
||||
strongSelf->_timer_ts.reset(new Timer(delay / 1000.0f, [weakSelf, delay]() {
|
||||
strongSelf->_timer_ts.reset(new Timer(delay / 1000.0f, [weakSelf]() {
|
||||
auto strongSelf = weakSelf.lock();
|
||||
if (!strongSelf) {
|
||||
return false;
|
||||
|
@ -144,7 +144,7 @@ Buffer::Ptr HttpFileBody::readData(size_t size) {
|
||||
//读到数据了
|
||||
ret->setSize(iRead);
|
||||
_offset += iRead;
|
||||
return ret;
|
||||
return std::move(ret);
|
||||
}
|
||||
//读取文件异常,文件真实长度小于声明长度
|
||||
_offset = _max_size;
|
||||
@ -218,7 +218,7 @@ string HttpMultiFormBody::multiFormBodySuffix(const string &boundary){
|
||||
string endMPboundary = MPboundary + "--";
|
||||
_StrPrinter body;
|
||||
body << "\r\n" << endMPboundary;
|
||||
return body;
|
||||
return std::move(body);
|
||||
}
|
||||
|
||||
size_t HttpMultiFormBody::fileSize(FILE *fp) {
|
||||
@ -244,7 +244,7 @@ string HttpMultiFormBody::multiFormBodyPrefix(const HttpArgs &args,const string
|
||||
body << MPboundary << "\r\n";
|
||||
body << "Content-Disposition: form-data; name=\"" << "file" << "\";filename=\"" << fileName << "\"\r\n";
|
||||
body << "Content-Type: application/octet-stream\r\n\r\n" ;
|
||||
return body;
|
||||
return std::move(body);
|
||||
}
|
||||
|
||||
}//namespace mediakit
|
||||
|
@ -674,7 +674,7 @@ void HttpSession::Handle_Req_POST(size_t &content_len) {
|
||||
//返回不固定长度的content
|
||||
content_len = -1;
|
||||
auto parserCopy = _parser;
|
||||
std::shared_ptr<size_t> recvedContentLen = std::make_shared<uint64_t>(0);
|
||||
std::shared_ptr<size_t> recvedContentLen = std::make_shared<size_t>(0);
|
||||
bool bClose = !strcasecmp(_parser["Connection"].data(),"close");
|
||||
|
||||
_contentCallBack = [this,parserCopy,totalContentLen,recvedContentLen,bClose](const char *data,size_t len){
|
||||
|
@ -53,7 +53,7 @@ do{ \
|
||||
} \
|
||||
}while(0) \
|
||||
|
||||
void WebSocketSplitter::decode(uint8_t *data,size_t len) {
|
||||
void WebSocketSplitter::decode(uint8_t *data, size_t len) {
|
||||
uint8_t *ptr = data;
|
||||
if(!_got_header) {
|
||||
//还没有获取数据头
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
* @param data 需要解包的数据,可能是不完整的包或多个包
|
||||
* @param len 数据长度
|
||||
*/
|
||||
void decode(uint8_t *data,uint64_t len);
|
||||
void decode(uint8_t *data, size_t len);
|
||||
|
||||
/**
|
||||
* 编码一个数据包
|
||||
@ -119,7 +119,7 @@ protected:
|
||||
* @param len 负载数据长度
|
||||
* @param recved 已接收数据长度(包含本次数据长度),等于header._payload_len时则接受完毕
|
||||
*/
|
||||
virtual void onWebSocketDecodePayload(const WebSocketHeader &header, const uint8_t *ptr, uint64_t len, uint64_t recved) {};
|
||||
virtual void onWebSocketDecodePayload(const WebSocketHeader &header, const uint8_t *ptr, size_t len, size_t recved) {};
|
||||
|
||||
/**
|
||||
* 接收到完整的一个webSocket数据包后回调
|
||||
@ -135,13 +135,13 @@ protected:
|
||||
virtual void onWebSocketEncodeData(Buffer::Ptr buffer){};
|
||||
|
||||
private:
|
||||
void onPayloadData(uint8_t *data, uint64_t len);
|
||||
void onPayloadData(uint8_t *data, size_t len);
|
||||
|
||||
private:
|
||||
string _remain_data;
|
||||
int _mask_offset = 0;
|
||||
bool _got_header = false;
|
||||
uint64_t _payload_offset = 0;
|
||||
int _mask_offset = 0;
|
||||
size_t _payload_offset = 0;
|
||||
string _remain_data;
|
||||
};
|
||||
|
||||
} /* namespace mediakit */
|
||||
|
@ -121,7 +121,7 @@ static struct mov_buffer_t s_io = {
|
||||
},
|
||||
[](void *ctx) {
|
||||
MP4FileIO *thiz = (MP4FileIO *) ctx;
|
||||
return thiz->onTell();
|
||||
return (uint64_t)thiz->onTell();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -214,7 +214,7 @@ inline void RtmpPlayer::send_play() {
|
||||
AMFEncoder enc;
|
||||
enc << "play" << ++_send_req_id << nullptr << _stream_id << (double) _stream_index;
|
||||
sendRequest(MSG_CMD, enc.data());
|
||||
auto fun = [this](AMFValue &val) {
|
||||
auto fun = [](AMFValue &val) {
|
||||
//TraceL << "play onStatus";
|
||||
auto level = val["level"].as_string();
|
||||
auto code = val["code"].as_string();
|
||||
|
@ -192,7 +192,7 @@ string RtpProcess::getIdentifier() const {
|
||||
return _media_info._streamid;
|
||||
}
|
||||
|
||||
int RtpProcess::totalReaderCount() {
|
||||
int RtpProcess::getTotalReaderCount() {
|
||||
return _muxer ? _muxer->totalReaderCount() : 0;
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include "ProcessInterface.h"
|
||||
#include "Common/MultiMediaSourceMuxer.h"
|
||||
|
||||
using namespace mediakit;
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
class RtpProcess : public SockInfo, public MediaSinkInterface, public MediaSourceEventInterceptor, public std::enable_shared_from_this<RtpProcess>{
|
||||
@ -65,7 +63,7 @@ public:
|
||||
uint16_t get_peer_port() override;
|
||||
string getIdentifier() const override;
|
||||
|
||||
int totalReaderCount();
|
||||
int getTotalReaderCount();
|
||||
void setListener(const std::weak_ptr<MediaSourceEvent> &listener);
|
||||
|
||||
protected:
|
||||
|
@ -138,7 +138,7 @@ void RtpProcessHelper::attachEvent() {
|
||||
|
||||
bool RtpProcessHelper::close(MediaSource &sender, bool force) {
|
||||
//此回调在其他线程触发
|
||||
if (!_process || (!force && _process->totalReaderCount())) {
|
||||
if (!_process || (!force && _process->getTotalReaderCount())) {
|
||||
return false;
|
||||
}
|
||||
auto parent = _parent.lock();
|
||||
@ -151,7 +151,7 @@ bool RtpProcessHelper::close(MediaSource &sender, bool force) {
|
||||
}
|
||||
|
||||
int RtpProcessHelper::totalReaderCount(MediaSource &sender) {
|
||||
return _process ? _process->totalReaderCount() : sender.totalReaderCount();
|
||||
return _process ? _process->getTotalReaderCount() : sender.totalReaderCount();
|
||||
}
|
||||
|
||||
RtpProcess::Ptr &RtpProcessHelper::getProcess() {
|
||||
|
@ -79,7 +79,7 @@ void RtpSession::onRtpPacket(const char *data, size_t len) {
|
||||
|
||||
bool RtpSession::close(MediaSource &sender, bool force) {
|
||||
//此回调在其他线程触发
|
||||
if(!_process || (!force && _process->totalReaderCount())){
|
||||
if(!_process || (!force && _process->getTotalReaderCount())){
|
||||
return false;
|
||||
}
|
||||
string err = StrPrinter << "close media:" << sender.getSchema() << "/" << sender.getVhost() << "/" << sender.getApp() << "/" << sender.getId() << " " << force;
|
||||
@ -89,7 +89,7 @@ bool RtpSession::close(MediaSource &sender, bool force) {
|
||||
|
||||
int RtpSession::totalReaderCount(MediaSource &sender) {
|
||||
//此回调在其他线程触发
|
||||
return _process ? _process->totalReaderCount() : sender.totalReaderCount();
|
||||
return _process ? _process->getTotalReaderCount() : sender.totalReaderCount();
|
||||
}
|
||||
|
||||
}//namespace mediakit
|
||||
|
@ -121,7 +121,7 @@ string SdpTrack::toString() const {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _printer;
|
||||
return std::move(_printer);
|
||||
}
|
||||
|
||||
static TrackType toTrackType(const string &str) {
|
||||
|
@ -309,7 +309,7 @@ void RtspPusher::handleResSetup(const Parser &parser, unsigned int track_idx) {
|
||||
}
|
||||
|
||||
void RtspPusher::sendOptions() {
|
||||
_on_res_func = [this](const Parser &parser) {};
|
||||
_on_res_func = [](const Parser &parser) {};
|
||||
sendRtspRequest("OPTIONS", _content_base);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user