Эх сурвалжийг харах

Z991239-5574 #comment 增加音频设备状态信息变量

80274480 1 жил өмнө
parent
commit
72f06e38f3

+ 5 - 0
Module/mod_counterconnector/Event.h

@@ -137,3 +137,8 @@
 #define LOG_WARN_COUNTERCONNECT_FAILED_NETWORK_FAILURE				0x30460605	 //network failure
 
 
+//sysvar
+#define SYSVAR_CALLSTATE	"CallState"
+#define CALLSTATE_OFFLINE	"O"
+#define CALLSTATE_HANDFREE	"H" // HandFree
+#define CALLSTATE_PICKUP	"P" // Pickup

+ 0 - 1
Module/mod_mediacontroller/Event.h

@@ -108,6 +108,5 @@
 #define ERROR_MOD_MEDIACONTROLLER_VIDEO_AUTO_MATHED_SUCCESS		0x20899001  //摄像头自动匹配成功
 #define ERROR_MOD_MEDIACONTROLLER_VIDEO_AUTO_MATHED_FAILED		0x20899002  //摄像头自动匹配失败
 
-#define SYSVAR_CALLSTATE	"CallState"
 
 

+ 1 - 0
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -10,6 +10,7 @@
 #include "mod_mediacontroller.h"
 #include "../mod_interactivecontrol/Event.h"
 #include "../mod_recorder/Event.h"
+#include "../mod_counterconnector/Event.h"
 
 #ifndef AUTOMATCH_CAMERA_ENV
 #define AUTOMATCH_CAMERA_ENV	"ENV_"

+ 8 - 6
Module/mod_sipphone/Event.h

@@ -194,12 +194,6 @@
 #define LOG_EVT_UI_HIDEPERSONAREA									0x30B00014	//隐藏人形框
 #define LOG_EVT_UI_SHOWPERSONAREA									0x30B00015	//显示隐藏人形框
 
-//sysvar
-#define SYSVAR_CALLSTATE	"CallState"
-#define CALLSTATE_OFFLINE	"O"
-#define CALLSTATE_HANDFREE	"H" // HandFree
-#define CALLSTATE_PICKUP	"P" // Pickup
-
 	
 #define LOG_EVT_UI_STARTRECORD					0x30B00001				//开始录像
 #define LOG_EVT_UI_STOPRECORD					0x30B00002				//停止录像
@@ -213,3 +207,11 @@
 
 #define ACM_CONTROL_PERSONAREA		0x30 // 控制人形框,0:隐藏,1:显示
 
+
+//sysvar
+#define SYSVAR_SOUNDCARDSTATE	"SoundCardState"
+#define SOUNDCARD_NO_ERROR			"N"
+#define SOUNDCARD_HANDFREE_ERROR	"H"
+#define SOUNDCARD_PICKUP_ERROR		"P"
+#define SOUNDCARD_BOTH_ERROR		"B"
+

+ 1 - 1
Other/unix/libaudioqueue/libaudioqueue.h

@@ -21,7 +21,7 @@
 
 using namespace std ;
 
-#define MAX_AUDIOQUEUE_LENS     45					//音频队列最大节点数量
+#define MAX_AUDIOQUEUE_LENS     50					//音频队列最大节点数量
 #define MAX_AUDIOQNODE_SIZE     16000				//音频队列单个节点默认最大长度
 
 typedef struct audio_frame 

+ 78 - 40
Other/unix/libvideorecord/libvideorecord_impl.cpp

