|
@@ -73,7 +73,7 @@
|
|
|
#endif
|
|
|
|
|
|
#ifndef RVC_SLEEP_TIME
|
|
|
-#define RVC_SLEEP_TIME 7000
|
|
|
+#define RVC_SLEEP_TIME 1000
|
|
|
#endif
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
@@ -1339,7 +1339,7 @@ int libwmvrecord_impl::VideoRecord()
|
|
|
{
|
|
|
struct timespec ts;
|
|
|
clock_gettime(CLOCK_REALTIME, &ts);
|
|
|
- long unsec = ts.tv_nsec + (1000 * 1000 * 20);
|
|
|
+ long unsec = ts.tv_nsec + (1000 * 1000 * 10);
|
|
|
ts.tv_sec += (unsec / 1000000000);
|
|
|
ts.tv_nsec = (unsec % 1000000000);
|
|
|
if (0 != sem_timedwait(&m_semt, &ts) && (ETIMEDOUT == errno))
|
|
@@ -1471,6 +1471,9 @@ int libwmvrecord_impl::VideoRecord()
|
|
|
bInitWmvParam = TRUE;
|
|
|
//当第一次记录时删除当前音频只剩下1帧,使音视频数据能够同步
|
|
|
m_audioqueue->ClearAudioQueue();
|
|
|
+ if (eStand2Agent == m_eRecordType) {
|
|
|
+ m_remoteaudioqueue->ClearAudioQueue();
|
|
|
+ }
|
|
|
nRecordStartTime = timeGetTime();//本段录像开始时间
|
|
|
continue;
|
|
|
}
|
|
@@ -1714,23 +1717,29 @@ int libwmvrecord_impl::VideoRecord()
|
|
|
bGetRemoteAudio = m_remoteaudioqueue->GetAudio(RemoteAudio);
|
|
|
}
|
|
|
|
|
|
- if (bGetRemoteAudio && (iremoteseriesnumber != RemoteAudio->iseriesnumber)) {
|
|
|
+ if (bGetRemoteAudio) {
|
|
|
m_pHostApi->Debug("record get remote audio series number is %d.", RemoteAudio->iseriesnumber);
|
|
|
- if (m_bIsAudioNsOn && NULL != m_pAudioNsObj) {
|
|
|
- char pOutAudio[MAX_PATH * 3] = { 0 };
|
|
|
- int iRet = m_pAudioNsObj->NsProcess(pOutAudio, RemoteAudio->framesize, RemoteAudio->data, RemoteAudio->framesize);
|
|
|
- if (0 == iRet) {
|
|
|
- //m_pHostApi->Debug("remote audio ns process success!");
|
|
|
- memset(pRemoteAudioBufTmp + nRemoteAudioBufferLens, 0, RemoteAudio->framesize);
|
|
|
- memcpy(pRemoteAudioBufTmp + nRemoteAudioBufferLens, pOutAudio, RemoteAudio->framesize);
|
|
|
+ if (iremoteseriesnumber != RemoteAudio->iseriesnumber) {
|
|
|
+ if (m_bIsAudioNsOn && NULL != m_pAudioNsObj) {
|
|
|
+ char pOutAudio[MAX_PATH * 3] = { 0 };
|
|
|
+ int iRet = m_pAudioNsObj->NsProcess(pOutAudio, RemoteAudio->framesize, RemoteAudio->data, RemoteAudio->framesize);
|
|
|
+ if (0 == iRet) {
|
|
|
+ //m_pHostApi->Debug("remote audio ns process success!");
|
|
|
+ memset(pRemoteAudioBufTmp + nRemoteAudioBufferLens, 0, RemoteAudio->framesize);
|
|
|
+ memcpy(pRemoteAudioBufTmp + nRemoteAudioBufferLens, pOutAudio, RemoteAudio->framesize);
|
|
|
+ }
|
|
|
}
|
|
|
+ nRemoteAudioBufferLens += RemoteAudio->framesize;
|
|
|
+ nRemoteAudioNum++;
|
|
|
+ iremoteseriesnumber = RemoteAudio->iseriesnumber;
|
|
|
}
|
|
|
- nRemoteAudioBufferLens += RemoteAudio->framesize;
|
|
|
- nRemoteAudioNum++;
|
|
|
- iremoteseriesnumber = RemoteAudio->iseriesnumber;
|
|
|
+ else {
|
|
|
+ m_pHostApi->Debug("remote audio frame (%d) has been recored!", RemoteAudio->iseriesnumber);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
- //m_pHostApi->Debug("get audio from m_remoteaudioqueue failed.");
|
|
|
+ m_pHostApi->Debug("get audio from m_remoteaudioqueue failed.");
|
|
|
usleep(RVC_SLEEP_TIME);
|
|
|
}
|
|
|
delete RemoteAudio;
|
|
@@ -1748,28 +1757,33 @@ int libwmvrecord_impl::VideoRecord()
|
|
|
else {
|
|
|
bGetAudio = m_audioqueue->GetAudio(audioframe);
|
|
|
}
|
|
|
- if (bGetAudio && (ilocalseriesnumber != audioframe->iseriesnumber)) {
|
|
|
+ if (bGetAudio) {
|
|
|
m_pHostApi->Debug("record get local audio series number is %d.", audioframe->iseriesnumber);
|
|
|
- if (CAPTURE_CLOCK == audioframe->samplespersec) {
|
|
|
- if (m_bIsAudioNsOn && NULL != m_pAudioNsObj) {
|
|
|
- char pOutAudio[MAX_PATH * 3] = { 0 };
|
|
|
- int iRet = m_pAudioNsObj->NsProcess(pOutAudio, audioframe->framesize, audioframe->data, audioframe->framesize);
|
|
|
- if (0 == iRet) {
|
|
|
- //m_pHostApi->Debug("local audio ns process success!");
|
|
|
- memset(m_pAudioBufferTmp + nAudioBufferLens, 0, audioframe->framesize);
|
|
|
- memcpy(m_pAudioBufferTmp + nAudioBufferLens, pOutAudio, audioframe->framesize);
|
|
|
+ if (ilocalseriesnumber != audioframe->iseriesnumber) {
|
|
|
+ if (CAPTURE_CLOCK == audioframe->samplespersec) {
|
|
|
+ if (m_bIsAudioNsOn && NULL != m_pAudioNsObj) {
|
|
|
+ char pOutAudio[MAX_PATH * 3] = { 0 };
|
|
|
+ int iRet = m_pAudioNsObj->NsProcess(pOutAudio, audioframe->framesize, audioframe->data, audioframe->framesize);
|
|
|
+ if (0 == iRet) {
|
|
|
+ //m_pHostApi->Debug("local audio ns process success!");
|
|
|
+ memset(m_pAudioBufferTmp + nAudioBufferLens, 0, audioframe->framesize);
|
|
|
+ memcpy(m_pAudioBufferTmp + nAudioBufferLens, pOutAudio, audioframe->framesize);
|
|
|
+ }
|
|
|
}
|
|
|
+ nAudioBufferLens += audioframe->framesize;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ m_pHostApi->OnRecordFailed("not support audio sample rate.");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ nAudioFromQueNum++;
|
|
|
+ ilocalseriesnumber = audioframe->iseriesnumber;
|
|
|
+ if ((0 == nAudioFromQueNum % 100) && (0 != audioframe->iseriesnumber)) {
|
|
|
+ //m_pHostApi->Debug("not single side record,and current local audio queue len is %d audio series number is: %d.", nAudioLens, audioframe->iseriesnumber);
|
|
|
}
|
|
|
- nAudioBufferLens += audioframe->framesize;
|
|
|
}
|
|
|
else {
|
|
|
- m_pHostApi->OnRecordFailed("not support audio sample rate.");
|
|
|
- break;
|
|
|
- }
|
|
|
- nAudioFromQueNum++;
|
|
|
- ilocalseriesnumber = audioframe->iseriesnumber;
|
|
|
- if ((0 == nAudioFromQueNum % 100) && (0 != audioframe->iseriesnumber)) {
|
|
|
- //m_pHostApi->Debug("not single side record,and current local audio queue len is %d audio series number is: %d.", nAudioLens, audioframe->iseriesnumber);
|
|
|
+ m_pHostApi->Debug("local audio frame (%d) has been recored!", audioframe->iseriesnumber);
|
|
|
}
|
|
|
}
|
|
|
else {
|