内部生成时间戳

This commit is contained in:
xiongziliang 2018-03-02 15:00:04 +08:00
parent 28cc1433e5
commit 3726721dd9
2 changed files with 8 additions and 0 deletions

View File

@ -117,6 +117,9 @@ void DevChannel::inputH264(char* pcData, int iDataLen, uint32_t uiStamp) {
if (memcmp("\x00\x00\x01", pcData, 3) == 0) { if (memcmp("\x00\x00\x01", pcData, 3) == 0) {
iOffset = 3; iOffset = 3;
} }
if(uiStamp == 0){
uiStamp = (uint32_t)m_aTicker[0].elapsedTime();
}
m_pRtpMaker_h264->makeRtp(pcData + iOffset, iDataLen - iOffset, uiStamp); m_pRtpMaker_h264->makeRtp(pcData + iOffset, iDataLen - iOffset, uiStamp);
} }
@ -136,6 +139,9 @@ void DevChannel::inputAAC(char *pcDataWithoutAdts,int iDataLen, uint32_t uiStamp
if (!m_bSdp_gotAAC && m_audio && pcAdtsHeader) { if (!m_bSdp_gotAAC && m_audio && pcAdtsHeader) {
makeSDP_AAC((unsigned char*) pcAdtsHeader); makeSDP_AAC((unsigned char*) pcAdtsHeader);
} }
if(uiStamp == 0){
uiStamp = (uint32_t)m_aTicker[1].elapsedTime();
}
if(pcDataWithoutAdts && iDataLen){ if(pcDataWithoutAdts && iDataLen){
m_pRtpMaker_aac->makeRtp(pcDataWithoutAdts, iDataLen, uiStamp); m_pRtpMaker_aac->makeRtp(pcDataWithoutAdts, iDataLen, uiStamp);
} }

View File

@ -34,6 +34,7 @@
#include "RTP/RtpMakerAAC.h" #include "RTP/RtpMakerAAC.h"
#include "RTP/RtpMakerH264.h" #include "RTP/RtpMakerH264.h"
#include "Rtsp/RtspToRtmpMediaSource.h" #include "Rtsp/RtspToRtmpMediaSource.h"
#include "Util/TimeTicker.h"
using namespace std; using namespace std;
using namespace ZL::Rtsp; using namespace ZL::Rtsp;
@ -115,6 +116,7 @@ private:
unsigned int m_uiPPSLen = 0; unsigned int m_uiPPSLen = 0;
std::shared_ptr<VideoInfo> m_video; std::shared_ptr<VideoInfo> m_video;
std::shared_ptr<AudioInfo> m_audio; std::shared_ptr<AudioInfo> m_audio;
SmoothTicker m_aTicker[2];
}; };