完成Rtmp解复用器

This commit is contained in:
xiongziliang 2018-10-24 22:03:17 +08:00
parent de50bf03a9
commit 3921bfb2d9
7 changed files with 232 additions and 281 deletions

View File

@ -3,6 +3,10 @@
// //
#include "Factory.h" #include "Factory.h"
#include "RtmpMuxer/H264RtmpCodec.h"
#include "RtmpMuxer/AACRtmpCodec.h"
#include "RtspMuxer/H264RtpCodec.h"
#include "RtspMuxer/AACRtpCodec.h"
namespace mediakit{ namespace mediakit{
@ -75,7 +79,7 @@ Track::Ptr Factory::getTrackBySdp(const string &sdp) {
} }
CodecId getCodecIdByAmf(const AMFValue &val){ CodecId Factory::getCodecIdByAmf(const AMFValue &val){
if (val.type() == AMF_STRING){ if (val.type() == AMF_STRING){
auto str = val.as_string(); auto str = val.as_string();
if(str == "avc1"){ if(str == "avc1"){
@ -153,6 +157,17 @@ RtpCodec::Ptr Factory::getRtpDecoderById(CodecId codecId, uint32_t ui32SampleRat
} }
} }
RtmpCodec::Ptr Factory::getRtmpCodecById(CodecId codecId) {
switch (codecId){
case CodecH264:
return std::make_shared<H264RtmpEncoder>();
case CodecAAC:
return std::make_shared<AACRtmpEncoder>();
default:
return nullptr;
}
}
}//namespace mediakit }//namespace mediakit

View File

@ -8,6 +8,8 @@
#include <string> #include <string>
#include "Player/Track.h" #include "Player/Track.h"
#include "RtspMuxer/RtspSdp.h" #include "RtspMuxer/RtspSdp.h"
#include "RtspMuxer/RtpCodec.h"
#include "RtmpMuxer/RtmpCodec.h"
#include "Rtmp/amf.h" #include "Rtmp/amf.h"
using namespace std; using namespace std;
@ -21,7 +23,6 @@ public:
* sdp生成Track对象 * sdp生成Track对象
*/ */
static Track::Ptr getTrackBySdp(const string &sdp); static Track::Ptr getTrackBySdp(const string &sdp);
static Track::Ptr getTrackByAmf(const AMFValue &amf);
static Track::Ptr getTrackByCodecId(CodecId codecId); static Track::Ptr getTrackByCodecId(CodecId codecId);
@ -57,6 +58,13 @@ public:
* @return * @return
*/ */
static RtpCodec::Ptr getRtpDecoderById(CodecId codecId, uint32_t ui32SampleRate); static RtpCodec::Ptr getRtpDecoderById(CodecId codecId, uint32_t ui32SampleRate);
//////////////////////////////////////////////////////////////////
static Track::Ptr getTrackByAmf(const AMFValue &amf);
static CodecId getCodecIdByAmf(const AMFValue &val);
static RtmpCodec::Ptr getRtmpCodecById(CodecId codecId);
}; };
}//namespace mediakit }//namespace mediakit

View File

