Explorar el Código

Z991239-5223 #comment 优化对接招乎SDK获取音视频设备信息接口

80274480 hace 1 año
padre
commit
a01934b2ec

+ 43 - 0
Module/mod_mediacontroller/unix/mod_mediacontroller.cpp

@@ -28,6 +28,28 @@ static void __audiomgrlog(void* user_data, const char* fmt, va_list arg)
 	}
 }
 
+
+static int ReplaceDestChar(char* strOut, size_t uDstLen, const char* pSrc, size_t uSrcLen, char cWord) 
+{
+	int iRet = 0;
+	if (NULL == pSrc || 0 == uSrcLen) {
+		return iRet;
+	}
+
+	char strBuffer[MAX_PATH] = { 0 };
+	snprintf(strBuffer, MAX_PATH, "%s", pSrc);
+	char* pIndex = NULL;
+	if (pIndex = strrchr(strBuffer, cWord)) {
+		char* pHash = pIndex + sizeof(char);
+		*pIndex = '\0';
+		snprintf(strOut, uDstLen, "%s;%s", strBuffer, pHash);
+		iRet = strlen(strOut);
+	}
+
+	return iRet;
+}
+
+
 CMediaControllerEntity::CMediaControllerEntity(): m_capture(NULL), m_salesaudio_capture(NULL), m_lCaptureEnvCount(0), m_nCameraErrorCode(Error_Succeed),
 m_lCaptureEnvOptCount(0), m_lCaptureOptCount(0), m_iEnvEmptyTimes(0), m_iOptEmptyTimes(0), m_bSendCameraError(false),
 m_nEnvCameraRestartNum(0), m_nOptCameraRestartNum(0), m_nCameraCount(2), m_pSelfcheckClient(NULL),
@@ -1979,6 +2001,7 @@ ErrorCodeEnum CMediaControllerEntity::GetAudioDevices(int& iAudioCount, CSimpleS
 				}
 				strAudioDev += str;
 			}
+			iAudioCount = icountmic;
 		}
 		else {
 			int icountspeaker = m_pAudioCap->audio_get_device_count(false);
@@ -1991,6 +2014,7 @@ ErrorCodeEnum CMediaControllerEntity::GetAudioDevices(int& iAudioCount, CSimpleS
 				}
 				strAudioDev += str;
 			}
+			iAudioCount = icountspeaker;
 		}
 		
 		strAudioDev += "]";
@@ -2186,8 +2210,27 @@ void MediaServiceSession::Handle_GetCameraInfos(SpReqAnsContext<MediaService_Get
 	DbgToBeidou(ctx->link, __FUNCTION__)();
 	ErrorCodeEnum Error = Error_Succeed;
 
+#ifdef RVC_OS_WIN
 	ctx->Ans.strEnvCamera = m_pEntity->conf.strVideoEnv;
 	ctx->Ans.strOptCamera = m_pEntity->conf.strVideoOpt;
+#else
+	char strEnv[MAX_PATH] = { 0 };
+	if (ReplaceDestChar(strEnv, MAX_PATH, m_pEntity->conf.strVideoEnv.GetData(), m_pEntity->conf.strVideoEnv.GetLength(), ':') > 0) {
+		ctx->Ans.strEnvCamera = strEnv;
+	}
+	else {
+		ctx->Ans.strEnvCamera = "";
+	}
+
+	char strOpt[MAX_PATH] = { 0 };
+	if (ReplaceDestChar(strOpt, MAX_PATH, m_pEntity->conf.strVideoOpt.GetData(), m_pEntity->conf.strVideoOpt.GetLength(), ':') > 0) {
+		ctx->Ans.strOptCamera = strOpt;
+	}
+	else {
+		ctx->Ans.strOptCamera = "";
+	}
+#endif // RVC_OS_WIN
+
 	ctx->Ans.retCode = (int)Error;
 
 	ctx->Answer(Error_Succeed);

+ 0 - 1
Module/mod_sipphone/mod_sipphone.h

@@ -355,7 +355,6 @@ private:
 	void ShowBothVideo();
 #endif //RVC_OS_WIN
 	ErrorCodeEnum AudioDspFlagsUseCentersetting(endpoint_conf_t* conf);
-
 	//载入运行时配置
 	ErrorCodeEnum LoadAudioRunConfig(int&nHandfreeout,int&nPickupout,int&nHandfreein,int&nPickupin);
 	//保存运行时