优化性能

This commit is contained in:
xiongziliang 2017-12-04 23:55:09 +08:00
parent 882210abd2
commit a32c97f8b5
18 changed files with 118 additions and 111 deletions

@ -1 +0,0 @@
Subproject commit dd0bc0b226bdf2997e3c8bcb53be4705839256c9

View File

@ -1,12 +1,5 @@
#!/bin/bash
path=`pwd`
wget https://raw.githubusercontent.com/xiongziliang/ZLToolKit/master/build_for_ios.sh -O toolkit_build.sh
sudo chmod +x ./toolkit_build.sh
./toolkit_build.sh
cd $path
cd ..
git clone --depth=50 https://github.com/xiongziliang/ZLMediaKit.git
cd ZLMediaKit
mkdir -p ios_build
rm -rf ./build
ln -s ./ios_build build

View File

@ -55,11 +55,11 @@ namespace Rtmp {
class RtmpMediaSource: public enable_shared_from_this<RtmpMediaSource> {
public:
typedef std::shared_ptr<RtmpMediaSource> Ptr;
typedef RingBuffer<RtmpPacket> RingType;
typedef RingBuffer<RtmpPacket::Ptr> RingType;
RtmpMediaSource(const string &strApp, const string &strId) :
m_strApp(strApp),
m_strId(strId),
m_pRing(new RingBuffer<RtmpPacket>()),
m_pRing(new RingBuffer<RtmpPacket::Ptr>()),
m_thPool( MediaSender::sendThread()) {
}
virtual ~RtmpMediaSource() {
@ -130,15 +130,14 @@ public:
virtual void onGetMetaData(const AMFValue &_metadata) {
m_metadata = _metadata;
}
virtual void onGetMedia(const RtmpPacket &_pkt) {
RtmpPacket & pkt = const_cast<RtmpPacket &>(_pkt);
if (pkt.isCfgFrame()) {
virtual void onGetMedia(const RtmpPacket::Ptr &pkt) {
if (pkt->isCfgFrame()) {
lock_guard<recursive_mutex> lock(m_mtxMap);
m_mapCfgFrame.emplace(pkt.typeId, pkt);
m_mapCfgFrame.emplace(pkt->typeId, pkt);
}
auto _ring = m_pRing;
m_thPool.async([_ring,pkt]() {
_ring->write(pkt,pkt.isVideoKeyFrame());
_ring->write(pkt,pkt->isVideoKeyFrame());
});
}
bool seekTo(uint32_t ui32Stamp) {
@ -164,11 +163,11 @@ protected:
function<uint32_t()> m_onStamp;
private:
AMFValue m_metadata;
unordered_map<int, RtmpPacket> m_mapCfgFrame;
unordered_map<int, RtmpPacket::Ptr> m_mapCfgFrame;
mutable recursive_mutex m_mtxMap;
string m_strApp; //媒体app
string m_strId; //媒体id
RingBuffer<RtmpPacket>::Ptr m_pRing; //rtp环形缓冲
RingBuffer<RtmpPacket::Ptr>::Ptr m_pRing; //rtp环形缓冲
ThreadPool &m_thPool;
static unordered_map<string, unordered_map<string,weak_ptr<RtmpMediaSource> > > g_mapMediaSrc; //静态的媒体源表
static recursive_mutex g_mtxMediaSrc; ///访问静态的媒体源表的互斥锁

View File

@ -78,8 +78,8 @@ RtmpParser::~RtmpParser() {
// TODO Auto-generated destructor stub
}
bool RtmpParser::inputRtmp(const RtmpPacket &pkt) {
switch (pkt.typeId) {
bool RtmpParser::inputRtmp(const RtmpPacket::Ptr &pkt) {
switch (pkt->typeId) {
case MSG_VIDEO:
if (m_bHaveVideo) {
return inputVideo(pkt);
@ -95,38 +95,38 @@ bool RtmpParser::inputRtmp(const RtmpPacket &pkt) {
}
}
inline bool RtmpParser::inputVideo(const RtmpPacket& pkt) {
if (pkt.isCfgFrame()) {
inline bool RtmpParser::inputVideo(const RtmpPacket::Ptr &pkt) {
if (pkt->isCfgFrame()) {
//WarnL << " got h264 cfg";
if (m_strSPS.size()) {
return false;
}
m_strSPS.assign("\x00\x00\x00\x01", 4);
m_strSPS.append(pkt.getH264SPS());
m_strSPS.append(pkt->getH264SPS());
m_strPPS.assign("\x00\x00\x00\x01", 4);
m_strPPS.append(pkt.getH264PPS());
m_strPPS.append(pkt->getH264PPS());
getAVCInfo(pkt.getH264SPS(), m_iVideoWidth, m_iVideoHeight, m_fVideoFps);
getAVCInfo(pkt->getH264SPS(), m_iVideoWidth, m_iVideoHeight, m_fVideoFps);
return false;
}
if (m_strSPS.size()) {
uint32_t iTotalLen = pkt.strBuf.size();
uint32_t iTotalLen = pkt->strBuf.size();
uint32_t iOffset = 5;
while(iOffset + 4 < iTotalLen){
uint32_t iFrameLen;
memcpy(&iFrameLen, pkt.strBuf.data() + iOffset, 4);
memcpy(&iFrameLen, pkt->strBuf.data() + iOffset, 4);
iFrameLen = ntohl(iFrameLen);
iOffset += 4;
if(iFrameLen + iOffset > iTotalLen){
break;
}
_onGetH264(pkt.strBuf.data() + iOffset, iFrameLen, pkt.timeStamp);
_onGetH264(pkt->strBuf.data() + iOffset, iFrameLen, pkt->timeStamp);
iOffset += iFrameLen;
}
}
return pkt.isVideoKeyFrame();
return pkt->isVideoKeyFrame();
}
inline void RtmpParser::_onGetH264(const char* pcData, int iLen, uint32_t ui32TimeStamp) {
switch (pcData[0] & 0x1F) {
@ -157,19 +157,19 @@ inline void RtmpParser::onGetH264(const char* pcData, int iLen, uint32_t ui32Tim
m_h264frame.data.clear();
}
inline bool RtmpParser::inputAudio(const RtmpPacket& pkt) {
if (pkt.isCfgFrame()) {
inline bool RtmpParser::inputAudio(const RtmpPacket::Ptr &pkt) {
if (pkt->isCfgFrame()) {
if (m_strAudioCfg.size()) {
return false;
}
m_strAudioCfg = pkt.getAacCfg();
m_iSampleBit = pkt.getAudioSampleBit();
m_strAudioCfg = pkt->getAacCfg();
m_iSampleBit = pkt->getAudioSampleBit();
makeAdtsHeader(m_strAudioCfg,m_adts);
getAACInfo(m_adts, m_iSampleRate, m_iChannel);
return false;
}
if (m_strAudioCfg.size()) {
onGetAAC(pkt.strBuf.data() + 2, pkt.strBuf.size() - 2, pkt.timeStamp);
onGetAAC(pkt->strBuf.data() + 2, pkt->strBuf.size() - 2, pkt->timeStamp);
}
return false;
}

View File

@ -48,7 +48,7 @@ public:
RtmpParser(const AMFValue &val);
virtual ~RtmpParser();
bool inputRtmp(const RtmpPacket &pkt);
bool inputRtmp(const RtmpPacket::Ptr &pkt);
void setOnVideoCB(const function<void(const H264Frame &frame)> &cb) override{
lock_guard<recursive_mutex> lck(m_mtxCB);
@ -116,8 +116,8 @@ private:
inline void onCheckMedia(const AMFValue &obj);
//返回值true 代表是i帧第一个rtp包
inline bool inputVideo(const RtmpPacket &pkt);
inline bool inputAudio(const RtmpPacket &pkt);
inline bool inputVideo(const RtmpPacket::Ptr &pkt);
inline bool inputAudio(const RtmpPacket::Ptr &pkt);
inline void _onGetH264(const char *pcData, int iLen, uint32_t ui32TimeStamp);
inline void onGetH264(const char *pcData, int iLen, uint32_t ui32TimeStamp);
inline void onGetAAC(const char *pcData, int iLen, uint32_t ui32TimeStamp);

View File

@ -312,7 +312,7 @@ void RtmpPlayer::onRtmpChunk(RtmpPacket &chunkData) {
if (m_aNowStampTicker[idx].elapsedTime() > 500) {
m_adNowStamp[idx] = chunkData.timeStamp;
}
_onMediaData(chunkData);
_onMediaData(std::make_shared<RtmpPacket>(chunkData));
}
break;
default:

View File

@ -59,7 +59,7 @@ public:
void teardown() override;
protected:
virtual bool onCheckMeta(AMFValue &val) =0;
virtual void onMediaData(RtmpPacket &chunkData) =0;
virtual void onMediaData(const RtmpPacket::Ptr &chunkData) =0;
float getProgressTime() const;
void seekToTime(float fTime);
private:
@ -70,7 +70,7 @@ private:
m_pBeatTimer.reset();
onShutdown(ex);
}
void _onMediaData(RtmpPacket &chunkData) {
void _onMediaData(const RtmpPacket::Ptr &chunkData) {
m_mediaTicker.resetTime();
onMediaData(chunkData);
}
@ -108,6 +108,10 @@ private:
void onSendRawData(const char *pcRawData, int iSize) override {
send(pcRawData, iSize);
}
void onSendRawData(string &&strData) override {
send(std::move(strData));
}
template<typename FUN>
inline void addOnResultCB(const FUN &fun) {

View File

@ -69,7 +69,7 @@ private:
return false;
}
}
void onMediaData(RtmpPacket &chunkData) override {
void onMediaData(const RtmpPacket::Ptr &chunkData) override {
if(m_parser){
m_parser->inputRtmp(chunkData);
}

View File

@ -221,7 +221,7 @@ void RtmpProtocol::sendRtmp(uint8_t ui8Type, uint32_t ui32StreamId,
strSend.append(strBuf, pos, chunk);
pos += chunk;
}
onSendRawData(strSend.data(),strSend.size());
onSendRawData(std::move(strSend));
m_ui32ByteSent += strSend.size();
if (m_ui32WinSize > 0 && m_ui32ByteSent - m_ui32LastSent >= m_ui32WinSize) {
m_ui32LastSent = m_ui32ByteSent;

View File

@ -54,6 +54,10 @@ public:
void reset();
protected:
virtual void onSendRawData(const char *pcRawData,int iSize) = 0;
virtual void onSendRawData(string &&strData) {
onSendRawData(strData.data(),strData.size());
};
virtual void onRtmpChunk(RtmpPacket &chunkData) = 0;
virtual void onStreamBegin(uint32_t ui32StreamId){

View File

@ -202,18 +202,18 @@ inline void RtmpPusher::send_metaData(){
enc << "@setDataFrame" << "onMetaData" << src->getMetaData();
sendRequest(MSG_DATA, enc.data());
src->getConfigFrame([&](const RtmpPacket &pkt){
sendRtmp(pkt.typeId, m_ui32StreamId, pkt.strBuf, pkt.timeStamp, pkt.chunkId);
src->getConfigFrame([&](const RtmpPacket::Ptr &pkt){
sendRtmp(pkt->typeId, m_ui32StreamId, pkt->strBuf, pkt->timeStamp, pkt->chunkId);
});
m_pRtmpReader = src->getRing()->attach();
weak_ptr<RtmpPusher> weakSelf = dynamic_pointer_cast<RtmpPusher>(shared_from_this());
m_pRtmpReader->setReadCB([weakSelf](const RtmpPacket &pkt){
m_pRtmpReader->setReadCB([weakSelf](const RtmpPacket::Ptr &pkt){
auto strongSelf = weakSelf.lock();
if(!strongSelf) {
return;
}
strongSelf->sendRtmp(pkt.typeId, strongSelf->m_ui32StreamId, pkt.strBuf, pkt.timeStamp, pkt.chunkId);
strongSelf->sendRtmp(pkt->typeId, strongSelf->m_ui32StreamId, pkt->strBuf, pkt->timeStamp, pkt->chunkId);
});
m_pRtmpReader->setDetachCB([weakSelf](){
auto strongSelf = weakSelf.lock();

View File

@ -65,6 +65,9 @@ protected:
void onSendRawData(const char *pcRawData, int iSize) override {
send(pcRawData, iSize);
}
void onSendRawData(string &&strData) override {
send(std::move(strData));
}
private:
void init(const RtmpMediaSource::Ptr &src);
void onShutdown(const SockException &ex) {

View File

@ -207,14 +207,14 @@ void RtmpSession::doPlay(){
invoke << "onMetaData" << src->getMetaData();
sendResponse(MSG_DATA, invoke.data());
src->getConfigFrame([&](const RtmpPacket &pkt) {
src->getConfigFrame([&](const RtmpPacket::Ptr &pkt) {
//DebugL<<"send initial frame";
onSendMedia(pkt);
});
m_pRingReader = src->getRing()->attach();
weak_ptr<RtmpSession> weakSelf = dynamic_pointer_cast<RtmpSession>(shared_from_this());
m_pRingReader->setReadCB([weakSelf](const RtmpPacket& pkt){
m_pRingReader->setReadCB([weakSelf](const RtmpPacket::Ptr &pkt){
auto strongSelf = weakSelf.lock();
if(!strongSelf) {
return;
@ -271,7 +271,7 @@ void RtmpSession::onCmd_pause(AMFDecoder &dec) {
m_pRingReader->setReadCB(nullptr);
} else {
weak_ptr<RtmpSession> weakSelf = dynamic_pointer_cast<RtmpSession>(shared_from_this());
m_pRingReader->setReadCB([weakSelf](const RtmpPacket& pkt) {
m_pRingReader->setReadCB([weakSelf](const RtmpPacket::Ptr &pkt) {
auto strongSelf = weakSelf.lock();
if(!strongSelf) {
return;
@ -334,7 +334,7 @@ void RtmpSession::onRtmpChunk(RtmpPacket &chunkData) {
if (!m_pPublisherSrc) {
throw std::runtime_error("Not a rtmp publisher!");
}
m_pPublisherSrc->onGetMedia(chunkData);
m_pPublisherSrc->onGetMedia(std::make_shared<RtmpPacket>(chunkData));
if(!m_bPublisherSrcRegisted && m_pPublisherSrc->ready()){
m_bPublisherSrcRegisted = true;
m_pPublisherSrc->regist();
@ -363,9 +363,9 @@ void RtmpSession::onCmd_seek(AMFDecoder &dec) {
sendReply("onStatus", nullptr, status);
}
void RtmpSession::onSendMedia(const RtmpPacket& pkt) {
auto modifiedStamp = pkt.timeStamp;
auto &firstStamp = m_aui32FirstStamp[pkt.typeId % 2];
void RtmpSession::onSendMedia(const RtmpPacket::Ptr &pkt) {
auto modifiedStamp = pkt->timeStamp;
auto &firstStamp = m_aui32FirstStamp[pkt->typeId % 2];
if(!firstStamp){
firstStamp = modifiedStamp;
}
@ -377,7 +377,7 @@ void RtmpSession::onSendMedia(const RtmpPacket& pkt) {
CLEAR_ARR(m_aui32FirstStamp);
modifiedStamp = 0;
}
sendRtmp(pkt.typeId, pkt.streamId, pkt.strBuf, modifiedStamp, pkt.chunkId);
sendRtmp(pkt->typeId, pkt->streamId, pkt->strBuf, modifiedStamp, pkt->chunkId);
}
} /* namespace Rtmp */

View File

@ -60,7 +60,7 @@ private:
typedef void (RtmpSession::*rtmpCMDHandle)(AMFDecoder &dec);
static unordered_map<string, rtmpCMDHandle> g_mapCmd;
RingBuffer<RtmpPacket>::RingReader::Ptr m_pRingReader;
RingBuffer<RtmpPacket::Ptr>::RingReader::Ptr m_pRingReader;
std::shared_ptr<RtmpMediaSource> m_pPublisherSrc;
bool m_bPublisherSrcRegisted = false;
std::weak_ptr<RtmpMediaSource> m_pPlayerSrc;
@ -80,10 +80,13 @@ private:
void onCmd_pause(AMFDecoder &dec);
void setMetaData(AMFDecoder &dec);
void onSendMedia(const RtmpPacket &pkt);
void onSendMedia(const RtmpPacket::Ptr &pkt);
void onSendRawData(const char *pcRawData,int iSize) override{
send(pcRawData, iSize);
}
void onSendRawData(string &&strData) override{
send(std::move(strData));
}
void onRtmpChunk(RtmpPacket &chunkData) override;
template<typename first, typename second>

View File

@ -73,7 +73,7 @@ public:
RtmpMediaSource::onGetMetaData(_metadata);
}
virtual void onGetMedia(const RtmpPacket &pkt) override {
virtual void onGetMedia(const RtmpPacket::Ptr &pkt) override {
if (m_pParser) {
if (!m_pRtspSrc && m_pParser->isInited()) {
makeSDP();

View File

@ -62,6 +62,9 @@ private:
int send(const string &strBuf) override {
return m_pSender->send(strBuf);
}
int send(string &&strBuf) override {
return m_pSender->send(std::move(strBuf));
}
int send(const char *pcBuf, int iSize) override {
return m_pSender->send(pcBuf, iSize);
}

View File

@ -66,40 +66,40 @@ void RtspToRtmpMediaSource::makeVideoConfigPkt() {
flags |= (FLV_KEY_FRAME << 4);
bool is_config = true;
m_rtmpPkt.strBuf.clear();
RtmpPacket::Ptr rtmpPkt(new RtmpPacket);
//////////header
m_rtmpPkt.strBuf.push_back(flags);
m_rtmpPkt.strBuf.push_back(!is_config);
m_rtmpPkt.strBuf.append("\x0\x0\x0", 3);
rtmpPkt->strBuf.push_back(flags);
rtmpPkt->strBuf.push_back(!is_config);
rtmpPkt->strBuf.append("\x0\x0\x0", 3);
////////////sps
m_rtmpPkt.strBuf.push_back(1); // version
rtmpPkt->strBuf.push_back(1); // version
string m_sps = m_pParser->getSps().substr(4);
string m_pps = m_pParser->getPps().substr(4);
//DebugL<<hexdump(m_sps.data(), m_sps.size());
m_rtmpPkt.strBuf.push_back(m_sps[1]); // profile
m_rtmpPkt.strBuf.push_back(m_sps[2]); // compat
m_rtmpPkt.strBuf.push_back(m_sps[3]); // level
m_rtmpPkt.strBuf.push_back(0xff); // 6 bits reserved + 2 bits nal size length - 1 (11)
m_rtmpPkt.strBuf.push_back(0xe1); // 3 bits reserved + 5 bits number of sps (00001)
rtmpPkt->strBuf.push_back(m_sps[1]); // profile
rtmpPkt->strBuf.push_back(m_sps[2]); // compat
rtmpPkt->strBuf.push_back(m_sps[3]); // level
rtmpPkt->strBuf.push_back(0xff); // 6 bits reserved + 2 bits nal size length - 1 (11)
rtmpPkt->strBuf.push_back(0xe1); // 3 bits reserved + 5 bits number of sps (00001)
uint16_t size = m_sps.size();
size = htons(size);
m_rtmpPkt.strBuf.append((char *) &size, 2);
m_rtmpPkt.strBuf.append(m_sps);
rtmpPkt->strBuf.append((char *) &size, 2);
rtmpPkt->strBuf.append(m_sps);
/////////////pps
m_rtmpPkt.strBuf.push_back(1); // version
rtmpPkt->strBuf.push_back(1); // version
size = m_pps.size();
size = htons(size);
m_rtmpPkt.strBuf.append((char *) &size, 2);
m_rtmpPkt.strBuf.append(m_pps);
rtmpPkt->strBuf.append((char *) &size, 2);
rtmpPkt->strBuf.append(m_pps);
m_rtmpPkt.bodySize = m_rtmpPkt.strBuf.size();
m_rtmpPkt.chunkId = CHUNK_VIDEO;
m_rtmpPkt.streamId = STREAM_MEDIA;
m_rtmpPkt.timeStamp = 0;
m_rtmpPkt.typeId = MSG_VIDEO;
m_pRtmpSrc->onGetMedia(m_rtmpPkt);
rtmpPkt->bodySize = rtmpPkt->strBuf.size();
rtmpPkt->chunkId = CHUNK_VIDEO;
rtmpPkt->streamId = STREAM_MEDIA;
rtmpPkt->timeStamp = 0;
rtmpPkt->typeId = MSG_VIDEO;
m_pRtmpSrc->onGetMedia(rtmpPkt);
}
void RtspToRtmpMediaSource::onGetH264(const H264Frame& frame) {
if(m_pRecorder){
@ -119,40 +119,40 @@ void RtspToRtmpMediaSource::onGetH264(const H264Frame& frame) {
flags |= (FLV_INTER_FRAME << 4);
break;
}
m_rtmpPkt.strBuf.clear();
m_rtmpPkt.strBuf.push_back(flags);
m_rtmpPkt.strBuf.push_back(!is_config);
m_rtmpPkt.strBuf.append("\x0\x0\x0", 3);
RtmpPacket::Ptr rtmpPkt(new RtmpPacket);
rtmpPkt->strBuf.push_back(flags);
rtmpPkt->strBuf.push_back(!is_config);
rtmpPkt->strBuf.append("\x0\x0\x0", 3);
uint32_t size = frame.data.size() - 4;
size = htonl(size);
m_rtmpPkt.strBuf.append((char *) &size, 4);
m_rtmpPkt.strBuf.append(&frame.data[4], frame.data.size() - 4);
rtmpPkt->strBuf.append((char *) &size, 4);
rtmpPkt->strBuf.append(&frame.data[4], frame.data.size() - 4);
m_rtmpPkt.bodySize = m_rtmpPkt.strBuf.size();
m_rtmpPkt.chunkId = CHUNK_VIDEO;
m_rtmpPkt.streamId = STREAM_MEDIA;
m_rtmpPkt.timeStamp = frame.timeStamp;
m_rtmpPkt.typeId = MSG_VIDEO;
m_pRtmpSrc->onGetMedia(m_rtmpPkt);
rtmpPkt->bodySize = rtmpPkt->strBuf.size();
rtmpPkt->chunkId = CHUNK_VIDEO;
rtmpPkt->streamId = STREAM_MEDIA;
rtmpPkt->timeStamp = frame.timeStamp;
rtmpPkt->typeId = MSG_VIDEO;
m_pRtmpSrc->onGetMedia(rtmpPkt);
}
void RtspToRtmpMediaSource::onGetAdts(const AdtsFrame& frame) {
if(m_pRecorder){
m_pRecorder->inputAAC((char *) frame.data, frame.aac_frame_length, frame.timeStamp);
}
m_rtmpPkt.strBuf.clear();
RtmpPacket::Ptr rtmpPkt(new RtmpPacket);
//////////header
uint8_t is_config = false;
m_rtmpPkt.strBuf.push_back(m_ui8AudioFlags);
m_rtmpPkt.strBuf.push_back(!is_config);
m_rtmpPkt.strBuf.append((char *) frame.data + 7, frame.aac_frame_length - 7);
rtmpPkt->strBuf.push_back(m_ui8AudioFlags);
rtmpPkt->strBuf.push_back(!is_config);
rtmpPkt->strBuf.append((char *) frame.data + 7, frame.aac_frame_length - 7);
m_rtmpPkt.bodySize = m_rtmpPkt.strBuf.size();
m_rtmpPkt.chunkId = CHUNK_AUDIO;
m_rtmpPkt.streamId = STREAM_MEDIA;
m_rtmpPkt.timeStamp = frame.timeStamp;
m_rtmpPkt.typeId = MSG_AUDIO;
m_pRtmpSrc->onGetMedia(m_rtmpPkt);
rtmpPkt->bodySize = rtmpPkt->strBuf.size();
rtmpPkt->chunkId = CHUNK_AUDIO;
rtmpPkt->streamId = STREAM_MEDIA;
rtmpPkt->timeStamp = frame.timeStamp;
rtmpPkt->typeId = MSG_AUDIO;
m_pRtmpSrc->onGetMedia(rtmpPkt);
}
void RtspToRtmpMediaSource::makeAudioConfigPkt() {
@ -180,19 +180,19 @@ void RtspToRtmpMediaSource::makeAudioConfigPkt() {
m_ui8AudioFlags = (flvAudioType << 4) | (flvSampleRate << 2) | (flvSampleBit << 1) | flvStereoOrMono;
m_rtmpPkt.strBuf.clear();
RtmpPacket::Ptr rtmpPkt(new RtmpPacket);
//////////header
uint8_t is_config = true;
m_rtmpPkt.strBuf.push_back(m_ui8AudioFlags);
m_rtmpPkt.strBuf.push_back(!is_config);
m_rtmpPkt.strBuf.append(m_pParser->getAudioCfg());
rtmpPkt->strBuf.push_back(m_ui8AudioFlags);
rtmpPkt->strBuf.push_back(!is_config);
rtmpPkt->strBuf.append(m_pParser->getAudioCfg());
m_rtmpPkt.bodySize = m_rtmpPkt.strBuf.size();
m_rtmpPkt.chunkId = CHUNK_AUDIO;
m_rtmpPkt.streamId = STREAM_MEDIA;
m_rtmpPkt.timeStamp = 0;
m_rtmpPkt.typeId = MSG_AUDIO;
m_pRtmpSrc->onGetMedia(m_rtmpPkt);
rtmpPkt->bodySize = rtmpPkt->strBuf.size();
rtmpPkt->chunkId = CHUNK_AUDIO;
rtmpPkt->streamId = STREAM_MEDIA;
rtmpPkt->timeStamp = 0;
rtmpPkt->typeId = MSG_AUDIO;
m_pRtmpSrc->onGetMedia(rtmpPkt);
}
void RtspToRtmpMediaSource::makeMetaData() {

View File

@ -101,7 +101,6 @@ public:
private:
RtpParser::Ptr m_pParser;
RtmpMediaSource::Ptr m_pRtmpSrc;
RtmpPacket m_rtmpPkt;
uint8_t m_ui8AudioFlags = 0;
MediaRecorder::Ptr m_pRecorder;
bool m_bEnableFile = true;