@ -49,7 +49,7 @@ class AACRtmpEncoder : public AACRtmpDecoder , public ResourcePoolHelper<RtmpPa
public: public:
typedef std::shared_ptr<AACRtmpEncoder> Ptr; typedef std::shared_ptr<AACRtmpEncoder> Ptr;
AACRtmpEncoder(); AACRtmpEncoder(){}
~AACRtmpEncoder() {} ~AACRtmpEncoder() {}
/** /**

View File

@ -1,65 +1,47 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2016 xiongziliang <771730766@qq.com> * Copyright (c) 2016 xiongziliang <771730766@qq.com>
* *
* This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#include "RtmpDemuxer.h" #include "RtmpDemuxer.h"
#include "Common/Factory.h"
namespace mediakit { namespace mediakit {
RtmpDemuxer::RtmpDemuxer(const AMFValue &val) { RtmpDemuxer::RtmpDemuxer(const AMFValue &val) {
auto videoCodec = val["videocodecid"]; try {
auto audioCodec = val["audiocodecid"]; makeVideoTrack(val["videocodecid"]);
makeAudioTrack(val["audiocodecid"]);
if (videoCodec.type() == AMF_STRING) { val.object_for_each([&](const string &key, const AMFValue &val) {
if (videoCodec.as_string() == "avc1") { if (key == "duration") {
//h264 _fDuration = val.as_number();
_iVideoCodecID = H264_CODEC_ID; return;
} else {
InfoL << "不支持RTMP视频格式:" << videoCodec.as_string();
} }
}else if (videoCodec.type() != AMF_NULL){ });
_iVideoCodecID = videoCodec.as_integer(); }catch (std::exception &ex){
if (_iVideoCodecID != H264_CODEC_ID) { WarnL << ex.what();
InfoL << "不支持RTMP视频格式:" << videoCodec.as_integer();
} }
}
if (audioCodec.type() == AMF_STRING) {
if (audioCodec.as_string() == "mp4a") {
//aac
_iAudioCodecID = AAC_CODEC_ID;
} else {
InfoL << "不支持RTMP音频格式:" << audioCodec.as_string();
}
}else if (audioCodec.type() != AMF_NULL) {
_iAudioCodecID = audioCodec.as_integer();
if (_iAudioCodecID != AAC_CODEC_ID) {
InfoL << "不支持RTMP音频格式:" << audioCodec.as_integer();
}
}
onCheckMedia(val);
} }
RtmpDemuxer::~RtmpDemuxer() { RtmpDemuxer::~RtmpDemuxer() {
@ -67,167 +49,93 @@ RtmpDemuxer::~RtmpDemuxer() {
bool RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) { bool RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) {
switch (pkt->typeId) { switch (pkt->typeId) {
case MSG_VIDEO:{ case MSG_VIDEO: {
if(_iVideoCodecID == 0){ if(_videoRtmpDecoder){
//未初始化视频 return _videoRtmpDecoder->inputRtmp(pkt, true);
_iVideoCodecID = pkt->getMediaType();
if(_iVideoCodecID != H264_CODEC_ID){
InfoL << "不支持RTMP视频格式:" << _iVideoCodecID;
} }
} if(!_tryGetVideoTrack){
if(_iVideoCodecID == H264_CODEC_ID){ _tryGetVideoTrack = true;
return inputVideo(pkt); auto codec = AMFValue(pkt->getMediaType());
makeVideoTrack(codec);
} }
return false; return false;
} }
case MSG_AUDIO: { case MSG_AUDIO: {
if(_iAudioCodecID == 0){ if(_audioRtmpDecoder){
//未初始化音频 _audioRtmpDecoder->inputRtmp(pkt, false);
_iAudioCodecID = pkt->getMediaType(); return false;
if(_iAudioCodecID != AAC_CODEC_ID){
InfoL << "不支持RTMP音频格式:" << _iAudioCodecID;
} }
} if(!_tryGetAudioTrack) {
if (_iAudioCodecID == AAC_CODEC_ID) { _tryGetAudioTrack = true;
return inputAudio(pkt); auto codec = AMFValue(pkt->getMediaType());
makeAudioTrack(codec);
} }
return false; return false;
} }
default: default:
return false; return false;
} }
} }
inline bool RtmpDemuxer::inputVideo(const RtmpPacket::Ptr &pkt) { void RtmpDemuxer::makeVideoTrack(const AMFValue &videoCodec) {
if (pkt->isCfgFrame()) { //生成Track对象
//WarnL << " got h264 cfg"; _videoTrack = dynamic_pointer_cast<VideoTrack>(Factory::getTrackByAmf(videoCodec));
if (_strSPS.size()) { if (_videoTrack) {
return false; //生成rtmpCodec对象以便解码rtmp
_videoRtmpDecoder = Factory::getRtmpCodecById(_videoTrack->getCodecId());
if (_videoRtmpDecoder) {
//设置rtmp解码器代理生成的frame写入该Track
_videoRtmpDecoder->setDelegate(_videoTrack);
} else {
//找不到相应的rtmp解码器该track无效
_videoTrack.reset();
} }
_strSPS.assign("\x00\x00\x00\x01", 4);
_strSPS.append(pkt->getH264SPS());
_strPPS.assign("\x00\x00\x00\x01", 4);
_strPPS.append(pkt->getH264PPS());
getAVCInfo(pkt->getH264SPS(), _iVideoWidth, _iVideoHeight, _fVideoFps);
return false;
}
if (_strSPS.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);
iFrameLen = ntohl(iFrameLen);
iOffset += 4;
if(iFrameLen + iOffset > iTotalLen){
break;
}
_onGetH264(pkt->strBuf.data() + iOffset, iFrameLen, pkt->timeStamp);
iOffset += iFrameLen;
}
}
return pkt->isVideoKeyFrame();
}
inline void RtmpDemuxer::_onGetH264(const char* pcData, int iLen, uint32_t ui32TimeStamp) {
switch (pcData[0] & 0x1F) {
case 5: {
onGetH264(_strSPS.data() + 4, _strSPS.length() - 4, ui32TimeStamp);
onGetH264(_strPPS.data() + 4, _strPPS.length() - 4, ui32TimeStamp);
}
case 1: {
onGetH264(pcData, iLen, ui32TimeStamp);
}
break;
default:
//WarnL <<(int)(pcData[0] & 0x1F);
break;
} }
} }
inline void RtmpDemuxer::onGetH264(const char* pcData, int iLen, uint32_t ui32TimeStamp) {
_h264frame.type = pcData[0] & 0x1F; void RtmpDemuxer::makeAudioTrack(const AMFValue &audioCodec) {
_h264frame.timeStamp = ui32TimeStamp; //生成Track对象
_h264frame.buffer.assign("\x0\x0\x0\x1", 4); //添加264头 _audioTrack = dynamic_pointer_cast<AudioTrack>(Factory::getTrackByAmf(audioCodec));
_h264frame.buffer.append(pcData, iLen); if (_audioTrack) {
{ //生成rtmpCodec对象以便解码rtmp
lock_guard<recursive_mutex> lck(_mtxCB); _audioRtmpDecoder = Factory::getRtmpCodecById(_audioTrack->getCodecId());
if (onVideo) { if (_audioRtmpDecoder) {
onVideo(_h264frame); //设置rtmp解码器代理生成的frame写入该Track
_audioRtmpDecoder->setDelegate(_audioTrack);
} else {
//找不到相应的rtmp解码器该track无效
_audioTrack.reset();
} }
} }
_h264frame.buffer.clear();
} }
inline bool RtmpDemuxer::inputAudio(const RtmpPacket::Ptr &pkt) { vector<Track::Ptr> RtmpDemuxer::getTracks() const {
if (pkt->isCfgFrame()) { vector<Track::Ptr> ret;
if (_strAudioCfg.size()) { if(_videoTrack){
return false; ret.emplace_back(_videoTrack);
} }
_strAudioCfg = pkt->getAacCfg(); if(_audioTrack){
_iSampleBit = pkt->getAudioSampleBit(); ret.emplace_back(_audioTrack);
makeAdtsHeader(_strAudioCfg,_adts);
getAACInfo(_adts, _iSampleRate, _iChannel);
return false;
} }
if (_strAudioCfg.size()) { return ret;
onGetAAC(pkt->strBuf.data() + 2, pkt->strBuf.size() - 2, pkt->timeStamp);
}
return false;
} }
inline void RtmpDemuxer::onGetAAC(const char* pcData, int iLen, uint32_t ui32TimeStamp) {
if(iLen + 7 > sizeof(_adts.buffer)){
WarnL << "Illegal adts data, exceeding the length limit.";
return;
}
//添加adts头
memcpy(_adts.buffer + 7, pcData, iLen);
_adts.aac_frame_length = 7 + iLen;
_adts.timeStamp = ui32TimeStamp;
writeAdtsHeader(_adts, _adts.buffer);
{
lock_guard<recursive_mutex> lck(_mtxCB);
if (onAudio) {
onAudio(_adts);
}
}
_adts.aac_frame_length = 7;
bool RtmpDemuxer::isInited() const {
bool ret = true;
if(ret && _audioTrack){
//getTrackType() 等于TrackInvalid时说明该Track还未准备好
ret = _audioTrack->getTrackType() != TrackInvalid;
}
if(ret && _videoTrack){
//getTrackType() 等于TrackInvalid时说明该Track还未准备好
ret = _videoTrack->getTrackType() != TrackInvalid;
}
return ret;
} }
inline void RtmpDemuxer::onCheckMedia(const AMFValue& obj) {
obj.object_for_each([&](const string &key ,const AMFValue& val) { float RtmpDemuxer::getDuration() const {
if(key == "duration") { return _fDuration;
_fDuration = val.as_number();
return;
}
if(key == "width") {
_iVideoWidth = val.as_number();
return;
}
if(key == "height") {
_iVideoHeight = val.as_number();
return;
}
if(key == "framerate") {
_fVideoFps = val.as_number();
return;
}
if(key == "audiosamplerate") {
_iSampleRate = val.as_number();
return;
}
if(key == "audiosamplesize") {
_iSampleBit = val.as_number();
return;
}
if(key == "stereo") {
_iChannel = val.as_boolean() ? 2 :1;
return;
}
});
} }

View File

@ -32,12 +32,11 @@
#include "Rtmp/amf.h" #include "Rtmp/amf.h"
#include "Rtmp/Rtmp.h" #include "Rtmp/Rtmp.h"
#include "Player/Player.h" #include "Player/Player.h"
#include "Util/TimeTicker.h"
#include "Player/PlayerBase.h" #include "Player/PlayerBase.h"
using namespace toolkit; #include "Util/TimeTicker.h"
#include "RtmpCodec.h"
#define H264_CODEC_ID 7 using namespace toolkit;
#define AAC_CODEC_ID 10
namespace mediakit { namespace mediakit {
@ -47,67 +46,61 @@ public:
RtmpDemuxer(const AMFValue &val); RtmpDemuxer(const AMFValue &val);
virtual ~RtmpDemuxer(); virtual ~RtmpDemuxer();
/**
*
* @param pkt rtmp包
* @return true i帧
*/
bool inputRtmp(const RtmpPacket::Ptr &pkt); bool inputRtmp(const RtmpPacket::Ptr &pkt);
bool isInited() const override{ /**
if((_iAudioCodecID | _iVideoCodecID) == 0){ *
//音视频codec_id都未获取到说明还未初始化成功 * @return
return false; */
} float getDuration() const override;
if((_iAudioCodecID & _iVideoCodecID) == 0 && _ticker.elapsedTime() < 300){
//音视频codec_id有其一未获取到,且最少分析300ms才能断定没有音频或视频 /**
return false; *
} * sps pps aac_cfg等这些信息
if (_iAudioCodecID && !_strAudioCfg.size()) { * inputRtmp后才会获取到这些信息
//如果音频是aac但是还未获取aac config ,则未初始化成功 * @return
return false; */
} bool isInited() const override;
if (_iVideoCodecID && !_strSPS.size()) {
//如果视频是h264但是还未获取sps ,则未初始化成功 /**
return false; * TrackisInited()true时调用
} * @return
//初始化成功 */
return true; vector<Track::Ptr> getTracks() const override;
} private:
float getDuration() const override{ void makeVideoTrack(const AMFValue &val);
return _fDuration; void makeAudioTrack(const AMFValue &val);
}
private: private:
inline void onCheckMedia(const AMFValue &obj);
//返回值true 代表是i帧第一个rtp包
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);
//video
H264Frame _h264frame;
//aduio
AACFrame _adts;
int _iSampleRate = 44100;
int _iSampleBit = 16;
int _iChannel = 1;
string _strSPS;
string _strPPS;
string _strAudioCfg;
int _iVideoWidth = 0;
int _iVideoHeight = 0;
float _fVideoFps = 0;
//音视频codec_id初始为0代表尚未获取到
int _iAudioCodecID = 0;
int _iVideoCodecID = 0;
float _fDuration = 0; float _fDuration = 0;
mutable Ticker _ticker; bool _tryGetVideoTrack = false;
function<void(const H264Frame &frame)> onVideo; bool _tryGetAudioTrack = false;
function<void(const AACFrame &frame)> onAudio; AudioTrack::Ptr _audioTrack;
recursive_mutex _mtxCB; VideoTrack::Ptr _videoTrack;
RtmpCodec::Ptr _audioRtmpDecoder;
RtmpCodec::Ptr _videoRtmpDecoder;
}; };
} /* namespace mediakit */ } /* namespace mediakit */
#endif /* SRC_RTMP_RTMPDEMUXER_H_ */ #endif /* SRC_RTMP_RTMPDEMUXER_H_ */

View File

@ -56,11 +56,11 @@ RtspDemuxer::RtspDemuxer(const string& sdp) {
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
switch (tmp[i].type) { switch (tmp[i].type) {
case TrackVideo: { case TrackVideo: {
onGetVideoTrack(tmp[i]); makeVideoTrack(tmp[i]);
} }
break; break;
case TrackAudio: { case TrackAudio: {
onGetAudioTrack(tmp[i]); makeAudioTrack(tmp[i]);
} }
break; break;
default: default:
@ -79,16 +79,19 @@ bool RtspDemuxer::inputRtp(const RtpPacket::Ptr & rtp) {
return false; return false;
} }
case TrackAudio:{ case TrackAudio:{
if(_audioRtpDecoder){
_audioRtpDecoder->inputRtp(rtp, false); _audioRtpDecoder->inputRtp(rtp, false);
return false; return false;
} }
return false;
}
default: default:
return false; return false;
} }
} }
inline void RtspDemuxer::onGetAudioTrack(const RtspTrack& audio) { void RtspDemuxer::makeAudioTrack(const RtspTrack &audio) {
//生成Track对象 //生成Track对象
_audioTrack = dynamic_pointer_cast<AudioTrack>(Factory::getTrackBySdp(audio.trackSdp)); _audioTrack = dynamic_pointer_cast<AudioTrack>(Factory::getTrackBySdp(audio.trackSdp));
if(_audioTrack){ if(_audioTrack){
@ -97,11 +100,14 @@ inline void RtspDemuxer::onGetAudioTrack(const RtspTrack& audio) {
if(_audioRtpDecoder){ if(_audioRtpDecoder){
//设置rtp解码器代理生成的frame写入该Track //设置rtp解码器代理生成的frame写入该Track
_audioRtpDecoder->setDelegate(_audioTrack); _audioRtpDecoder->setDelegate(_audioTrack);
} else{
//找不到相应的rtp解码器该track无效
_audioTrack.reset();
} }
} }
} }
inline void RtspDemuxer::onGetVideoTrack(const RtspTrack& video) { void RtspDemuxer::makeVideoTrack(const RtspTrack &video) {
//生成Track对象 //生成Track对象
_videoTrack = dynamic_pointer_cast<VideoTrack>(Factory::getTrackBySdp(video.trackSdp)); _videoTrack = dynamic_pointer_cast<VideoTrack>(Factory::getTrackBySdp(video.trackSdp));
if(_videoTrack){ if(_videoTrack){
@ -110,6 +116,9 @@ inline void RtspDemuxer::onGetVideoTrack(const RtspTrack& video) {
if(_videoRtpDecoder){ if(_videoRtpDecoder){
//设置rtp解码器代理生成的frame写入该Track //设置rtp解码器代理生成的frame写入该Track
_videoRtpDecoder->setDelegate(_videoTrack); _videoRtpDecoder->setDelegate(_videoTrack);
}else{
//找不到相应的rtp解码器该track无效
_videoTrack.reset();
} }
} }
} }
@ -125,5 +134,22 @@ vector<Track::Ptr> RtspDemuxer::getTracks() const {
return ret; return ret;
} }
bool RtspDemuxer::isInited() const {
bool ret = true;
if(ret && _audioTrack){
//getTrackType() 等于TrackInvalid时说明该Track还未准备好
ret = _audioTrack->getTrackType() != TrackInvalid;
}
if(ret && _videoTrack){
//getTrackType() 等于TrackInvalid时说明该Track还未准备好
ret = _videoTrack->getTrackType() != TrackInvalid;
}
return ret;
}
float RtspDemuxer::getDuration() const {
return _fDuration;
}
} /* namespace mediakit */ } /* namespace mediakit */

