修复mp4v2在win32上崩溃的问题

This commit is contained in:
xiongziliang 2018-05-22 17:22:31 +08:00
parent 9c53248e39
commit 7c29c41767
2 changed files with 8 additions and 7 deletions

View File

@ -48,6 +48,7 @@ HLSMaker::HLSMaker(const string& strM3u8File,
m_strM3u8File = strM3u8File; m_strM3u8File = strM3u8File;
m_ui32NumSegments = ui32Num; m_ui32NumSegments = ui32Num;
m_ui32SegmentDuration = ui32Duration; m_ui32SegmentDuration = ui32Duration;
m_ui32LastStamp = 0;
m_strOutputPrefix = strM3u8File.substr(0, strM3u8File.rfind('.')); m_strOutputPrefix = strM3u8File.substr(0, strM3u8File.rfind('.'));
m_strFileName = m_strOutputPrefix.substr(m_strOutputPrefix.rfind('/') + 1); m_strFileName = m_strOutputPrefix.substr(m_strOutputPrefix.rfind('/') + 1);

View File

@ -70,17 +70,17 @@ MediaReader::MediaReader(const string &strVhost,const string &strApp, const stri
getAVCInfo(m_strSps, (int &)m_video_width, (int &)m_video_height, framerate); getAVCInfo(m_strSps, (int &)m_video_width, (int &)m_video_height, framerate);
m_video_framerate = framerate; m_video_framerate = framerate;
m_strSps = string("\x0\x0\x0\x1",4) + m_strSps; m_strSps = string("\x0\x0\x0\x1",4) + m_strSps;
free(seqheader[ix]); MP4Free(seqheader[ix]);
} }
free(seqheader); MP4Free(seqheader);
free(seqheadersize); MP4Free(seqheadersize);
for (ix = 0; pictheadersize[ix] != 0; ix++) { for (ix = 0; pictheadersize[ix] != 0; ix++) {
m_strPps.assign("\x0\x0\x0\x1",4); m_strPps.assign("\x0\x0\x0\x1",4);
m_strPps.append((char *)(pictheader[ix]), pictheadersize[ix]); m_strPps.append((char *)(pictheader[ix]), pictheadersize[ix]);
free(pictheader[ix]); MP4Free(pictheader[ix]);
} }
free(pictheader); MP4Free(pictheader);
free(pictheadersize); MP4Free(pictheadersize);
} }
m_video_ms = 1000.0 * m_video_duration / m_video_timescale; m_video_ms = 1000.0 * m_video_duration / m_video_timescale;
/*InfoL << "\r\n" /*InfoL << "\r\n"
@ -111,7 +111,7 @@ MediaReader::MediaReader(const string &strVhost,const string &strApp, const stri
makeAdtsHeader(m_strAacCfg, m_adts); makeAdtsHeader(m_strAacCfg, m_adts);
writeAdtsHeader(m_adts,m_adts.data); writeAdtsHeader(m_adts,m_adts.data);
getAACInfo(m_adts, (int &)m_audio_sample_rate, (int &)m_audio_num_channels); getAACInfo(m_adts, (int &)m_audio_sample_rate, (int &)m_audio_num_channels);
free(ppConfig); MP4Free(ppConfig);
} }
m_audio_ms = 1000.0 * m_audio_duration / m_audio_sample_rate; m_audio_ms = 1000.0 * m_audio_duration / m_audio_sample_rate;
/*InfoL << "\r\n" /*InfoL << "\r\n"