|
@@ -686,7 +686,9 @@ int libvideorecord_impl::VideoRecord()
|
|
|
}
|
|
|
bInitRecordParam = true;
|
|
|
//当第一次记录时删除当前音频只剩下1帧,使音视频数据能够同步
|
|
|
- m_audioqueue->ClearAudioQueue();
|
|
|
+ if (m_audioqueue) {
|
|
|
+ m_audioqueue->ClearAudioQueue();
|
|
|
+ }
|
|
|
nRecordStartTime = timeGetTime();//本段录像开始时间
|
|
|
}
|
|
|
|
|
@@ -2095,7 +2097,7 @@ bool libvideorecord_impl::GetLocalAudioFrame(int iAudioLens)
|
|
|
//取出音频
|
|
|
m_audioframe->data = m_pRecordAudioBuffer + m_iAudioBufferLen;
|
|
|
bool bGetAudio = false;
|
|
|
- if (iAudioLens <= MAX_AUDIOQUEUE_LENS) {
|
|
|
+ if (m_audioqueue && (iAudioLens <= MAX_AUDIOQUEUE_LENS)) {
|
|
|
bGetAudio = m_audioqueue->GetAudioAndDel(m_audioframe);
|
|
|
}
|
|
|
else {
|
|
@@ -2136,7 +2138,11 @@ bool libvideorecord_impl::GetSingleSideAudioFrame()
|
|
|
{
|
|
|
bool bRet = false;
|
|
|
//取音频数据,合并成1s的音频
|
|
|
- int nAudioLens = m_audioqueue->GetAudioLens();
|
|
|
+ int nAudioLens = 0;
|
|
|
+ if (m_audioqueue) {
|
|
|
+ nAudioLens = m_audioqueue->GetAudioLens();
|
|
|
+ }
|
|
|
+
|
|
|
if (nAudioLens > 0) {
|
|
|
if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {
|
|
|
bRet = GetLocalAudioFrame(nAudioLens);
|