View File

@ -45,12 +45,18 @@ public:
RtspDemuxer(const string &sdp); RtspDemuxer(const string &sdp);
virtual ~RtspDemuxer(){}; virtual ~RtspDemuxer(){};
//返回值true 代表是i帧第一个rtp包 /**
*
* @param rtp rtp包
* @return true i帧第一个rtp包
*/
bool inputRtp(const RtpPacket::Ptr &rtp); bool inputRtp(const RtpPacket::Ptr &rtp);
float getDuration() const override { /**
return _fDuration; *
} * @return
*/
float getDuration() const override;
/** /**
* *
@ -58,21 +64,16 @@ public:
* sps的rtp包后才能完成 * sps的rtp包后才能完成
* @return * @return
*/ */
bool isInited() const override{ bool isInited() const override;
bool ret = true;
if(ret && _audioTrack){
ret = _audioTrack->getTrackType() != TrackInvalid;
}
if(ret && _videoTrack){
ret = _videoTrack->getTrackType() != TrackInvalid;
}
return ret;
}
/**
* TrackisInited()true时调用
* @return
*/
vector<Track::Ptr> getTracks() const override; vector<Track::Ptr> getTracks() const override;
private: private:
inline void onGetAudioTrack(const RtspTrack &audio); void makeAudioTrack(const RtspTrack &audio);
inline void onGetVideoTrack(const RtspTrack &video); void makeVideoTrack(const RtspTrack &video);
private: private:
float _fDuration = 0; float _fDuration = 0;
AudioTrack::Ptr _audioTrack; AudioTrack::Ptr _audioTrack;