@@ -127,11 +127,11 @@ static bool FindMatchedFile(const char* sFindPath, const char* sFindFileName, st
 
 static bool ReNameFile(const char* file, const char* newfilename)
 {
-#ifdef RVC_OS_WIN
+#ifdef _WIN32
 	if (!_access(file, 0))
 #else
 	if (!access(file, F_OK))
-#endif //RVC_OS_WIN
+#endif //_WIN32
 	{
 		if (!rename(file, newfilename)){
 			return true;
@@ -1262,20 +1262,28 @@ int libvideorecord_impl::GetDoubleCameraVideoFrameData(videoq_frame* Video, int
 }
 
 
-bool libvideorecord_impl::IsRecordingCamError(int iRecordingCam)
+bool libvideorecord_impl::IsRecordingCamError(int iRecordingCam, eRvcRecordType eRecordType)
 {
 	bool bRet = false;
-	if (0 == iRecordingCam) {
-		if ('E' == m_pHostApi->GetCameraState() || 'B' == m_pHostApi->GetCameraState()) {
-			bRet = true;
+	if (eStand2Agent == eRecordType) {
+		if (0 == iRecordingCam) {
+			if ('E' == m_pHostApi->GetCameraState() || 'B' == m_pHostApi->GetCameraState()) {
+				bRet = true;
+			}
+		}
+		else {
+			if ('O' == m_pHostApi->GetCameraState() || 'B' == m_pHostApi->GetCameraState() || 'E' == m_pHostApi->GetCameraState()) {
+				bRet = true;
+			}
 		}
 	}
 	else {
-		if ('O' == m_pHostApi->GetCameraState() || 'B' == m_pHostApi->GetCameraState() || 'E' == m_pHostApi->GetCameraState()) {
+		if ('B' == m_pHostApi->GetCameraState()) {
 			bRet = true;
 		}
 	}
 
+
 	return bRet;
 }
 
@@ -1877,6 +1885,23 @@ int libvideorecord_impl::WriteVideoFrame()
 				return -1;
 			}
 		}
+		else {
+			if (IsRecordingCamError(nInitActiveCam, eSingleSide)) {
+				LogFailedEvent(eVideoGetFailed, "recording camera error!");
+				return -1;
+			}
+			else {
+				struct timespec ts;
+				clock_gettime(CLOCK_REALTIME, &ts);
+				long unsec = ts.tv_nsec + (1000 * 1000 * 2);
+				ts.tv_sec += (unsec / 1000000000);
+				ts.tv_nsec = (unsec % 1000000000);
+				if (0 != sem_timedwait(&m_semt, &ts) && (ETIMEDOUT == errno)) {
+
+				}
+				return -2;
+			}
+		}
 	}
 
 	return iret;
@@ -1971,7 +1996,7 @@ bool libvideorecord_impl::GetLocalAudioFrame(int iAudioLens)
 			bRet = true;
 		}
 		else {
-			m_pHostApi->Debug(RECORD_LOG_ERROR, "not support audio sample rate, and audio samplespersec=%d.", m_audioframe->samplespersec);
+			m_pHostApi->Debug(RECORD_LOG_ERROR, "not support audio sample rate, and audio samplespersec=%d,framesize=%d,channels=%d,format=%d,bitspersample=%d,series number=%d.", m_audioframe->samplespersec, m_audioframe->framesize, m_audioframe->nchannels, m_audioframe->format, m_audioframe->bitspersample, m_audioframe->iseriesnumber);
 			LogFailedEvent(eSampNotSupport, "not support audio sample rate.");
 		}
 	}
@@ -2007,6 +2032,32 @@ bool libvideorecord_impl::GetSingleSideAudioFrame()
 }
 
 
+bool libvideorecord_impl::AddMuteAudioFrame(bool bLocal, int iAudioFrameSize)
+{
+	bool bRet = false;
+
+	if (0 == iAudioFrameSize) {
+		return bRet;
+	}
+
+	if (bLocal) {
+		memset(m_pRecordAudioBuffer + m_iAudioBufferLen, 0, iAudioFrameSize);
+		m_iAudioBufferLen += iAudioFrameSize;
+		m_iAudioFromQueNum++;
+		m_pHostApi->Debug(RECORD_LOG_INFO, "m_iAudioFromQueNum is %d(Mute AudioFrame).", m_iAudioFromQueNum);
+		bRet = true;
+	}
+	else {
+		memset(m_pRemoteAudioBuffer + m_iRemoteAudioBufLen, 0, iAudioFrameSize);
+		m_iRemoteAudioBufLen += iAudioFrameSize;
+		m_iRemoteAudioNum++;
+		m_pHostApi->Debug(RECORD_LOG_INFO, "m_iRemoteAudioNum is %d(Mute Audio Frame).", m_iRemoteAudioNum);
+		bRet = true;
+	}
+
+	return bRet;
+}
+
 bool libvideorecord_impl::GetRecordAudioFrame()
 {
 	bool bRet = false;
@@ -2019,45 +2070,32 @@ bool libvideorecord_impl::GetRecordAudioFrame()
 		int nAudioLens = m_audioqueue->GetAudioLens();
 		int nRemoteAudioLens = m_remote_audioqueue->GetAudioLens();
 		m_pHostApi->Debug(RECORD_LOG_DEBUG,"current local audio length is %d, and remote audio length is %d.", nAudioLens, nRemoteAudioLens);
-		if ((nAudioLens > 0) && (nRemoteAudioLens <= 0)) {
-			if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {	//取出音频
+		//1. 取本地音频
+		if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {
+			if (nAudioLens > 0) {//取到本地音频
 				bRet = GetLocalAudioFrame(nAudioLens);
 			}
-		}
-		else if ((nAudioLens > 0) && (nRemoteAudioLens > 0)) {
-			if (m_iRemoteAudioBufLen < m_iAudioPerSecBufLen) {  //收到的远端音频不够1秒
-				bRet = GetRemoteAudioFrame(nRemoteAudioLens);	//取远端音频
+			else {//本地音频队列为空,用静音填充
+				bRet = AddMuteAudioFrame(true, m_iAudioPerSecBufLen/50);
 			}
+		}
 
-			if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {
-				bRet = GetLocalAudioFrame(nAudioLens);	//本地音频
+		//2. 取远端音频
+		if (m_iRemoteAudioBufLen < m_iAudioPerSecBufLen) {  
+			if (nRemoteAudioLens > 0) {
+				bRet = GetRemoteAudioFrame(nRemoteAudioLens);	//取远端音频
 			}
-			//混音
-			if ((m_iRemoteAudioBufLen == m_iAudioPerSecBufLen) && (m_iAudioBufferLen == m_iAudioPerSecBufLen)) {
-				//可视远程双录场景,本地和坐席端分别录制到左右声道
-				uint32_t uOutlen = BindPCMAudioData(m_iRecordAudioBufSize, m_pRecordAudioBuffer, m_iAudioBufferLen, m_pRemoteAudioBuffer, m_iRemoteAudioBufLen, m_audioframe->bitspersample / 8, eLocalLeft);
-				m_pHostApi->Debug(RECORD_LOG_DEBUG, "double channel buffer length is %d, local buffer len is %d, remote buffer len is %d.", m_iRecordAudioBufSize, m_iAudioBufferLen, m_iRemoteAudioBufLen);
-				m_iAudioBufferLen = uOutlen;
+			else{
+				bRet = AddMuteAudioFrame(false, m_iAudioPerSecBufLen / 50);
 			}
 		}
-		else if ((nAudioLens <= 0) && (nRemoteAudioLens > 0)) {  //本地端无数据不混音,双录语音播报场景
-			if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {		 //取出音频
-				m_audioframe->data = m_pRecordAudioBuffer + m_iAudioBufferLen;
-				bool bGetAudio = false;
-				if (nRemoteAudioLens <= MAX_AUDIOQUEUE_LENS && nRemoteAudioLens > 1) {
-					bGetAudio = m_remote_audioqueue->GetAudioAndDel(m_audioframe);
-				}
-				else {
-					bGetAudio = m_remote_audioqueue->GetAudio(m_audioframe);
-				}
 
-				if (bGetAudio) {
-					m_pHostApi->Debug(RECORD_LOG_DEBUG,"remote audio series number is %d, channels is %d, samplespersec is %d.", m_audioframe->iseriesnumber, m_audioframe->nchannels, m_audioframe->samplespersec);
-					m_iAudioBufferLen += m_audioframe->framesize;
-					m_iAudioFromQueNum++;
-					m_pHostApi->Debug(RECORD_LOG_DEBUG,"m_iAudioFromQueNum is %d.", m_iAudioFromQueNum);
-				}
-			}
+		//3. 可视远程双录场景,本地和坐席端分别录制到左右声道
+		if ((m_iRemoteAudioBufLen == m_iAudioPerSecBufLen) && (m_iAudioBufferLen == m_iAudioPerSecBufLen)) {
+			
+			uint32_t uOutlen = BindPCMAudioData(m_iRecordAudioBufSize, m_pRecordAudioBuffer, m_iAudioBufferLen, m_pRemoteAudioBuffer, m_iRemoteAudioBufLen, m_audioframe->bitspersample / 8, eLocalLeft);
+			m_pHostApi->Debug(RECORD_LOG_DEBUG, "double channel buffer length is %d, local buffer len is %d, remote buffer len is %d.", m_iRecordAudioBufSize, m_iAudioBufferLen, m_iRemoteAudioBufLen);
+			m_iAudioBufferLen = uOutlen;
 		}
 	}
 	m_pHostApi->Debug(RECORD_LOG_DEBUG, "current m_iAudioBufferLen = %d, m_iAudioPerSecBufLen = %d.", m_iAudioBufferLen, m_iAudioPerSecBufLen);
@@ -2077,7 +2115,7 @@ int libvideorecord_impl::WriteAudioFrame()
 
 		m_iAudioBufferLen = 0;
 		m_iRemoteAudioBufLen = 0;
-		memset(m_pRecordAudioBuffer, 0, m_iRecordAudioBufSize);
+		memset((void*)m_pRecordAudioBuffer, 0, m_iRecordAudioBufSize);
 		if (NULL != m_pRemoteAudioBuffer) {
 			memset(m_pRemoteAudioBuffer, 0, m_iAudioPerSecBufLen);
 		}

+ 2 - 2
Other/unix/libvideorecord/libvideorecord_impl.h

@@ -1,6 +1,5 @@
 #pragma once
 #include "FFmpegWriter.h"
-//#include "WmvWriter.h"
 #include "libvideorecord.h"
 
 #include "libaudioqueue.h"
@@ -64,7 +63,7 @@ private:
 	int GetVideoFrameSize(int& nWidth, int& nHeight, Clibvideoqueue* queue);
 	//从指定队列读取video
 	bool GetVideoFrame(video_frame* Video, int flags, Clibvideoqueue* queue);
-	bool IsRecordingCamError(int iRecordingCam);
+	bool IsRecordingCamError(int iRecordingCam, eRvcRecordType eRecordType = eStand2Agent);
 	bool InitCvxText();
 	void GetVideoFullName();
 	bool AddCvxText(unsigned char** pData, int iDataSize, int iWidth, int iHeight);
@@ -108,6 +107,7 @@ private:
 	bool ReSetRecordParams();
 	bool InitVideoRecordParams();
 	int HandleLeftAudioData();
+	bool AddMuteAudioFrame(bool bLocal, int iAudioFrameSize);
 
 
 private:

+ 1 - 1
Other/win/libaudioqueue/libaudioqueue.h

@@ -15,7 +15,7 @@
 
 using namespace std ;
 
-#define MAX_AUDIOQUEUE_LENS     45					//音频队列最大节点数量
+#define MAX_AUDIOQUEUE_LENS     50					//音频队列最大节点数量
 #define MAX_AUDIOQNODE_SIZE     16000				//音频队列单个节点默认最大长度
 
 typedef struct audio_frame 

+ 64 - 83
Other/win/libvideorecord/libvideorecord_impl.cpp

@@ -2,18 +2,13 @@
 #include "libvideorecord_impl.h"
 #include "videoutil.h"
 #include "io.h"
-//#include <windowsx.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <process.h>
 #include <string.h>
 #include <timeapi.h>
-//#include <windows.h>	//包含头文件 windows.h
-//#include <MMSystem.h>
 #pragma comment(lib, "winmm.lib")
-//#include <DbgHelp.h>
-//#pragma comment(lib, "dbghelp.lib")
-//#pragma comment(lib, "WMVCORE.lib")
+
 #ifndef RECORD_SAFE_DELETE
 #define RECORD_SAFE_DELETE(p) \
 			do{ \
@@ -34,15 +29,20 @@
 
 static bool ReNameFile(const char* file, const char* newfilename)
 {
-	if (!_access(file, 0)) {
-		if (!rename(file, newfilename)) {
+#ifdef _WIN32
+	if (!_access(file, 0))
+#else
+	if (!access(file, F_OK))
+#endif //_WIN32
+	{
+		if (!rename(file, newfilename)){
 			return true;
 		}
-		else {
+		else{
 			return false;
 		}
 	}
-	else {
+	else{
 		return false;
 	}
 }
@@ -62,7 +62,7 @@ static uint32_t BindPCMAudioData(uint32_t uBufferLen, char* pLocalAudios, uint32
 		memset(pLocalAudios, 0, uBufferLen);
 	}
 
-	for (int i = 0; i < uLocalAudioLen / uBitDeepth; i++) {
+	for (uint32_t i = 0; i < uLocalAudioLen / uBitDeepth; i++) {
 		if (eLocalLeft == eType) {
 			memcpy((uint32_t*)pLocalAudios + i, ((uint16_t*)(pBuffer)) + i, uBitDeepth);
 			uint16_t* pindex = (uint16_t*)((uint32_t*)pLocalAudios + i) + 1;
@@ -353,41 +353,6 @@ static void DeleteDumpFiles()
 }
 
 
-//static void videorecorddump_exception(PEXCEPTION_POINTERS ExceptionInfo, libvideorecord_impl* pVideoRecord)
-//{
-//	if (NULL != pVideoRecord) {
-//		pVideoRecord->EndRecord();
-//		if (NULL != pVideoRecord->m_pHostApi) {
-//			pVideoRecord->m_pHostApi->Debug(RECORD_LOG_ERROR, "VideoRecord Thread Exception.");
-//			pVideoRecord->m_pHostApi->OnRecordEntityExcption();
-//		}
-//	}
-//
-//	DeleteDumpFiles();
-//
-//	char tmp[MAX_PATH] = { 0 };
-//	HANDLE hDumpFile;
-//	sprintf_s(tmp, MAX_PATH, ".\\videorecord_%d.dmp", GetCurrentProcessId());
-//	hDumpFile = CreateFileA(tmp, GENERIC_READ | GENERIC_WRITE,
-//		0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-//	if ((hDumpFile != NULL) && (hDumpFile != INVALID_HANDLE_VALUE))
-//	{
-//		MINIDUMP_EXCEPTION_INFORMATION mdei;
-//		MINIDUMP_TYPE mdt;
-//
-//		mdei.ThreadId = GetCurrentThreadId();
-//		mdei.ExceptionPointers = ExceptionInfo;
-//		mdei.ClientPointers = false;
-//
-//		mdt = MiniDumpWithFullMemory;
-//
-//		MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
-//			hDumpFile, mdt, (ExceptionInfo != 0) ? &mdei : 0, 0, 0);
-//
-//		CloseHandle(hDumpFile);
-//	}
-//}
-
 
 static void __recordlog(void* user_data, const char* fmt, va_list arg)
 {
@@ -407,13 +372,9 @@ static unsigned int __stdcall VideoRecordThread(LPVOID n)
 	libvideorecord_impl* Record = (libvideorecord_impl*)n;
 	int iRet = -1;
 
-	//__try 
-	//{
 	iRet = Record->VideoRecord();
-	//}
-	//__except (videorecorddump_exception(GetExceptionInformation(), Record), EXCEPTION_EXECUTE_HANDLER) {
 
-	//}
+
 
 	return iRet;
 }
@@ -1203,6 +1164,7 @@ bool libvideorecord_impl::IsRecordingCamError(int iRecordingCam, eRvcRecordType
 		}
 	}
 
+
 	return bRet;
 }
 
@@ -1842,6 +1804,7 @@ bool libvideorecord_impl::GetLocalAudioFrame(int iAudioLens)
 			bRet = true;
 		}
 		else {
+			m_pHostApi->Debug(RECORD_LOG_ERROR, "not support audio sample rate, and audio samplespersec=%d,framesize=%d,channels=%d,format=%d,bitspersample=%d,series number=%d.", m_audioframe->samplespersec, m_audioframe->framesize, m_audioframe->nchannels, m_audioframe->format, m_audioframe->bitspersample, m_audioframe->iseriesnumber);
 			LogFailedEvent(eSampNotSupport, "not support audio sample rate.");
 		}
 	}
@@ -1877,6 +1840,32 @@ bool libvideorecord_impl::GetSingleSideAudioFrame()
 }
 
 
+bool libvideorecord_impl::AddMuteAudioFrame(bool bLocal, int iAudioFrameSize)
+{
+	bool bRet = false;
+
+	if (0 == iAudioFrameSize) {
+		return bRet;
+	}
+
+	if (bLocal) {
+		memset(m_pRecordAudioBuffer + m_iAudioBufferLen, 0, iAudioFrameSize);
+		m_iAudioBufferLen += iAudioFrameSize;
+		m_iAudioFromQueNum++;
+		m_pHostApi->Debug(RECORD_LOG_INFO, "m_iAudioFromQueNum is %d(Mute AudioFrame).", m_iAudioFromQueNum);
+		bRet = true;
+	}
+	else {
+		memset(m_pRemoteAudioBuffer + m_iRemoteAudioBufLen, 0, iAudioFrameSize);
+		m_iRemoteAudioBufLen += iAudioFrameSize;
+		m_iRemoteAudioNum++;
+		m_pHostApi->Debug(RECORD_LOG_INFO, "m_iRemoteAudioNum is %d(Mute Audio Frame).", m_iRemoteAudioNum);
+		bRet = true;
+	}
+
+	return bRet;
+}
+
 bool libvideorecord_impl::GetRecordAudioFrame()
 {
 	bool bRet = false;
@@ -1889,44 +1878,32 @@ bool libvideorecord_impl::GetRecordAudioFrame()
 		int nAudioLens = m_audioqueue->GetAudioLens();
 		int nRemoteAudioLens = m_remote_audioqueue->GetAudioLens();
 		m_pHostApi->Debug(RECORD_LOG_DEBUG,"current local audio length is %d, and remote audio length is %d.", nAudioLens, nRemoteAudioLens);
-		if ((nAudioLens > 0) && (nRemoteAudioLens <= 0)) {
-			if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {	//取出音频
+		//1. 取本地音频
+		if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {
+			if (nAudioLens > 0) {//取到本地音频
 				bRet = GetLocalAudioFrame(nAudioLens);
 			}
-		}
-		else if ((nAudioLens > 0) && (nRemoteAudioLens > 0)) {
-			if (m_iRemoteAudioBufLen < m_iAudioPerSecBufLen) {  //收到的远端音频不够1秒
-				bRet = GetRemoteAudioFrame(nRemoteAudioLens);	//取远端音频
+			else {//本地音频队列为空,用静音填充
+				bRet = AddMuteAudioFrame(true, m_iAudioPerSecBufLen/50);
 			}
+		}
 
-			if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {
-				bRet = GetLocalAudioFrame(nAudioLens);	//本地音频
+		//2. 取远端音频
+		if (m_iRemoteAudioBufLen < m_iAudioPerSecBufLen) {  
+			if (nRemoteAudioLens > 0) {
+				bRet = GetRemoteAudioFrame(nRemoteAudioLens);	//取远端音频
 			}
-			if ((m_iRemoteAudioBufLen == m_iAudioPerSecBufLen) && (m_iAudioBufferLen == m_iAudioPerSecBufLen)) {
-				//可视远程双录场景,本地和坐席端分别录制到左右声道
-				uint32_t uOutlen = BindPCMAudioData(m_iRecordAudioBufSize, m_pRecordAudioBuffer, m_iAudioBufferLen, m_pRemoteAudioBuffer, m_iRemoteAudioBufLen, m_audioframe->bitspersample / 8, eLocalLeft);
-				m_pHostApi->Debug(RECORD_LOG_DEBUG, "double channel buffer length is %d, local buffer len is %d, remote buffer len is %d.", m_iRecordAudioBufSize, m_iAudioBufferLen, m_iRemoteAudioBufLen);
-				m_iAudioBufferLen = uOutlen;
+			else{
+				bRet = AddMuteAudioFrame(false, m_iAudioPerSecBufLen / 50);
 			}
 		}
-		else if ((nAudioLens <= 0) && (nRemoteAudioLens > 0)) {  //本地端无数据不混音,双录语音播报场景
-			if (m_iAudioBufferLen < m_iAudioPerSecBufLen) {		 //取出音频
-				m_audioframe->data = m_pRecordAudioBuffer + m_iAudioBufferLen;
-				bool bGetAudio = false;
-				if (nRemoteAudioLens <= MAX_AUDIOQUEUE_LENS && nRemoteAudioLens > 1) {
-					bGetAudio = m_remote_audioqueue->GetAudioAndDel(m_audioframe);
-				}
-				else {
-					bGetAudio = m_remote_audioqueue->GetAudio(m_audioframe);
-				}
 
-				if (bGetAudio) {
-					m_pHostApi->Debug(RECORD_LOG_DEBUG,"remote audio series number is %d, channels is %d, samplespersec is %d.", m_audioframe->iseriesnumber, m_audioframe->nchannels, m_audioframe->samplespersec);
-					m_iAudioBufferLen += m_audioframe->framesize;
-					m_iAudioFromQueNum++;
-					m_pHostApi->Debug(RECORD_LOG_DEBUG,"m_iAudioFromQueNum is %d.", m_iAudioFromQueNum);
-				}
-			}
+		//3. 可视远程双录场景,本地和坐席端分别录制到左右声道
+		if ((m_iRemoteAudioBufLen == m_iAudioPerSecBufLen) && (m_iAudioBufferLen == m_iAudioPerSecBufLen)) {
+			
+			uint32_t uOutlen = BindPCMAudioData(m_iRecordAudioBufSize, m_pRecordAudioBuffer, m_iAudioBufferLen, m_pRemoteAudioBuffer, m_iRemoteAudioBufLen, m_audioframe->bitspersample / 8, eLocalLeft);
+			m_pHostApi->Debug(RECORD_LOG_DEBUG, "double channel buffer length is %d, local buffer len is %d, remote buffer len is %d.", m_iRecordAudioBufSize, m_iAudioBufferLen, m_iRemoteAudioBufLen);
+			m_iAudioBufferLen = uOutlen;
 		}
 	}
 	m_pHostApi->Debug(RECORD_LOG_DEBUG, "current m_iAudioBufferLen = %d, m_iAudioPerSecBufLen = %d.", m_iAudioBufferLen, m_iAudioPerSecBufLen);
@@ -1968,13 +1945,17 @@ bool libvideorecord_impl::InitVideoRecordParams()
 
 	//获取视频帧大小
 	if (!GetRecordVideoFrameSize()) {
-		LogFailedEvent(eVideoGetFailed, "Get Video Frame Failed Max Times.", true);
+		if (false == m_bStopRecord) {
+			LogFailedEvent(eVideoGetFailed, "Get Video Frame Failed Max Times.", true);
+		}
 		return bRet;
 	}
 
 	//获取音频帧大小
 	if (!GetRecordAudioFrameSize()) {
-		LogFailedEvent(eLocalAudioGetFailed, "Get Audio Frame Failed Max Times.", true);
+		if (false == m_bStopRecord) {
+			LogFailedEvent(eLocalAudioGetFailed, "Get Audio Frame Failed Max Times.", true);
+		}
 		return bRet;
 	}
 

+ 1 - 0
Other/win/libvideorecord/libvideorecord_impl.h

@@ -106,6 +106,7 @@ private:
 	bool ReSetRecordParams();
 	bool InitVideoRecordParams();
 	int HandleLeftAudioData();
+	bool AddMuteAudioFrame(bool bLocal, int iAudioFrameSize);
 
 
 private: