|
@@ -686,7 +686,9 @@ int libvideorecord_impl::VideoRecord()
|
|
|
}
|
|
|
bInitRecordParam = true;
|
|
|
//当第一次记录时删除当前音频只剩下1帧,使音视频数据能够同步
|
|
|
- m_audioqueue->ClearAudioQueue();
|
|
|
+ if (m_audioqueue) {
|
|
|
+ m_audioqueue->ClearAudioQueue();
|
|
|
+ }
|
|
|
nRecordStartTime = timeGetTime();//本段录像开始时间
|
|
|
}
|
|
|
|
|
@@ -735,6 +737,11 @@ int libvideorecord_impl::VideoRecord()
|
|
|
ReNameVideo();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (m_bPauseRecord) {
|
|
|
+ m_pHostApi->Debug(RECORD_LOG_DEBUG, "reset media queue.");
|
|
|
+ ResetMediaQueue();
|
|
|
+ }
|
|
|
}
|
|
|
else{
|
|
|
if (eStand2Agent == m_eRecordType) {
|
|
@@ -1746,6 +1753,7 @@ void libvideorecord_impl::vDebug(const char* str, va_list list)
|
|
|
|
|
|
bool libvideorecord_impl::ContinueRecord() //继续录像
|
|
|
{
|
|
|
+ m_pHostApi->Debug(RECORD_LOG_DEBUG, "continue record");
|
|
|
#ifdef _WIN32
|
|
|
#else
|
|
|
InitAudioQueue();
|
|
@@ -1793,13 +1801,9 @@ bool libvideorecord_impl::StopVideoRecord() //退出
|
|
|
|
|
|
bool libvideorecord_impl::PauseRecord() //暂停录像
|
|
|
{
|
|
|
+ m_pHostApi->Debug(RECORD_LOG_DEBUG, "pause record");
|
|
|
m_bPauseRecord = true;
|
|
|
-#ifdef _WIN32
|
|
|
-#else
|
|
|
- RECORD_SAFE_DELETE(m_local_audioqueue);
|
|
|
- RECORD_SAFE_DELETE(m_env_videoqueue);
|
|
|
- RECORD_SAFE_DELETE(m_opt_videoqueue);
|
|
|
-#endif
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -2093,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 {
|
|
@@ -2134,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);
|
|
@@ -2359,4 +2367,16 @@ bool libvideorecord_impl::InitVideoRecordParams()
|
|
|
bRet = true;
|
|
|
|
|
|
return bRet;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+bool libvideorecord_impl::ResetMediaQueue()
|
|
|
+{
|
|
|
+#ifdef _WIN32
|
|
|
+#else
|
|
|
+ RECORD_SAFE_DELETE(m_local_audioqueue);
|
|
|
+ RECORD_SAFE_DELETE(m_env_videoqueue);
|
|
|
+ RECORD_SAFE_DELETE(m_opt_videoqueue);
|
|
|
+#endif
|
|
|
+ return true;
|
|
|
}
|