瀏覽代碼

!10639 合并曝光调节分支
Merge pull request !10639 from 80274480/T24XG741_base_ST2

陈礼鹏80274480 8 月之前
父節點
當前提交
3819d4b633
共有 42 個文件被更改,包括 1759 次插入1158 次删除
  1. 2 2
      Module/mod_ResourceWatcher/ResourceWatcher.xml
  2. 9 2
      Module/mod_SalesRecorder/mod_SalesRecorder.cpp
  3. 1 1
      Module/mod_SalesRecorder/mod_SalesRecorder.h
  4. 14 0
      Module/mod_counterconnector/ConnectorFSM.h
  5. 9 2
      Module/mod_counterconnector/mod_counterconnector.cpp
  6. 1 0
      Module/mod_interactivecontrol/mod_interactivecontrol.cpp
  7. 2 1
      Module/mod_localmediaplay/Event.h
  8. 44 3
      Module/mod_localmediaplay/mod_localmediaplay.cpp
  9. 3 2
      Module/mod_mediacontroller/CMakeLists.txt
  10. 10 1
      Module/mod_mediacontroller/Event.h
  11. 0 15
      Module/mod_mediacontroller/ExternalCameraMsg.h
  12. 96 215
      Module/mod_mediacontroller/MediaController_client_g.h
  13. 58 143
      Module/mod_mediacontroller/MediaController_def_g.h
  14. 0 61
      Module/mod_mediacontroller/MediaController_msg_g.h
  15. 54 216
      Module/mod_mediacontroller/MediaController_server_g.h
  16. 68 111
      Module/mod_mediacontroller/MediaService.xml
  17. 74 0
      Module/mod_mediacontroller/brightnessinfo.cpp
  18. 100 0
      Module/mod_mediacontroller/brightnessinfo.h
  19. 93 20
      Module/mod_mediacontroller/capture.cpp
  20. 6 2
      Module/mod_mediacontroller/capture.h
  21. 367 169
      Module/mod_mediacontroller/mod_mediacontroller.cpp
  22. 22 15
      Module/mod_mediacontroller/mod_mediacontroller.h
  23. 1 1
      Module/mod_recorder/CMakeLists.txt
  24. 9 3
      Module/mod_recorder/mod_recorder.cpp
  25. 1 1
      Module/mod_recorder/mod_recorder.h
  26. 7 6
      Module/mod_recorder/recordinfo.cpp
  27. 1 11
      Module/mod_recorder/recordinfo.h
  28. 2 3
      Module/mod_sipphone/CMakeLists.txt
  29. 147 1
      Module/mod_sipphone/SIPPhone_client_g.h
  30. 80 14
      Module/mod_sipphone/SIPPhone_def_g.h
  31. 81 0
      Module/mod_sipphone/SIPPhone_server_g.h
  32. 29 2
      Module/mod_sipphone/SipService.xml
  33. 88 23
      Module/mod_sipphone/mod_sipphone.cpp
  34. 10 13
      Module/mod_sipphone/mod_sipphone.h
  35. 181 58
      Module/mod_sipphone/video_render.cpp
  36. 20 3
      Module/mod_sipphone/video_render.h
  37. 1 1
      Other/unix/libvideocapture/ivideocaptureinterface.h
  38. 1 1
      Other/unix/libvideocapture/linux/videocapture_linux.cpp
  39. 3 1
      Other/win/libvideoframework/video_common/ffmpeg_api_cpp_adapter.h
  40. 4 3
      Other/win/libvideoframework/video_common/videoutil.c
  41. 59 31
      Other/win/libvideoframework/videocap.cpp
  42. 1 1
      Other/win/libvideoframework/videocap.h

+ 2 - 2
Module/mod_ResourceWatcher/ResourceWatcher.xml

@@ -291,8 +291,8 @@
 	    <twoway  name="CheckIsFileExists" overlap="true" method_id="21">
 	      <req>
 					<!-- 0: 文件名参数为全路径 -->
-					<!-- 1: 在当前默认音频文件路径(Win: D:/rvc/adData/Audio/; UOS: /opt/rvc/adData/Audio/) 下查找mp3格式文件 -->
-					<!-- 2: 在当前默认视频文件路径(Win: D:/rvc/adData/Video/; UOS: /opt/rvc/adData/Video/) 下查找视频文件 -->
+					<!-- 1: 在当前默认音频文件路径(Win: D:/rvc/adData/Audio/; UOS: /opt/rvc/adData/Audio/) 下查找指定文件 -->
+					<!-- 2: 在当前默认视频文件路径(Win: D:/rvc/adData/Video/; UOS: /opt/rvc/adData/Video/) 下查找指定文件 -->
           <param name="filetype" type="int" />
 					<param name="filename" type="wstring" />
 	      </req>

+ 9 - 2
Module/mod_SalesRecorder/mod_SalesRecorder.cpp

@@ -1697,7 +1697,7 @@ ErrorCodeEnum CSalesRecorderEntity::AddToSalesRecordList(const char* videopath,
 
 	item->file_name = strfilename;
 	
-	m_vRecordList.push_back(*item);
+	m_vRecordList.push_back(item);
 
 	Error = Error_Succeed;
 
@@ -1728,7 +1728,7 @@ ErrorCodeEnum CSalesRecorderEntity::PostSalesRecordInfos()
 	}
 
 	video_params.strRecordID = m_SalesVideoName + strlen(RVC_SALES_RECORD_SUFFIX);
-	for (vector<record_item_t>::iterator it = m_vRecordList.begin(); it < m_vRecordList.end(); ++it) {
+	for (vector<record_item_t*>::iterator it = m_vRecordList.begin(); it < m_vRecordList.end(); ++it) {
 		video_params.vRecordList.push_back(*it);
 	}
 
@@ -1742,6 +1742,13 @@ ErrorCodeEnum CSalesRecorderEntity::PostSalesRecordInfos()
 		LogWarn(Severity_Middle, Error_Exception, LOG_EVT_POST_SALESRECORD_INFO_FAILED, strErrorMsg.GetData());
 	}
 
+	for (vector<record_item_t*>::iterator it = m_vRecordList.begin(); it < m_vRecordList.end(); ++it) {
+		if (NULL != *it) {
+			delete* it;
+			*it = NULL;
+		}
+	}
+
 	m_vRecordList.clear();
 
 	return Error;

+ 1 - 1
Module/mod_SalesRecorder/mod_SalesRecorder.h

@@ -200,7 +200,7 @@ namespace SalesRecorder {
 		int m_iHttpTimeOut;
 		CSimpleStringA m_strAppVersion;
 		CSimpleStringA m_strTerminalId;
-		vector<record_item_t> m_vRecordList;
+		vector<record_item_t*> m_vRecordList;
 		eRvcBusinessStatus m_eBusinessStatus;
 		bool m_bEncFlag;
 		int m_iRemoteRecordType;

+ 14 - 0
Module/mod_counterconnector/ConnectorFSM.h

@@ -463,6 +463,20 @@ public:
 		return (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->SetCallingParam(info);
 	}
 
+	bool IsCameraRenderState()
+	{
+		bool brender = false;
+		if (!m_pPhoneClient) {
+			return brender;
+		}
+		PhoneService_IsCameraRender_Req req;
+		PhoneService_IsCameraRender_Ans ans;
+		if (Error_Succeed == (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->IsCameraRender(req, ans, 5000)) {
+			brender = ans.result;
+		}
+		return brender;
+	}
+
 private:
 
 	int TranslateState(int innerState);

+ 9 - 2
Module/mod_counterconnector/mod_counterconnector.cpp

@@ -334,12 +334,19 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 		break;
 	case EVENT_MOD_CONNECT_PICKUP_CALL: // 提机呼叫
 		{
-			if (m_bHasLaunched){
+			bool brenderstate = m_fsm.IsCameraRenderState();
+			if (m_bHasLaunched && !brenderstate){
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("提机呼叫");
 				HandlePickUpCallEvent();
 			}
 			else{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("UI has not launched, ignore it.");
+				if (!m_bHasLaunched) {
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("UI has not launched, ignore it.");
+				}
+
+				if (brenderstate) {
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Is camera render now, ignore it.");
+				}
 			}
 		}
 		break;

+ 1 - 0
Module/mod_interactivecontrol/mod_interactivecontrol.cpp

@@ -1983,6 +1983,7 @@ ErrorCodeEnum CITCtrlEntity::StartCameraCaptrue()
 
 	MediaService_TurnOnCamera_Req req;
 	MediaService_TurnOnCamera_Ans ans;
+	req.bPostCapInfo = true;
 	ErrorCodeEnum rc = (*m_pMediaCtlClient)(EntityResource::getLink().upgradeLink())->TurnOnCamera(req, ans, 10000);
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)(CSimpleStringA::Format("turn on camera result is 0x%08x.", rc).GetData());
 

+ 2 - 1
Module/mod_localmediaplay/Event.h

@@ -15,4 +15,5 @@
 #define LOG_EVT_PLAYING_AUDIO_INFOS			0x3130010B
 #define LOG_EVT_NOTICE_FILE_NOT_VALID		0x3130010C
 #define LOG_EVT_MEDIAPLAY_COST_TIME_ERROR	0x3130010D
-#define LOG_EVT_ADV_PLAYLIST_INFO			0x3130010E
+#define LOG_EVT_ADV_PLAYLIST_INFO			0x3130010E
+#define LOG_EVT_NOTSUPPORT_AUDIOFORMAT		0x3130010F

+ 44 - 3
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -92,6 +92,22 @@ static uint32_t Transform2Pcm8k(char* pdstbuf, const uint32_t udstlen, char* pcm
 	return nLen;
 }
 
+static uint32_t Transform48k2Pcm8k(char* pdstbuf, const uint32_t udstlen, char* pcm_48kdata, int idata_size, int ichannels)
+{
+	uint32_t nLen = 0;
+	int nSkipByte = 6 * ichannels;
+	int nSourcePos = 0;
+	char* pcm_8k_data = (char*)pdstbuf;
+	for (nLen = 0; nSourcePos + 1 < idata_size; nLen = nLen + 2)
+	{
+		pcm_8k_data[nLen] = pcm_48kdata[nSourcePos];
+		pcm_8k_data[nLen + 1] = pcm_48kdata[nSourcePos + 1];
+
+		nSourcePos = nSourcePos + nSkipByte * 2;
+	}
+
+	return nLen;
+}
 
 static uint32_t PcmConvert(char* pdstbuf, const uint32_t udstlen, char* pcmsrcdata, int isrclen, int isamplespersec, int ichannels)
 {
@@ -103,17 +119,33 @@ static uint32_t PcmConvert(char* pdstbuf, const uint32_t udstlen, char* pcmsrcda
 		else if (44100 == isamplespersec) {
 			uLen = Transform2Pcm8k(pdstbuf, udstlen, pcmsrcdata, isrclen, 2);
 		}
+		else if (48000 == isamplespersec) {
+			uLen = Transform48k2Pcm8k(pdstbuf, udstlen, pcmsrcdata, isrclen, 2);
+		}
 	}
 	else {
 		if (44100 == isamplespersec) {
 			uLen = Transform2Pcm8k(pdstbuf, udstlen, pcmsrcdata, isrclen, 1);
 		}
+		else if (48000 == isamplespersec) {
+			uLen = Transform48k2Pcm8k(pdstbuf, udstlen, pcmsrcdata, isrclen, 1);
+		}
 	}
 
 	return uLen;
 }
 
 
+static bool IsSupportAudioSamprate(int isamprate)
+{
+	bool bret = false;
+	if (8000 == isamprate || 44100 == isamprate || 48000 == isamprate) {
+		bret = true;
+	}
+
+	return bret;
+}
+
 static void CStringSplit(char* str, char** result, const char* del)
 {
 	char* pdata = NULL;
@@ -856,9 +888,12 @@ int CLocalMediaPlayEntity::PlayingAudioDataCallback(audio_param_t* param, const
 		if (false == m_bloged) {
 			m_bloged = true;
 			LogWarn(Severity_Low, Error_Debug, LOG_EVT_PLAYING_AUDIO_INFOS, CSimpleStringA::Format("audio param target (%d channels, %d Hz, channel_layout(%d), frame_size(%d), bytes_per_sec(%d), audio format(%d)).", param->channels, param->freq, param->channel_layout, param->frame_size, param->bytes_per_sec, param->fmt).GetData());
+			if (!IsSupportAudioSamprate(param->freq)) {
+				LogWarn(Severity_Middle, Error_Debug, LOG_EVT_NOTSUPPORT_AUDIOFORMAT, CSimpleStringA::Format("not support audio param (%d channels, %d Hz, channel_layout(%d), frame_size(%d), bytes_per_sec(%d), audio format(%d)).", param->channels, param->freq, param->channel_layout, param->frame_size, param->bytes_per_sec, param->fmt).GetData());
+			}
 		}
 
-		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d uaudiolen:%d", __FUNCTION__, __LINE__, uaudiolen);
+		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d uaudiolen:%d", __FUNCTION__, __LINE__, uaudiolen);
 		//AV_SAMPLE_FMT_S16 == 1
 		if (1 == param->fmt) {	
 			int isingle_audioframe_len = param->bytes_per_sec/50;
@@ -893,9 +928,9 @@ int CLocalMediaPlayEntity::PlayingAudioDataCallback(audio_param_t* param, const
 							DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("InsertAudio failed! frameCount:%d", frm.framesize);
 						}
 						else {
-							//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio(series number = %d) success and framesize = %d.", __FUNCTION__, __LINE__, frm.iseriesnumber, frm.framesize);
+							//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d InsertAudio(series number = %d) success and framesize = %d.", __FUNCTION__, __LINE__, frm.iseriesnumber, frm.framesize);
 							if (m_bRecordPCM && m_pFile){
-								fwrite(frm.data, isingle_audioframe_len, 1, m_pFile);
+								fwrite(frm.data, frm.framesize, 1, m_pFile);
 							}
 						}
 					} 
@@ -908,6 +943,12 @@ int CLocalMediaPlayEntity::PlayingAudioDataCallback(audio_param_t* param, const
 						if (!m_remote_audio_queue->InsertAudio(&frm)) {
 							DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("InsertAudio failed! frameCount:%d", frm.framesize);
 						}
+						else {
+							//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d InsertAudio(series number = %d) success and framesize = %d.", __FUNCTION__, __LINE__, frm.iseriesnumber, frm.framesize);
+							if (m_bRecordPCM && m_pFile) {
+								fwrite(frm.data, frm.framesize, 1, m_pFile);
+							}
+						}
 					}
 						
 					delete []straudio;

+ 3 - 2
Module/mod_mediacontroller/CMakeLists.txt

@@ -9,16 +9,17 @@ endif(RVC_DEBUG_MODE)
 set(${MODULE_PREFIX}_SRCS
 	capture.h
 	Event.h
-	ExternalCameraMsg.h
 	MediaController_client_g.h
 	MediaController_def_g.h
 	MediaController_msg_g.h
 	MediaController_server_g.h
 	mod_mediacontroller.h
+	brightnessinfo.h
 	stdafx.cpp
 	capture.cpp
 	mod_mediacontroller.cpp
 	${ThirdPartyHeadRoot}/CJson/cJSON.c
+	brightnessinfo.cpp
 )
 
 set(MOD_VERSION_STRING "0.0.1-dev1")
@@ -121,6 +122,6 @@ set(${MODULE_PREFIX}_LIBS  ${MODULE_BASE_LIBS}
 )
 endif(WIN32)
 
-target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
+target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} ${RVCCOMM_LIB})
 
 deploy_module(${MODULE_PREFIX} ${MODULE_NAME})

+ 10 - 1
Module/mod_mediacontroller/Event.h

@@ -65,10 +65,12 @@
 #define LOG_EVT_MEDIACONTROLLER_ENVCAM_CLOSE				0x20880076  //关闭上摄像头
 #define LOG_EVT_MEDIACONTROLLER_OPTCAM_OPEN					0x20880077  //打开下摄像头
 #define LOG_EVT_MEDIACONTROLLER_OPTCAM_CLOSE				0x20880078  //关闭下摄像头
-#define LOG_EVT_MEDIACONTROLLER_CAMOPEN_FAILED_INFO			0x20880079  //摄像头失败原因
+#define LOG_EVT_MEDIACONTROLLER_CAMOPEN_FAILED_INFO			0x20880079  //打开摄像头失败原因
 #define LOG_EVT_MEDIACONTROLLER_RESTART_CAME_SUCCESS		0x20880080  //重新打开摄像头成功
 #define LOG_EVT_MEDIACONTROLLER_ENVCAM_FRAME_INFO			0x20880081  //上摄像头帧数信息
 #define LOG_EVT_MEDIACONTROLLER_OPTCAM_FRAME_INFO			0x20880082  //下摄像头帧数信息
+#define LOG_EVT_MEDIACONTROLLER_NOMATCHED_RESOLUTION		0x20880083  //摄像头没有满足要求的分辨率
+#define LOG_EVT_MEDIACONTROLLER_CAMERA_BRIGHTNESS			0x20880064  //摄像头亮度值信息
 
 #define LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED				0x20890001	//摄像头已开启
 #define LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED				0x20890002  //摄像头已关闭
@@ -107,5 +109,12 @@
 #define ERROR_MOD_MEDIACONTROLLER_VIDEO_AUTO_MATHED_SUCCESS		0x20899001  //摄像头自动匹配成功
 #define ERROR_MOD_MEDIACONTROLLER_VIDEO_AUTO_MATHED_FAILED		0x20899002  //摄像头自动匹配失败
 
+#define LOG_EVT_POST_CAMERA_BRIGHTNESSINFO_FAILED				0x20899003	//上报摄像头亮度信息失败
+#define LOG_EVT_POST_CAMERA_BRIGHTNESSINFO_COST_TIME			0x20899004	//上报摄像头亮度信息耗时
 
 
+#define LOG_WARN_CAMERAOCCUPYING								0x208A0001	//摄像头占用中
+#define LOG_WARN_ALLCAMERA_ERRORS								0x208A0002	//摄像头都故障
+#define LOG_WARN_ENVCAMERA_ERROR								0x208A0003	//上摄像头故障
+#define LOG_WARN_OPTCAMERA_ERROR								0x208A0004	//下摄像头故障
+#define LOG_ERROR_ENTITY_ALLOC_MEM_FAILED						0x208A0005	//实体分配内存失败

+ 0 - 15
Module/mod_mediacontroller/ExternalCameraMsg.h

@@ -1,15 +0,0 @@
-#ifndef _HEXTERNALCAMERAMSG_H_
-#define _HEXTERNALCAMERAMSG_H_
-#pragma once
-
-#define SwitchFailed_StartFault						"外接摄像头启动故障,将切换到内置摄像头"
-#define SwitchFailed_Ambiguous						"请拔出外接摄像头后重新插入"
-#define SwitchFailed_NoUnique						"请拔出所有外接摄像头后插入唯一外接摄像头"
-#define SwitchFailed_StartInnerFrontCameraFault		"启动内置前摄像头故障,尝试恢复中(预计10s内),请稍等"
-#define SwitchFailed_StartInnerRearCameraFault		"启动内置后摄像头故障,尝试恢复中(预计10s内),请稍等"
-#define SwitchFailed_StartInnerBothCameraFault		"启动内置前、后摄像头故障,尝试恢复中(预计10s内),请稍等"
-#define SwitchFailed_StartInnerAudioInFault			"启动内置麦克风故障,尝试恢复中(预计10s内),请稍等"
-#define SwitchFailed_StartInnerAudioOutFault		"启动内置扬声器故障,尝试恢复中(预计10s内),请稍等"
-#define SwitchFailed_StartInnerMediaOtherFault		"启动内置媒体设备出现其他故障,尝试恢复中(预计10s内),请稍等"
-
-#endif

+ 96 - 215
Module/mod_mediacontroller/MediaController_client_g.h

@@ -58,84 +58,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum GetVideoDeviceName(MediaService_GetVideoDeviceName_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_GetVideoDeviceName, MediaService_MethodSignature_GetVideoDeviceName, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum GetVideoDeviceName(MediaService_GetVideoDeviceName_Req &Req, MediaService_GetVideoDeviceName_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVideoDeviceName(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetVideoDeviceName(MediaService_GetVideoDeviceName_Req &Req, MediaService_GetVideoDeviceName_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVideoDeviceName(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetVideoDeviceName(MediaService_GetVideoDeviceName_Req &Req, MediaService_GetVideoDeviceName_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVideoDeviceName(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum StartCamera()
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->OnewayCall(MediaService_Method_StartCamera, MediaService_MethodSignature_StartCamera, m_context);
-		m_context.clear();
-		return ret;
-	}
-
-	ErrorCodeEnum StopCamera()
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->OnewayCall(MediaService_Method_StopCamera, MediaService_MethodSignature_StopCamera, m_context);
-		m_context.clear();
-		return ret;
-	}
-
-	ErrorCodeEnum StartEnvCamera(MediaService_StartEnvCamera_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum GetAudioDevices(MediaService_GetAudioDevices_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -145,14 +68,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_StartEnvCamera, MediaService_MethodSignature_StartEnvCamera, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_GetAudioDevices, MediaService_MethodSignature_GetAudioDevices, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum StartEnvCamera(MediaService_StartEnvCamera_Req &Req, MediaService_StartEnvCamera_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum GetAudioDevices(MediaService_GetAudioDevices_Req &Req, MediaService_GetAudioDevices_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StartEnvCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetAudioDevices(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -160,10 +83,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum StartEnvCamera(MediaService_StartEnvCamera_Req &Req, MediaService_StartEnvCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum GetAudioDevices(MediaService_GetAudioDevices_Req &Req, MediaService_GetAudioDevices_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StartEnvCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetAudioDevices(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -171,10 +94,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum StartEnvCamera(MediaService_StartEnvCamera_Req &Req, MediaService_StartEnvCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum GetAudioDevices(MediaService_GetAudioDevices_Req &Req, MediaService_GetAudioDevices_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StartEnvCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetAudioDevices(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -184,49 +107,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum StopEnvCamera()
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->OnewayCall(MediaService_Method_StopEnvCamera, MediaService_MethodSignature_StopEnvCamera, m_context);
-		m_context.clear();
-		return ret;
-	}
-
-	ErrorCodeEnum StartSpeakerRender()
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->OnewayCall(MediaService_Method_StartSpeakerRender, MediaService_MethodSignature_StartSpeakerRender, m_context);
-		m_context.clear();
-		return ret;
-	}
-
-	ErrorCodeEnum StopSpeakerRender()
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->OnewayCall(MediaService_Method_StopSpeakerRender, MediaService_MethodSignature_StopSpeakerRender, m_context);
-		m_context.clear();
-		return ret;
-	}
-
-	ErrorCodeEnum ManipulateMediaDevice(MediaService_ManipulateMediaDevice_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum GetVideoDevices(MediaService_GetVideoDevices_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -236,14 +117,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_ManipulateMediaDevice, MediaService_MethodSignature_ManipulateMediaDevice, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_GetVideoDevices, MediaService_MethodSignature_GetVideoDevices, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum ManipulateMediaDevice(MediaService_ManipulateMediaDevice_Req &Req, MediaService_ManipulateMediaDevice_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum GetVideoDevices(MediaService_GetVideoDevices_Req &Req, MediaService_GetVideoDevices_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ManipulateMediaDevice(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetVideoDevices(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -251,10 +132,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum ManipulateMediaDevice(MediaService_ManipulateMediaDevice_Req &Req, MediaService_ManipulateMediaDevice_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum GetVideoDevices(MediaService_GetVideoDevices_Req &Req, MediaService_GetVideoDevices_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ManipulateMediaDevice(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetVideoDevices(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -262,10 +143,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum ManipulateMediaDevice(MediaService_ManipulateMediaDevice_Req &Req, MediaService_ManipulateMediaDevice_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum GetVideoDevices(MediaService_GetVideoDevices_Req &Req, MediaService_GetVideoDevices_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ManipulateMediaDevice(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetVideoDevices(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -275,7 +156,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum GetAudioDevices(MediaService_GetAudioDevices_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum GetCameraInfos(MediaService_GetCameraInfos_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -285,14 +166,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_GetAudioDevices, MediaService_MethodSignature_GetAudioDevices, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_GetCameraInfos, MediaService_MethodSignature_GetCameraInfos, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum GetAudioDevices(MediaService_GetAudioDevices_Req &Req, MediaService_GetAudioDevices_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum GetCameraInfos(MediaService_GetCameraInfos_Req &Req, MediaService_GetCameraInfos_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetAudioDevices(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetCameraInfos(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -300,10 +181,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetAudioDevices(MediaService_GetAudioDevices_Req &Req, MediaService_GetAudioDevices_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum GetCameraInfos(MediaService_GetCameraInfos_Req &Req, MediaService_GetCameraInfos_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetAudioDevices(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetCameraInfos(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -311,10 +192,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetAudioDevices(MediaService_GetAudioDevices_Req &Req, MediaService_GetAudioDevices_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum GetCameraInfos(MediaService_GetCameraInfos_Req &Req, MediaService_GetCameraInfos_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetAudioDevices(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetCameraInfos(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -324,7 +205,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum GetVideoDevices(MediaService_GetVideoDevices_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum ManipulateCameras(MediaService_ManipulateCameras_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -334,14 +215,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_GetVideoDevices, MediaService_MethodSignature_GetVideoDevices, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_ManipulateCameras, MediaService_MethodSignature_ManipulateCameras, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum GetVideoDevices(MediaService_GetVideoDevices_Req &Req, MediaService_GetVideoDevices_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum ManipulateCameras(MediaService_ManipulateCameras_Req &Req, MediaService_ManipulateCameras_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVideoDevices(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = ManipulateCameras(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -349,10 +230,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetVideoDevices(MediaService_GetVideoDevices_Req &Req, MediaService_GetVideoDevices_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum ManipulateCameras(MediaService_ManipulateCameras_Req &Req, MediaService_ManipulateCameras_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVideoDevices(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = ManipulateCameras(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -360,10 +241,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetVideoDevices(MediaService_GetVideoDevices_Req &Req, MediaService_GetVideoDevices_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum ManipulateCameras(MediaService_ManipulateCameras_Req &Req, MediaService_ManipulateCameras_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVideoDevices(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = ManipulateCameras(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -373,7 +254,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum GetCameraInfos(MediaService_GetCameraInfos_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum GetEnvCameraVideoCaptureInfo(MediaService_GetEnvCameraVideoCaptureInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -383,14 +264,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_GetCameraInfos, MediaService_MethodSignature_GetCameraInfos, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_GetEnvCameraVideoCaptureInfo, MediaService_MethodSignature_GetEnvCameraVideoCaptureInfo, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum GetCameraInfos(MediaService_GetCameraInfos_Req &Req, MediaService_GetCameraInfos_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum GetEnvCameraVideoCaptureInfo(MediaService_GetEnvCameraVideoCaptureInfo_Req &Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetCameraInfos(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetEnvCameraVideoCaptureInfo(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -398,10 +279,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetCameraInfos(MediaService_GetCameraInfos_Req &Req, MediaService_GetCameraInfos_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum GetEnvCameraVideoCaptureInfo(MediaService_GetEnvCameraVideoCaptureInfo_Req &Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetCameraInfos(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetEnvCameraVideoCaptureInfo(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -409,10 +290,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetCameraInfos(MediaService_GetCameraInfos_Req &Req, MediaService_GetCameraInfos_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum GetEnvCameraVideoCaptureInfo(MediaService_GetEnvCameraVideoCaptureInfo_Req &Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetCameraInfos(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetEnvCameraVideoCaptureInfo(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -422,7 +303,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum ManipulateCameras(MediaService_ManipulateCameras_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum GetEnvCamRawBrightnessInfo(MediaService_GetEnvCamRawBrightnessInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -432,14 +313,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_ManipulateCameras, MediaService_MethodSignature_ManipulateCameras, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_GetEnvCamRawBrightnessInfo, MediaService_MethodSignature_GetEnvCamRawBrightnessInfo, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum ManipulateCameras(MediaService_ManipulateCameras_Req &Req, MediaService_ManipulateCameras_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum GetEnvCamRawBrightnessInfo(MediaService_GetEnvCamRawBrightnessInfo_Req &Req, MediaService_GetEnvCamRawBrightnessInfo_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ManipulateCameras(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetEnvCamRawBrightnessInfo(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -447,10 +328,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum ManipulateCameras(MediaService_ManipulateCameras_Req &Req, MediaService_ManipulateCameras_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum GetEnvCamRawBrightnessInfo(MediaService_GetEnvCamRawBrightnessInfo_Req &Req, MediaService_GetEnvCamRawBrightnessInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ManipulateCameras(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetEnvCamRawBrightnessInfo(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -458,10 +339,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum ManipulateCameras(MediaService_ManipulateCameras_Req &Req, MediaService_ManipulateCameras_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum GetEnvCamRawBrightnessInfo(MediaService_GetEnvCamRawBrightnessInfo_Req &Req, MediaService_GetEnvCamRawBrightnessInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ManipulateCameras(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetEnvCamRawBrightnessInfo(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -471,7 +352,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum GetEnvCameraVideoCaptureInfo(MediaService_GetEnvCameraVideoCaptureInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum SetEnvCamRawBrightness(MediaService_SetEnvCamRawBrightness_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -481,14 +362,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_GetEnvCameraVideoCaptureInfo, MediaService_MethodSignature_GetEnvCameraVideoCaptureInfo, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_SetEnvCamRawBrightness, MediaService_MethodSignature_SetEnvCamRawBrightness, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum GetEnvCameraVideoCaptureInfo(MediaService_GetEnvCameraVideoCaptureInfo_Req &Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum SetEnvCamRawBrightness(MediaService_SetEnvCamRawBrightness_Req &Req, MediaService_SetEnvCamRawBrightness_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetEnvCameraVideoCaptureInfo(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = SetEnvCamRawBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -496,10 +377,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetEnvCameraVideoCaptureInfo(MediaService_GetEnvCameraVideoCaptureInfo_Req &Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum SetEnvCamRawBrightness(MediaService_SetEnvCamRawBrightness_Req &Req, MediaService_SetEnvCamRawBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetEnvCameraVideoCaptureInfo(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = SetEnvCamRawBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -507,10 +388,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetEnvCameraVideoCaptureInfo(MediaService_GetEnvCameraVideoCaptureInfo_Req &Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum SetEnvCamRawBrightness(MediaService_SetEnvCamRawBrightness_Req &Req, MediaService_SetEnvCamRawBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetEnvCameraVideoCaptureInfo(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = SetEnvCamRawBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -520,7 +401,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum GetEnvCamRawBrightnessInfo(MediaService_GetEnvCamRawBrightnessInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum TurnOnCamera(MediaService_TurnOnCamera_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -530,14 +411,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_GetEnvCamRawBrightnessInfo, MediaService_MethodSignature_GetEnvCamRawBrightnessInfo, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_TurnOnCamera, MediaService_MethodSignature_TurnOnCamera, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum GetEnvCamRawBrightnessInfo(MediaService_GetEnvCamRawBrightnessInfo_Req &Req, MediaService_GetEnvCamRawBrightnessInfo_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum TurnOnCamera(MediaService_TurnOnCamera_Req &Req, MediaService_TurnOnCamera_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetEnvCamRawBrightnessInfo(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = TurnOnCamera(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -545,10 +426,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetEnvCamRawBrightnessInfo(MediaService_GetEnvCamRawBrightnessInfo_Req &Req, MediaService_GetEnvCamRawBrightnessInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum TurnOnCamera(MediaService_TurnOnCamera_Req &Req, MediaService_TurnOnCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetEnvCamRawBrightnessInfo(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = TurnOnCamera(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -556,10 +437,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum GetEnvCamRawBrightnessInfo(MediaService_GetEnvCamRawBrightnessInfo_Req &Req, MediaService_GetEnvCamRawBrightnessInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum TurnOnCamera(MediaService_TurnOnCamera_Req &Req, MediaService_TurnOnCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetEnvCamRawBrightnessInfo(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = TurnOnCamera(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -569,7 +450,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum SetEnvCamRawBrightness(MediaService_SetEnvCamRawBrightness_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum TurnOffCamera(MediaService_TurnOffCamera_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -579,14 +460,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_SetEnvCamRawBrightness, MediaService_MethodSignature_SetEnvCamRawBrightness, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_TurnOffCamera, MediaService_MethodSignature_TurnOffCamera, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum SetEnvCamRawBrightness(MediaService_SetEnvCamRawBrightness_Req &Req, MediaService_SetEnvCamRawBrightness_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum TurnOffCamera(MediaService_TurnOffCamera_Req &Req, MediaService_TurnOffCamera_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = SetEnvCamRawBrightness(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = TurnOffCamera(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -594,10 +475,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum SetEnvCamRawBrightness(MediaService_SetEnvCamRawBrightness_Req &Req, MediaService_SetEnvCamRawBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum TurnOffCamera(MediaService_TurnOffCamera_Req &Req, MediaService_TurnOffCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = SetEnvCamRawBrightness(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = TurnOffCamera(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -605,10 +486,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum SetEnvCamRawBrightness(MediaService_SetEnvCamRawBrightness_Req &Req, MediaService_SetEnvCamRawBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum TurnOffCamera(MediaService_TurnOffCamera_Req &Req, MediaService_TurnOffCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = SetEnvCamRawBrightness(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = TurnOffCamera(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -618,7 +499,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum TurnOnCamera(MediaService_TurnOnCamera_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum IsCameraOnStatus(MediaService_IsCameraOnStatus_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -628,14 +509,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_TurnOnCamera, MediaService_MethodSignature_TurnOnCamera, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_IsCameraOnStatus, MediaService_MethodSignature_IsCameraOnStatus, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum TurnOnCamera(MediaService_TurnOnCamera_Req &Req, MediaService_TurnOnCamera_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum IsCameraOnStatus(MediaService_IsCameraOnStatus_Req &Req, MediaService_IsCameraOnStatus_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TurnOnCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = IsCameraOnStatus(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -643,10 +524,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum TurnOnCamera(MediaService_TurnOnCamera_Req &Req, MediaService_TurnOnCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum IsCameraOnStatus(MediaService_IsCameraOnStatus_Req &Req, MediaService_IsCameraOnStatus_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TurnOnCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = IsCameraOnStatus(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -654,10 +535,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum TurnOnCamera(MediaService_TurnOnCamera_Req &Req, MediaService_TurnOnCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum IsCameraOnStatus(MediaService_IsCameraOnStatus_Req &Req, MediaService_IsCameraOnStatus_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TurnOnCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = IsCameraOnStatus(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -667,7 +548,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum TurnOffCamera(MediaService_TurnOffCamera_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum GetCameraBrightness(MediaService_GetCameraBrightness_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -677,14 +558,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_TurnOffCamera, MediaService_MethodSignature_TurnOffCamera, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_GetCameraBrightness, MediaService_MethodSignature_GetCameraBrightness, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum TurnOffCamera(MediaService_TurnOffCamera_Req &Req, MediaService_TurnOffCamera_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum GetCameraBrightness(MediaService_GetCameraBrightness_Req &Req, MediaService_GetCameraBrightness_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TurnOffCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetCameraBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -692,10 +573,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum TurnOffCamera(MediaService_TurnOffCamera_Req &Req, MediaService_TurnOffCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum GetCameraBrightness(MediaService_GetCameraBrightness_Req &Req, MediaService_GetCameraBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TurnOffCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetCameraBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -703,10 +584,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum TurnOffCamera(MediaService_TurnOffCamera_Req &Req, MediaService_TurnOffCamera_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum GetCameraBrightness(MediaService_GetCameraBrightness_Req &Req, MediaService_GetCameraBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TurnOffCamera(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = GetCameraBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;
@@ -716,7 +597,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum IsCameraOnStatus(MediaService_IsCameraOnStatus_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum SetCameraBrightness(MediaService_SetCameraBrightness_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -726,14 +607,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(MediaService_Method_IsCameraOnStatus, MediaService_MethodSignature_IsCameraOnStatus, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(MediaService_Method_SetCameraBrightness, MediaService_MethodSignature_SetCameraBrightness, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum IsCameraOnStatus(MediaService_IsCameraOnStatus_Req &Req, MediaService_IsCameraOnStatus_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum SetCameraBrightness(MediaService_SetCameraBrightness_Req &Req, MediaService_SetCameraBrightness_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = IsCameraOnStatus(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = SetCameraBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -741,10 +622,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum IsCameraOnStatus(MediaService_IsCameraOnStatus_Req &Req, MediaService_IsCameraOnStatus_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum SetCameraBrightness(MediaService_SetCameraBrightness_Req &Req, MediaService_SetCameraBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = IsCameraOnStatus(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = SetCameraBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -752,10 +633,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum IsCameraOnStatus(MediaService_IsCameraOnStatus_Req &Req, MediaService_IsCameraOnStatus_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum SetCameraBrightness(MediaService_SetCameraBrightness_Req &Req, MediaService_SetCameraBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = IsCameraOnStatus(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = SetCameraBrightness(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;

+ 58 - 143
Module/mod_mediacontroller/MediaController_def_g.h

@@ -12,14 +12,6 @@ namespace MediaController {
 // const goes here
 //
 
-#define MediaService_Method_GetVideoDeviceName 0
-#define MediaService_Method_StartCamera 1
-#define MediaService_Method_StopCamera 2
-#define MediaService_Method_StartEnvCamera 3
-#define MediaService_Method_StopEnvCamera 4
-#define MediaService_Method_StartSpeakerRender 5
-#define MediaService_Method_StopSpeakerRender 6
-#define MediaService_Method_ManipulateMediaDevice 7
 #define MediaService_Method_GetAudioDevices 8
 #define MediaService_Method_GetVideoDevices 9
 #define MediaService_Method_GetCameraInfos 10
@@ -30,15 +22,9 @@ namespace MediaController {
 #define MediaService_Method_TurnOnCamera 15
 #define MediaService_Method_TurnOffCamera 16
 #define MediaService_Method_IsCameraOnStatus 17
+#define MediaService_Method_GetCameraBrightness 18
+#define MediaService_Method_SetCameraBrightness 19
 
-#define MediaService_MethodSignature_GetVideoDeviceName -496217232
-#define MediaService_MethodSignature_StartCamera 749460891
-#define MediaService_MethodSignature_StopCamera -1102036124
-#define MediaService_MethodSignature_StartEnvCamera -628264124
-#define MediaService_MethodSignature_StopEnvCamera -1214187442
-#define MediaService_MethodSignature_StartSpeakerRender -803727657
-#define MediaService_MethodSignature_StopSpeakerRender -1325509398
-#define MediaService_MethodSignature_ManipulateMediaDevice -461255211
 #define MediaService_MethodSignature_GetAudioDevices -819377328
 #define MediaService_MethodSignature_GetVideoDevices 616397805
 #define MediaService_MethodSignature_GetCameraInfos -2116637958
@@ -49,15 +35,9 @@ namespace MediaController {
 #define MediaService_MethodSignature_TurnOnCamera -1801492539
 #define MediaService_MethodSignature_TurnOffCamera -1380301309
 #define MediaService_MethodSignature_IsCameraOnStatus -491616205
+#define MediaService_MethodSignature_GetCameraBrightness 129842938
+#define MediaService_MethodSignature_SetCameraBrightness 1186334350
 
-#define MediaService_LogCode_GetVideoDeviceName "QLR040220800"
-#define MediaService_LogCode_StartCamera "QLR040220801"
-#define MediaService_LogCode_StopCamera "QLR040220802"
-#define MediaService_LogCode_StartEnvCamera "QLR040220803"
-#define MediaService_LogCode_StopEnvCamera "QLR040220804"
-#define MediaService_LogCode_StartSpeakerRender "QLR040220805"
-#define MediaService_LogCode_StopSpeakerRender "QLR040220806"
-#define MediaService_LogCode_ManipulateMediaDevice "QLR040220807"
 #define MediaService_LogCode_GetAudioDevices "QLR040220808"
 #define MediaService_LogCode_GetVideoDevices "QLR040220809"
 #define MediaService_LogCode_GetCameraInfos "QLR040220810"
@@ -68,119 +48,8 @@ namespace MediaController {
 #define MediaService_LogCode_TurnOnCamera "QLR040220815"
 #define MediaService_LogCode_TurnOffCamera "QLR040220816"
 #define MediaService_LogCode_IsCameraOnStatus "QLR040220817"
-
-struct MediaService_GetVideoDeviceName_Req
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct MediaService_GetVideoDeviceName_Ans
-{
-	CSimpleStringA frontcam;
-	CSimpleStringA rearcam;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & frontcam & rearcam;
-	}
-
-};
-
-struct MediaService_StartCamera_Info
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct MediaService_StopCamera_Info
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct MediaService_StartEnvCamera_Req
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct MediaService_StartEnvCamera_Ans
-{
-	int returncod;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & returncod;
-	}
-
-};
-
-struct MediaService_StopEnvCamera_Info
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct MediaService_StartSpeakerRender_Info
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct MediaService_StopSpeakerRender_Info
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct MediaService_ManipulateMediaDevice_Req
-{
-	int cmdType;
-	int devType;
-	int reserved1;
-	CSimpleStringA reserved2;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & cmdType & devType & reserved1 & reserved2;
-	}
-
-};
-
-struct MediaService_ManipulateMediaDevice_Ans
-{
-	int retCode;
-	int reserved1;
-	CSimpleStringA reserved2;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & retCode & reserved1 & reserved2;
-	}
-
-};
+#define MediaService_LogCode_GetCameraBrightness "QLR040220818"
+#define MediaService_LogCode_SetCameraBrightness "QLR040220819"
 
 struct MediaService_GetAudioDevices_Req
 {
@@ -344,21 +213,22 @@ struct MediaService_SetEnvCamRawBrightness_Ans
 
 struct MediaService_TurnOnCamera_Req
 {
+	bool bPostCapInfo;
 
 	void Serialize(SpBuffer &Buf)
 	{
+		auto & buf = Buf & bPostCapInfo;
 	}
 
 };
 
 struct MediaService_TurnOnCamera_Ans
 {
-	unsigned int ErrorCode;
-	CSimpleStringW ErrorMsg;
+	int result;
 
 	void Serialize(SpBuffer &Buf)
 	{
-		auto & buf = Buf & ErrorCode & ErrorMsg;
+		auto & buf = Buf & result;
 	}
 
 };
@@ -374,12 +244,11 @@ struct MediaService_TurnOffCamera_Req
 
 struct MediaService_TurnOffCamera_Ans
 {
-	unsigned int ErrorCode;
-	CSimpleStringW ErrorMsg;
+	int result;
 
 	void Serialize(SpBuffer &Buf)
 	{
-		auto & buf = Buf & ErrorCode & ErrorMsg;
+		auto & buf = Buf & result;
 	}
 
 };
@@ -404,6 +273,52 @@ struct MediaService_IsCameraOnStatus_Ans
 
 };
 
+struct MediaService_GetCameraBrightness_Req
+{
+	int icameraid;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & icameraid;
+	}
+
+};
+
+struct MediaService_GetCameraBrightness_Ans
+{
+	int ibrightness;
+	int result;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & ibrightness & result;
+	}
+
+};
+
+struct MediaService_SetCameraBrightness_Req
+{
+	int icameraid;
+	int ibrightness;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & icameraid & ibrightness;
+	}
+
+};
+
+struct MediaService_SetCameraBrightness_Ans
+{
+	int result;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & result;
+	}
+
+};
+
 
 ///////////////////////////
 

+ 0 - 61
Module/mod_mediacontroller/MediaController_msg_g.h

@@ -9,71 +9,10 @@
 #include "SpHelper.h"
 
 namespace MediaController {
-#define eMsg_ExternalCameraSwitchFailed 0
-#define eMsg_ExternalCameraInserted 1
-#define eMsg_ExternalCameraRemoved 2
-#define eMsg_ExternalCameraStateChanged 3
 #define eMsg_EnvCameraCapInfo 4
 
-#define eMsgSig_ExternalCameraSwitchFailed 637170259
-#define eMsgSig_ExternalCameraInserted 1355033794
-#define eMsgSig_ExternalCameraRemoved -2086712549
-#define eMsgSig_ExternalCameraStateChanged -181183885
 #define eMsgSig_EnvCameraCapInfo -1158933893
 
-struct ExternalCameraSwitchFailed
-{
-	CSimpleStringW failedmsg;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & failedmsg;
-	}
-
-};
-
-///////////////////////////
-
-struct ExternalCameraInserted
-{
-	CSimpleStringW camname;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & camname;
-	}
-
-};
-
-///////////////////////////
-
-struct ExternalCameraRemoved
-{
-	CSimpleStringW camname;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & camname;
-	}
-
-};
-
-///////////////////////////
-
-struct ExternalCameraStateChanged
-{
-	CSimpleStringW statemsg;
-	CSimpleStringW camname;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & statemsg & camname;
-	}
-
-};
-
-///////////////////////////
-
 struct EnvCameraCapInfo
 {
 	CSimpleStringW cameracapmsg;

+ 54 - 216
Module/mod_mediacontroller/MediaController_server_g.h

@@ -30,62 +30,6 @@ public:
 	{
 		ErrorCodeEnum Error = Error_Succeed;
 		switch (dwMessageID) {
-		case MediaService_Method_GetVideoDeviceName:
-			if (dwSignature == MediaService_MethodSignature_GetVideoDeviceName) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StartCamera:
-			if (dwSignature == MediaService_MethodSignature_StartCamera) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StopCamera:
-			if (dwSignature == MediaService_MethodSignature_StopCamera) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StartEnvCamera:
-			if (dwSignature == MediaService_MethodSignature_StartEnvCamera) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StopEnvCamera:
-			if (dwSignature == MediaService_MethodSignature_StopEnvCamera) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StartSpeakerRender:
-			if (dwSignature == MediaService_MethodSignature_StartSpeakerRender) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StopSpeakerRender:
-			if (dwSignature == MediaService_MethodSignature_StopSpeakerRender) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_ManipulateMediaDevice:
-			if (dwSignature == MediaService_MethodSignature_ManipulateMediaDevice) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
 		case MediaService_Method_GetAudioDevices:
 			if (dwSignature == MediaService_MethodSignature_GetAudioDevices) {
 				bOverlap = true;
@@ -156,6 +100,20 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case MediaService_Method_GetCameraBrightness:
+			if (dwSignature == MediaService_MethodSignature_GetCameraBrightness) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case MediaService_Method_SetCameraBrightness:
+			if (dwSignature == MediaService_MethodSignature_SetCameraBrightness) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -167,46 +125,6 @@ public:
 	{
 		ErrorCodeEnum Error = Error_Succeed;
 		switch (dwMessageID) {
-		case MediaService_Method_GetVideoDeviceName:
-			if (dwSignature != MediaService_MethodSignature_GetVideoDeviceName) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StartCamera:
-			if (dwSignature != MediaService_MethodSignature_StartCamera) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StopCamera:
-			if (dwSignature != MediaService_MethodSignature_StopCamera) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StartEnvCamera:
-			if (dwSignature != MediaService_MethodSignature_StartEnvCamera) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StopEnvCamera:
-			if (dwSignature != MediaService_MethodSignature_StopEnvCamera) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StartSpeakerRender:
-			if (dwSignature != MediaService_MethodSignature_StartSpeakerRender) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_StopSpeakerRender:
-			if (dwSignature != MediaService_MethodSignature_StopSpeakerRender) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case MediaService_Method_ManipulateMediaDevice:
-			if (dwSignature != MediaService_MethodSignature_ManipulateMediaDevice) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
 		case MediaService_Method_GetAudioDevices:
 			if (dwSignature != MediaService_MethodSignature_GetAudioDevices) {
 				Error = Error_MethodSignatureFailed;
@@ -257,6 +175,16 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case MediaService_Method_GetCameraBrightness:
+			if (dwSignature != MediaService_MethodSignature_GetCameraBrightness) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case MediaService_Method_SetCameraBrightness:
+			if (dwSignature != MediaService_MethodSignature_SetCameraBrightness) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -264,46 +192,6 @@ public:
 		return Error;
 	}
 
-	virtual void Handle_GetVideoDeviceName(SpReqAnsContext<MediaService_GetVideoDeviceName_Req, MediaService_GetVideoDeviceName_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_StartCamera(SpOnewayCallContext<MediaService_StartCamera_Info>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_StopCamera(SpOnewayCallContext<MediaService_StopCamera_Info>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_StartEnvCamera(SpReqAnsContext<MediaService_StartEnvCamera_Req, MediaService_StartEnvCamera_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_StopEnvCamera(SpOnewayCallContext<MediaService_StopEnvCamera_Info>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_StartSpeakerRender(SpOnewayCallContext<MediaService_StartSpeakerRender_Info>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_StopSpeakerRender(SpOnewayCallContext<MediaService_StopSpeakerRender_Info>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_ManipulateMediaDevice(SpReqAnsContext<MediaService_ManipulateMediaDevice_Req, MediaService_ManipulateMediaDevice_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
 	virtual void Handle_GetAudioDevices(SpReqAnsContext<MediaService_GetAudioDevices_Req, MediaService_GetAudioDevices_Ans>::Pointer ctx)
 	{
 	/// override by user
@@ -354,6 +242,16 @@ public:
 	/// override by user
 	}
 
+	virtual void Handle_GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
+	virtual void Handle_SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
 	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CAutoBuffer Buf;
@@ -370,86 +268,6 @@ public:
 			}
 #endif
 			switch (dwMessageID) {
-				case MediaService_Method_GetVideoDeviceName:
-					{
-						SpReqAnsContext<MediaService_GetVideoDeviceName_Req,MediaService_GetVideoDeviceName_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<MediaService_GetVideoDeviceName_Req,MediaService_GetVideoDeviceName_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_GetVideoDeviceName(ctx);
-					}
-					break;
-				case MediaService_Method_StartCamera:
-					{
-						SpOnewayCallContext<MediaService_StartCamera_Info>::Pointer ctx;
-						ctx.Attach(new SpOnewayCallContext<MediaService_StartCamera_Info>());
-						SpBuffer2Object(Buf, ctx->Info);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_StartCamera(ctx);
-					}
-					break;
-				case MediaService_Method_StopCamera:
-					{
-						SpOnewayCallContext<MediaService_StopCamera_Info>::Pointer ctx;
-						ctx.Attach(new SpOnewayCallContext<MediaService_StopCamera_Info>());
-						SpBuffer2Object(Buf, ctx->Info);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_StopCamera(ctx);
-					}
-					break;
-				case MediaService_Method_StartEnvCamera:
-					{
-						SpReqAnsContext<MediaService_StartEnvCamera_Req,MediaService_StartEnvCamera_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<MediaService_StartEnvCamera_Req,MediaService_StartEnvCamera_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_StartEnvCamera(ctx);
-					}
-					break;
-				case MediaService_Method_StopEnvCamera:
-					{
-						SpOnewayCallContext<MediaService_StopEnvCamera_Info>::Pointer ctx;
-						ctx.Attach(new SpOnewayCallContext<MediaService_StopEnvCamera_Info>());
-						SpBuffer2Object(Buf, ctx->Info);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_StopEnvCamera(ctx);
-					}
-					break;
-				case MediaService_Method_StartSpeakerRender:
-					{
-						SpOnewayCallContext<MediaService_StartSpeakerRender_Info>::Pointer ctx;
-						ctx.Attach(new SpOnewayCallContext<MediaService_StartSpeakerRender_Info>());
-						SpBuffer2Object(Buf, ctx->Info);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_StartSpeakerRender(ctx);
-					}
-					break;
-				case MediaService_Method_StopSpeakerRender:
-					{
-						SpOnewayCallContext<MediaService_StopSpeakerRender_Info>::Pointer ctx;
-						ctx.Attach(new SpOnewayCallContext<MediaService_StopSpeakerRender_Info>());
-						SpBuffer2Object(Buf, ctx->Info);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_StopSpeakerRender(ctx);
-					}
-					break;
-				case MediaService_Method_ManipulateMediaDevice:
-					{
-						SpReqAnsContext<MediaService_ManipulateMediaDevice_Req,MediaService_ManipulateMediaDevice_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<MediaService_ManipulateMediaDevice_Req,MediaService_ManipulateMediaDevice_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_ManipulateMediaDevice(ctx);
-					}
-					break;
 				case MediaService_Method_GetAudioDevices:
 					{
 						SpReqAnsContext<MediaService_GetAudioDevices_Req,MediaService_GetAudioDevices_Ans>::Pointer ctx;
@@ -550,6 +368,26 @@ public:
 						Handle_IsCameraOnStatus(ctx);
 					}
 					break;
+				case MediaService_Method_GetCameraBrightness:
+					{
+						SpReqAnsContext<MediaService_GetCameraBrightness_Req,MediaService_GetCameraBrightness_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<MediaService_GetCameraBrightness_Req,MediaService_GetCameraBrightness_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_GetCameraBrightness(ctx);
+					}
+					break;
+				case MediaService_Method_SetCameraBrightness:
+					{
+						SpReqAnsContext<MediaService_SetCameraBrightness_Req,MediaService_SetCameraBrightness_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<MediaService_SetCameraBrightness_Req,MediaService_SetCameraBrightness_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_SetCameraBrightness(ctx);
+					}
+					break;
 				default:
 					assert(0);
 					break;

+ 68 - 111
Module/mod_mediacontroller/MediaService.xml

@@ -1,88 +1,50 @@
 <?xml version="1.0" encoding="gb2312" ?>
 <entity name="MediaController">
 	<class name="MediaService" overlap="true" exclusive="false">
-		<twoway name="GetVideoDeviceName" overlap="true">
-			<res>
-				<param name="frontcam" type="string"/>
-				<param name="rearcam" type="string"/>
-			</res>
-		</twoway>
-		<oneway name="StartCamera" overlap="true">
-		</oneway>
-		<oneway name="StopCamera" overlap="true">
-		</oneway>
-		<twoway name="StartEnvCamera" overlap="true">
-			<res>
-				<param name="returncod" type="int"/>
-			</res>
-		</twoway>
-		<oneway name="StopEnvCamera" overlap="true">
-		</oneway>
-		<oneway name="StartSpeakerRender" overlap="true">
-		</oneway>
-		<oneway name="StopSpeakerRender" overlap="true">
-		</oneway>
-		<twoway name="ManipulateMediaDevice" overlap="true">
-            <req>
-            	<!--操作意图指令: 0:获取并接管设备权限;1:归还设备权限,不再占用-->
-            	<param name="cmdType" type="int"/>
-            	<!--设备类型:0:无效参数;1:ENV环境摄像头;2:OPT操作摄像头;3:EWS外部广角摄像头;4:高拍仪文档摄像头;5:高拍仪上接摄像头-->
-            	<param name="devType" type="int"/>
-            	<param name="reserved1" type="int"/>
-            	<param name="reserved2" type="string"/>
-            </req>
-            <!--实体收到接口请求时无论操作成功与否返回Answer(Error_Succeed),具体操作成功与否通过retCode标识-->
-            <res>
-            	<!--retCode:0:表示成功,非0:表示失败 -->
-            	<param name="retCode" type="int"/>
-            	<param name="reserved1" type="int"/>
-            	<param name="reserved2" type="string"/>
-            </res>
-    </twoway>
-		<twoway name="GetAudioDevices" overlap="true">
-            <req>
-            	<param name="audioType" type="int"/>
-            </req>
-            <res>
-            	<param name="retCode" type="int"/>
-		<param name="deviceCount" type="int"/>
-              <param name="strNames" type="string"/>
-            </res>
+		<twoway name="GetAudioDevices" overlap="true" method_id="8">
+      <req>
+        <param name="audioType" type="int"/>
+      </req>
+      <res>
+       	<param name="retCode" type="int"/>
+		    <param name="deviceCount" type="int"/>
+        <param name="strNames" type="string"/>
+      </res>
     </twoway>
-    <twoway name="GetVideoDevices" overlap="true">
-            <res>
-              <param name="retCode" type="int"/>
+    <twoway name="GetVideoDevices" overlap="true" method_id="9">
+      <res>
+        <param name="retCode" type="int"/>
 	      <param name="deviceCount" type="int"/>
-              <param name="strNames" type="string"/>
-           </res>
-     </twoway>
-     <twoway name="GetCameraInfos" overlap="true">
-             <res>
-		<param name="retCode" type="int"/>
-		<param name="EnvCamera" type="string"/>
-		<param name="EnvUsbPort" type="string"/>
-		<param name="EnvReserved" type="string"/>
-		<param name="OptCamera" type="string"/>
-		<param name="OptUsbPort" type="string"/>
-		<param name="OptReserved" type="string"/>
-             </res>
-     </twoway>
-     <twoway name="ManipulateCameras" overlap="true">
+        <param name="strNames" type="string"/>
+      </res>
+    </twoway>
+    <twoway name="GetCameraInfos" overlap="true" method_id="10">
+      <res>
+		    <param name="retCode" type="int"/>
+		    <param name="EnvCamera" type="string"/>
+		    <param name="EnvUsbPort" type="string"/>
+		    <param name="EnvReserved" type="string"/>
+		    <param name="OptCamera" type="string"/>
+		    <param name="OptUsbPort" type="string"/>
+		    <param name="OptReserved" type="string"/>
+      </res>
+    </twoway>
+    <twoway name="ManipulateCameras" overlap="true" method_id="11">
      	<req>
-         	<!--操作意图指令: 0:获取并接管设备权限;1:归还设备权限,不再占用-->
-                <param name="cmdType" type="int"/>
-        	<param name="reserved1" type="int"/>
-         	<param name="reserved2" type="string"/>
-        </req>
+        <!--操作意图指令: 0:获取并接管设备权限;1:归还设备权限,不再占用-->
+        <param name="cmdType" type="int"/>
+        <param name="reserved1" type="int"/>
+        <param name="reserved2" type="string"/>
+      </req>
         <!--实体收到接口请求时无论操作成功与否返回Answer(Error_Succeed),具体操作成功与否通过retCode标识-->
-        <res>
+      <res>
         <!--retCode:0:表示成功,非0:表示失败 -->
-         	<param name="retCode" type="int"/>
-         	<param name="reserved1" type="int"/>
-         	<param name="reserved2" type="string"/>
-        </res>
+        <param name="retCode" type="int"/>
+        <param name="reserved1" type="int"/>
+        <param name="reserved2" type="string"/>
+      </res>
     </twoway>
-    <twoway name="GetEnvCameraVideoCaptureInfo" overlap="true">
+    <twoway name="GetEnvCameraVideoCaptureInfo" overlap="true" method_id="12">
       <req>
       </req>
       <res>
@@ -90,7 +52,7 @@
         <param name="strcmd" type="string"/>
       </res>
     </twoway>
-    <twoway name="GetEnvCamRawBrightnessInfo" overlap="true">
+    <twoway name="GetEnvCamRawBrightnessInfo" overlap="true" method_id="13">
       <req>
       </req>
       <res>
@@ -98,61 +60,56 @@
         <param name="iMaxBrightness" type="int"/>
       </res>
     </twoway>
-    <twoway name="SetEnvCamRawBrightness" overlap="true">
+    <twoway name="SetEnvCamRawBrightness" overlap="true" method_id="14">
       <req>
         <param name="iBrightness" type="int"/>
       </req>
       <res>
       </res>
     </twoway>
-    <twoway name="TurnOnCamera" overlap="true">
+    <twoway name="TurnOnCamera" overlap="true" method_id="15">
       <req>
+        <param name="bPostCapInfo" type="bool"/>
       </req>
       <res>
-        <param name="ErrorCode" type="uint"/>
-        <param name="ErrorMsg" type="wstring"/>
+        <param name="result" type="int"/>
       </res>
     </twoway>
-    <twoway name="TurnOffCamera" overlap="true">
+    <twoway name="TurnOffCamera" overlap="true" method_id="16">
       <req>
       </req>
       <res>
-        <param name="ErrorCode" type="uint"/>
-        <param name="ErrorMsg" type="wstring"/>
+        <param name="result" type="int"/>
       </res>
     </twoway>
-    <twoway name="IsCameraOnStatus" overlap="true">
+    <twoway name="IsCameraOnStatus" overlap="true" method_id="17">
       <req>
       </req>
       <res>
         <param name="biscameraon" type="bool"/>
       </res>
+    </twoway>
+    <twoway name="GetCameraBrightness" overlap="true" method_id="18">
+      <req>
+        <param name="icameraid" type="int"/>
+      </req>
+      <res>
+        <param name="ibrightness" type="int"/>
+        <param name="result" type="int"/>
+      </res>
+    </twoway>
+    <twoway name="SetCameraBrightness" overlap="true" method_id="19">
+      <req>
+        <param name="icameraid" type="int"/>
+        <param name="ibrightness" type="int"/>
+      </req>
+      <res>
+        <param name="result" type="int"/>
+      </res>
     </twoway>
 	</class>
-	<!-- 内置摄像头切换外接摄像头失败消息 -->
-	<message name="ExternalCameraSwitchFailed">
-		<!-- 失败提示 -->
-		<param name="failedmsg" type="wstring"/>
-	</message>
-	<!-- 外接摄像头插入消息 -->
-	<message name="ExternalCameraInserted">
-		<!-- 摄像头名称 -->
-		<param name="camname" type="wstring"/>
-	</message>
-	<!-- 外接摄像头移除消息 -->
-	<message name="ExternalCameraRemoved">
-		<!-- 摄像头名称 -->
-		<param name="camname" type="wstring"/>
-	</message>
-	<!-- 外接摄像头启动状态变化消息 -->
-	<message name="ExternalCameraStateChanged">
-		<!-- 状态消息 -->
-		<param name="statemsg" type="wstring"/>
-		<!-- 摄像头名称 -->
-		<param name="camname" type="wstring"/>
-	</message>
-  	<!-- 上摄像头稳定性数据 -->
-  	<message name="EnvCameraCapInfo">
-    		<param name="cameracapmsg" type="wstring"/>
-  	</message>
+  <!-- 上摄像头稳定性数据 -->
+  <message name="EnvCameraCapInfo">
+  	<param name="cameracapmsg" type="wstring"/>
+  </message>
 </entity>

+ 74 - 0
Module/mod_mediacontroller/brightnessinfo.cpp

@@ -0,0 +1,74 @@
+#include "brightnessinfo.h"
+#include "strutil.h"
+#include "CommEntityUtil.hpp"
+
+
+void HttpsLogCallBack(const char* logtxt) {
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI("HttpsLogCallBack")("HttpsLogCallBack: %s.", logtxt);
+}
+
+
+int post_camera_brightness_info_list(unsigned int& uposttime, CSimpleStringA& errormsg, brightness_info_t* pinfo, int itimeout, bool bprintdbg)
+{
+	int iret = -1;
+
+	IHttpFunc* client = create_http(HttpsLogCallBack);
+	BrightnessInfoHTTPReq req;
+	req.m_timeOut = itimeout;
+	if (bprintdbg) {
+		req.m_printDbg = true;
+	}
+	const char* pData = pinfo->strServerURL.GetData();
+	if (pData) {
+		req.m_url = pData;
+	}
+
+	pData = pinfo->strAPI.GetData();
+	if (pData) {
+		req.m_url.append(pData);
+	}
+
+	Json::Value rootReq;
+
+	pData = pinfo->strTerminalNo.GetData();
+	if (pData) {
+		rootReq["terminal_no"] = pData;
+	}
+
+	pData = pinfo->strAppVersion.GetData();
+	if (pData) {
+		rootReq["app_version"] = pData;
+	}
+
+	for (vector<brightness_item_t*>::iterator it = pinfo->vBrightnessList.begin(); it < pinfo->vBrightnessList.end(); ++it) {
+		Json::Value item;
+		item["module"] = (*it)->module;
+		item["name"] = (*it)->name;
+		item["value"] = (*it)->value;
+		rootReq["config_list"].append(item);
+	}
+
+	Json::StyledWriter sw;
+
+	req.m_reqContent = sw.write(rootReq);
+
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_reqContent is %s.", req.m_reqContent.c_str());
+
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin http get request, timeout is %d, printdbg flag is %s.", req.m_timeOut, req.m_printDbg ? "true" : "false");
+
+	unsigned int ustarttime = SP::Module::Comm::RVCGetTickCount();
+
+	BrightnessInfoHTTPRet ret;
+	if (client->Post(req, ret)) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("post result is %s, returnCode:%s, code:%s, errorMsg:%s, message:%s.",
+			ret.m_success ? "success" : "failed", ret.m_returnCode.c_str(), ret.m_code.c_str(), ret.m_errorMsg.c_str(), ret.m_message.c_str());
+		uposttime = SP::Module::Comm::RVCGetTickCount() - ustarttime;
+		iret = 0;
+	}
+	else {
+		errormsg = CSimpleStringA::Format("post camera brightness info failed, url=%s, syscode=%d, usercode=%s, errmsg=%s", req.m_url.c_str(), ret.m_sysCode, ret.m_userCode.c_str(), ret.m_errMsg.c_str());
+	}
+
+	return iret;
+}
+

+ 100 - 0
Module/mod_mediacontroller/brightnessinfo.h

@@ -0,0 +1,100 @@
+#ifndef _BRIGHTNESSINFO_H_
+#define _BRIGHTNESSINFO_H_
+
+#include "IHttpFunc.h"
+#include "json/json.h"
+#include "SpBase.h"
+
+#ifdef DEVOPS_ON_ST /*DevOps流水线编译,ST环境*/
+#ifndef RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#define RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL "https://accessproxy-service.paasst.cmbchina.cn"
+#endif // !RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#elif defined(DEVOPS_ON_PRD)/*DevOps流水线编译,PRD环境*/
+#ifndef RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#define RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL "https://accessproxy-service.paas.cmbchina.cn"
+#endif // !RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#elif defined(DEVOPS_ON_UAT)/*DevOps流水线编译,UAT环境*/
+#ifndef RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#define RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL "https://accessproxy-service.paasuat.cmbchina.cn"
+#endif // !RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#elif defined(DEVOPS_ON_DEV)/*DevOps流水线编译,Dev环境*/
+#ifndef RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#define RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL "https://accessproxy-service.paas.cmbchina.cn"
+#endif // !RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#else/*本地编译等非DevOps环境编译的版本*/
+#ifndef RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#define RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL "https://accessproxy-service.paasst.cmbchina.cn"
+#endif // !RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL
+#endif
+
+#ifndef RVC_UPDATE_CAMERABRIGHNESS_HTTP_API
+#define RVC_UPDATE_CAMERABRIGHNESS_HTTP_API "/centerconfignoauth/api/unify/config/alter/exposure"
+#endif // !RVC_UPDATE_CAMERABRIGHNESS_HTTP_API
+
+#ifndef RVC_HTTPTIMEOUT
+#define RVC_HTTPTIMEOUT 20
+#endif // !RVC_HTTPTIMEOUT
+
+
+#define REFLECTION(var) #var
+
+
+typedef struct brightness_item_s {
+	std::string module;
+	std::string name;
+	std::string value;
+}brightness_item_t;
+
+
+//brightness_info_t
+typedef struct brightness_info_s {
+	CSimpleStringA strServerURL;
+	CSimpleStringA strAPI;
+	CSimpleStringA strTerminalNo;
+	CSimpleStringA strAppVersion;
+	CSimpleStringA strBranchNo;
+	vector<brightness_item_t*> vBrightnessList;
+}brightness_info_t;
+
+
+struct BrightnessInfoHTTPReq : CHTTPReq {
+	std::string m_reqContent;
+	virtual string ToJson() {
+		return m_reqContent;
+	}
+};
+
+
+struct BrightnessInfoHTTPRet : CHTTPRet {
+	std::string m_request;
+	bool	m_success;
+	std::string m_code;
+	std::string m_message;
+	std::string m_returnCode;
+	std::string m_errorMsg;
+	bool	m_data;
+
+	virtual bool Parse(string strData) {
+		Json::Value root;
+		Json::Reader reader;
+
+		if (reader.parse(strData, root, false)) {
+			m_success = root[REFLECTION(success)].asBool();
+			m_code = root[REFLECTION(code)].asString();
+			m_message = root[REFLECTION(message)].asString();
+			m_returnCode = root[REFLECTION(return_code)].asString();
+			m_errorMsg = root[REFLECTION(error_msg)].asString();
+			m_data = root[REFLECTION(data)].asBool();
+		}
+		else {
+			m_success = false;
+		}
+
+		return m_success;
+	}
+};
+
+
+int post_camera_brightness_info_list(unsigned int& uposttime, CSimpleStringA& errormsg, brightness_info_t* pinfo, int itimeout, bool bprintdbg);
+
+#endif

+ 93 - 20
Module/mod_mediacontroller/capture.cpp

@@ -49,22 +49,26 @@ static void __dbg(const char *fmt, va_list arg)
 }
 
 
-static void __logevent(int itype, const char* strmessage)
+static void __logevent(int ilogtype, int idevid, const char* strmessage)
 {
-	if (0 == itype){
+	if (0 == ilogtype){
 		LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_CAMERA_MATCHED_FORMAT, strmessage);
 	}
-	else if(1 == itype){
+	else if(1 == ilogtype){
 		LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_CAMERA_OUTPUT_FORMAT, strmessage);
 	}
-	else if (2 == itype) {
+	else if (2 == ilogtype) {
 		LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_CAMOPEN_FAILED_INFO, strmessage);
 	}
+	else if (3 == ilogtype) {
+		LogEvent(Severity_Middle, LOG_EVT_MEDIACONTROLLER_NOMATCHED_RESOLUTION, CSimpleStringA::Format("%d", idevid).GetData());
+	}
 	else{
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unknown type event.");
 	}
 }
 
+
 static int Bin2Str(unsigned char *x, int xlen, char *str, int str_size)
 {
 	static const char *hex2char = "0123456789ABCDEF";
@@ -1393,17 +1397,19 @@ namespace MediaController {
 
 	DeviceTypeEnum g_eDeviceType;
 
-	int capture_create(const capture_config_t *config, capture_t **p_cap)
+	int capture_create(const capture_config_t *config, capture_t **p_cap, bool bstartaudio)
 	{
 		capture_t *cap = ZALLOC_T(capture_t);
 		cap->handfree_audio = NULL;
 		cap->env_video = NULL;
 		cap->opt_video = NULL;
 		memcpy(&cap->config, config, sizeof(capture_config_t));
-		cap->handfree_audio = audio_capture_create(cap);
-		if (!cap->handfree_audio) {
-			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("create handfree audio capture object failed!");
-			return Error_Unexpect;
+		if (bstartaudio) {
+			cap->handfree_audio = audio_capture_create(cap);
+			if (!cap->handfree_audio) {
+				DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("create handfree audio capture object failed!");
+				return Error_Unexpect;
+			}
 		}
 
 		int dev_id_env = capture_get_video_device_id(config->strVideoEnv);
@@ -1668,18 +1674,20 @@ namespace MediaController {
 		}
 	}
 
-	ErrorCodeEnum capture_start(capture_t *cap)
+	ErrorCodeEnum capture_start(capture_t *cap, bool bstartaudio)
 	{
 		int rc = 0;
 
-		if ('N' == cap->config.strAudioState[0] || 'P' == cap->config.strAudioState[0]) {
-			ErrorCodeEnum rslt = start_audio_capture(cap->handfree_audio);
-			if (Error_Succeed != rslt) {
-				return rslt;
+		if (bstartaudio) {
+			if ('N' == cap->config.strAudioState[0] || 'P' == cap->config.strAudioState[0]) {
+				ErrorCodeEnum rslt = start_audio_capture(cap->handfree_audio);
+				if (Error_Succeed != rslt) {
+					return rslt;
+				}
+			}
+			else {
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("handfree audio is error, not start it.");
 			}
-		}
-		else {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("handfree audio is error, not start it.");
 		}
 
 		return capture_start_envopt(cap);
@@ -1895,7 +1903,7 @@ namespace MediaController {
 			if (dev_name != NULL && strlen(dev_name) > 1 && 
 				strstr(dev_name, ";") == NULL) 
 			{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[dbg] device_path: %s",t2);
+				//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[dbg] device_path: %s",t2);
 				if (strstr(t2,dev_name) != NULL) 
 				{
 					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[dbg] %s founded in %d cameras.", dev_name, n);
@@ -1916,7 +1924,6 @@ namespace MediaController {
 #else
 		return rvc_videocap_get_video_device_id(dev_name);
 #endif // RVC_OS_WIN
-		
 	}
 
 	int capture_lib_init(int *ivideonum)
@@ -2166,7 +2173,7 @@ namespace MediaController {
 		HRESULT rst = S_OK;
 		if (cap && cap->env_video && (nCode != Error_EnvCamera) && (nCode != Error_AllCamera))
 		{
-			HRESULT rst = videocap_get_brightness(cap->env_video->cap, &nValue1);
+			rst = videocap_get_brightness(cap->env_video->cap, &nValue1);
 		}
 		HRESULT rst2 = S_OK;
 		if (cap && cap->opt_video && (nCode != Error_OptCamera) && (nCode != Error_AllCamera))
@@ -2232,6 +2239,72 @@ namespace MediaController {
 #endif // RVC_OS_WIN
 	}
 
+	int capture_get_camera_brightness(int* ibrightness, capture_t* cap, ErrorCodeEnum nCode, int icameraid)
+	{
+		int iret = -1;
+
+#ifdef RVC_OS_WIN
+		if (0 == icameraid) {
+			if (cap && cap->env_video && (nCode != Error_EnvCamera) && (nCode != Error_AllCamera)){
+				if (S_OK == videocap_get_brightness(cap->env_video->cap, ibrightness)) {
+					iret = 0;
+				}
+			}
+		}
+		else if (1 == icameraid) {
+			if (cap && cap->opt_video && (nCode != Error_OptCamera) && (nCode != Error_AllCamera)){
+				if (S_OK == videocap_get_brightness(cap->opt_video->cap, ibrightness)) {
+					iret = 0;
+				}
+			}
+		}
+#else
+		if (0 == icameraid) {
+			if (cap && cap->env_video && cap->env_video->pVideoCap && (nCode != Error_EnvCamera) && (nCode != Error_AllCamera)) {
+				iret = cap->env_video->pVideoCap->GetCamBrightness(ibrightness, false);
+			}
+		}
+		else if(1 == icameraid){
+			if (cap && cap->opt_video && cap->opt_video->pVideoCap && (nCode != Error_OptCamera) && (nCode != Error_AllCamera)) {
+				iret = cap->opt_video->pVideoCap->GetCamBrightness(ibrightness, false);
+			}
+		}
+#endif // RVC_OS_WIN
+		return iret;
+	}
+
+	int capture_set_camera_brightness(int ibrightness, capture_t* cap, ErrorCodeEnum nCode, int icameraid)
+	{
+		int iret = -1;
+#ifdef RVC_OS_WIN
+		if (0 == icameraid) {
+			if (cap && cap->env_video && (nCode != Error_EnvCamera) && (nCode != Error_AllCamera)){
+				if (S_OK == videocap_adj_brightness(cap->env_video->cap, ibrightness)) {
+					iret = 0;
+				}
+			}
+		}
+		else if (1 == icameraid) {
+			if (cap && cap->opt_video && (nCode != Error_OptCamera) && (nCode != Error_AllCamera)){
+				if (S_OK == videocap_adj_brightness(cap->opt_video->cap, ibrightness)) {
+					iret = 0;
+				}
+			}
+		}
+#else
+		if (0 == icameraid) {
+			if (cap && cap->env_video && cap->env_video->pVideoCap && (nCode != Error_EnvCamera) && (nCode != Error_AllCamera)) {
+				iret = cap->env_video->pVideoCap->SetCamBrightness(ibrightness, false);
+			}
+		}
+		else if (1 == icameraid) {
+			if (cap && cap->opt_video && cap->opt_video->pVideoCap && (nCode != Error_OptCamera) && (nCode != Error_AllCamera)) {
+				iret = cap->opt_video->pVideoCap->SetCamBrightness(ibrightness, false);
+			}
+		}
+#endif // RVC_OS_WIN
+		return iret;
+	}
 
 	int capture_get_env_rawbrightnessinfo(capture_t* cap, ErrorCodeEnum nCode, int* imin, int* imax)
 	{

+ 6 - 2
Module/mod_mediacontroller/capture.h

@@ -69,6 +69,8 @@ namespace MediaController {
 		int video_opt_rotate; // counter-clockwise degree
 		int video_env_fps;
 		int video_opt_fps;
+		int video_env_brightness;
+		int video_opt_brightness;
 		CSimpleStringA strAudioIn;
 		CSimpleStringA strAudioOut;
 		CSimpleStringA strAudioState;
@@ -171,10 +173,10 @@ namespace MediaController {
 		rvc_audio_capture_t *rvc_audio;
 	};
 
-	int capture_create(const capture_config_t *config, capture_t **p_cap);
+	int capture_create(const capture_config_t *config, capture_t **p_cap, bool bstartaudio = true);
 	ErrorCodeEnum capture_create(const capture_config_t *config,capture_t *cap,int nCamera);
 	void capture_destroy(capture_t *cap);
-	ErrorCodeEnum capture_start(capture_t *cap);
+	ErrorCodeEnum capture_start(capture_t *cap, bool bstartaudio = true);
 	ErrorCodeEnum start_audio_capture(audio_capture_t *paudio);
 	ErrorCodeEnum capture_start(capture_t *cap,int nCamera);
 	void capture_stop(capture_t *cap);
@@ -194,6 +196,8 @@ namespace MediaController {
 	bool capture_adj_brightness(capture_t *cap,int nvalue, ErrorCodeEnum nCode);
 	bool capture_set_autobrightness(capture_t *cap, ErrorCodeEnum nCode);
 	int capture_get_brightness(capture_t *cap, ErrorCodeEnum nCode);
+	int capture_get_camera_brightness(int* ibrightness, capture_t* cap, ErrorCodeEnum nCode, int icameraid);
+	int capture_set_camera_brightness(int ibrightness, capture_t* cap, ErrorCodeEnum nCode, int icameraid);
 	int stopcamera(capture_t *cap,int nCamera);
 	void capture_destroy(capture_t *cap,int nCamera);
 	//清空抓拍队列里的照片,摄像头故障时调用

+ 367 - 169
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -4,6 +4,7 @@
 #include "Event.h"
 #include "CommEntityUtil.hpp"
 #include "fileutil.h"
+#include "brightnessinfo.h"
 
 #ifdef RVC_OS_WIN
 #include "iaudiorenderinterface.h"
@@ -36,10 +37,22 @@
 #define RVC_CAMERA_OFF_TIMER 3
 #endif // !RVC_CAMERA_OFF_TIMER
 
+
 #ifndef RVC_CAMERA_CAP_PROCESS
 #define RVC_CAMERA_CAP_PROCESS 4
 #endif // !RVC_CAMERA_CAP_PROCESS
 
+
+#ifndef RVC_MIN_CAMERA_BRIGHNESS
+#define RVC_MIN_CAMERA_BRIGHNESS 30
+#endif // !RVC_MIN_CAMERA_BRIGHNESS
+
+
+#ifndef RVC_DEFAULT_CAMERA_BRIGHNESS
+#define RVC_DEFAULT_CAMERA_BRIGHNESS 50
+#endif // !RVC_DEFAULT_CAMERA_BRIGHNESS
+
+
 #ifdef RVC_OS_WIN
 static void __audio_render_log(void* user_data, const char* fmt, va_list arg)
 {
@@ -136,8 +149,16 @@ CMediaControllerEntity::CMediaControllerEntity(): m_capture(NULL), m_salesaudio_
 #ifdef RVC_OS_WIN
 #else
 	m_PhotoSaveDir = "";
+	m_bPostCapInfo = false;
 #endif
 #endif
+
+	m_strHttpServerAddr = RVC_UPDATE_CAMERABRIGHNESS_HTTP_URL;
+	m_strHttpServerAPI = RVC_UPDATE_CAMERABRIGHNESS_HTTP_API;
+	m_iHttpTimeOut = RVC_HTTPTIMEOUT;
+	m_strAppVersion = NULL;
+	m_strTerminalId = NULL;
+	m_bsynchronized = false;
 }
 
 void CMediaControllerEntity::OnSysVarEvent(const char *pszKey, const char *pszValue,const char *pszOldValue,const char *pszEntityName)
@@ -147,36 +168,12 @@ void CMediaControllerEntity::OnSysVarEvent(const char *pszKey, const char *pszVa
 		CSimpleStringA strState;
 		GetFunction()->GetSysVar("UIState", strState);
 		if ('C' == pszValue[0]) {
-			if (!m_bStartCamera) {
-				StartCameraAndSetSysVar();
-				if (m_bStartCamera) {
-					OnCameraStarted();
-				}
-			}
-			else {
-				if (strState.GetLength() > 0 && strState[0] == 'M') {
-					if (m_bCameraOffTimerOn) {
-						if (Error_Succeed != GetFunction()->KillTimer(RVC_CAMERA_OFF_TIMER)) {
-							LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_KILLTIMER_ERROR, "Call State is Connecting, and UIState is M, kill camera off timer failed.");
-						}
-						else {
-							m_bCameraOffTimerOn = false;
-						}
-					}
-				}
-			}	
+			StartAllCameras(true);
 		}
 		else if ('O' == pszValue[0]){
 			if (strState.GetLength() > 0 && strState[0] == 'M') {
 				if (m_bStartCamera) {
-					if (false == m_bCameraOffTimerOn) {
-						if (Error_Succeed != GetFunction()->SetTimer(RVC_CAMERA_OFF_TIMER, this, m_iDelayTime * 1000)) {
-							LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_SETTIMER_ERROR, "Call State is OffLine, and UIState is M, set camera off timer failed.");
-						}
-						else {
-							m_bCameraOffTimerOn = true;
-						}
-					}
+					DelayCloseCameras();
 				}
 			}
 		}
@@ -216,7 +213,7 @@ void CMediaControllerEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmar
 
 	int i = 0;
 
-	m_arrListener.Init(15);
+	m_arrListener.Init(16);
 	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, MOD_EVENT_SNAPSHOT_START_CAPTURE_ENV);
 	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, MOD_EVENT_SNAPSHOT_START_CAPTURE_OPT);
 	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, MOD_EVENT_SNAPSHOT_START_CAPTURE_ENVOPT);
@@ -232,7 +229,8 @@ void CMediaControllerEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmar
 	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, EVENT_MOD_CONNECT_BEGAIN_RECORD_CALL, NULL, false);
 	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_UI_STARTCAMERACAPTURE, NULL, false);
 	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_UI_STOPCAMERACAPTURE, NULL, false);
-
+	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_NOMATCHED_RESOLUTION, NULL, false);
+	
 	pTransactionContext->SendAnswer(Error_Succeed);
 }
 
@@ -329,10 +327,7 @@ void CMediaControllerEntity::OnStarted()
 		GetFunction()->GetSysVar("UIState", uiState);
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Get UIState value is %s.", uiState.GetData());
 		if (uiState.GetLength() > 0 && uiState[0] == 'F') {
-			StartCameraAndSetSysVar();
-			if (m_bStartCamera) {
-				OnCameraStarted();
-			}
+			StartAllCameras(true);
 		}
 	}
 
@@ -354,6 +349,13 @@ void CMediaControllerEntity::OnStarted()
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("photo save dir is %s.", m_PhotoSaveDir.GetData());
 #endif
 #endif
+
+	CSystemStaticInfo si;
+	Error = GetFunction()->GetSystemStaticInfo(si);
+	if (Error == Error_Succeed) {
+		m_strAppVersion = si.InstallVersion.ToString();
+		m_strTerminalId = si.strTerminalID;
+	}
 }
 
 
@@ -791,7 +793,7 @@ void CMediaControllerEntity::OnTimeCameraStatusCheck()
 	}
 
 	//重新打开摄像头
-	if((m_nCameraErrorCode == Error_EnvCamera)&&(iEnvCameraRestartNum<CAMERA_RESTARTNUM))
+	if((m_nCameraErrorCode == Error_EnvCamera)&&(iEnvCameraRestartNum<CAMERA_RESTARTNUM)&&(NULL != m_capture->env_video))
 	{
 		if (ReStartCamera(ENVCAMERA) != Error_Succeed){
 			iEnvCameraRestartNum++;
@@ -806,7 +808,7 @@ void CMediaControllerEntity::OnTimeCameraStatusCheck()
 			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_RESTART_CAME_SUCCESS, "restart env camera success.");
 		}
 	}
-	else if((m_nCameraErrorCode == Error_OptCamera)&&(iOptCameraRestartNum<CAMERA_RESTARTNUM)&&(eStand2sType == m_eDeviceType))
+	else if((m_nCameraErrorCode == Error_OptCamera)&&(iOptCameraRestartNum<CAMERA_RESTARTNUM)&&(eStand2sType == m_eDeviceType)&&(NULL != m_capture->opt_video))
 	{
 		if (ReStartCamera(OPTCAMERA) != Error_Succeed) {
 			iOptCameraRestartNum++;
@@ -823,7 +825,7 @@ void CMediaControllerEntity::OnTimeCameraStatusCheck()
 	}
 	else if (m_nCameraErrorCode == Error_AllCamera)
 	{
-		if (iEnvCameraRestartNum<CAMERA_RESTARTNUM)
+		if ((iEnvCameraRestartNum<CAMERA_RESTARTNUM) && (NULL != m_capture->env_video))
 		{
 			if (ReStartCamera(ENVCAMERA) != Error_Succeed) {
 				iEnvCameraRestartNum++;
@@ -839,7 +841,7 @@ void CMediaControllerEntity::OnTimeCameraStatusCheck()
 			}
 		}
 
-		if((iOptCameraRestartNum<CAMERA_RESTARTNUM)&&(eStand2sType == m_eDeviceType))
+		if((iOptCameraRestartNum<CAMERA_RESTARTNUM)&&(eStand2sType == m_eDeviceType)&&(NULL != m_capture->opt_video))
 		{
 			if (ReStartCamera(OPTCAMERA) != Error_Succeed) {
 				iOptCameraRestartNum++;
@@ -865,12 +867,27 @@ void CMediaControllerEntity::OnTimeCameraStatusCheck()
 }
 
 
-
 bool CMediaControllerEntity::SetAutoBright(ErrorCodeEnum nCode)
 {
 	return capture_set_autobrightness(m_capture,nCode);
 }
 
+bool CMediaControllerEntity::SetConfigBright(ErrorCodeEnum nCode)
+{
+	if (eStand2sType == m_eDeviceType) {
+		if (m_capture) {
+			capture_set_camera_brightness(m_capture->config.video_env_brightness, m_capture, nCode, 0);
+			capture_set_camera_brightness(m_capture->config.video_opt_brightness, m_capture, nCode, 1);
+		}
+	}
+	else {
+		if (m_capture) {
+			capture_set_camera_brightness(m_capture->config.video_env_brightness, m_capture, nCode, 0);
+		}
+	}
+	return true;
+}
+
 //camera gain adjust
 void CMediaControllerEntity::OnReceivePkt(int sub_type, const char *buffer, int size)
 {
@@ -885,20 +902,38 @@ void CMediaControllerEntity::OnReceivePkt(int sub_type, const char *buffer, int
 				SpBuffer buf;
 				buf.OpenRead(buffer, size);
 				num.Serialize(buf);
-				if (capture_adj_brightness(m_capture, num.nValue, m_nCameraErrorCode) == true)
-				{
-					SendCameraBright();
-					LogWarn(Severity_Low, Error_Debug, LOG_EVT_SET_CAMERA_BRIGHTNESS_INFO, CSimpleStringA::Format("set camera brightness to %d success.", num.nValue).GetData());
-				} 
-				else
-				{
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ACM_SET_CAMERABRIGHT fail!");
-					LogWarn(Severity_Low, Error_Debug, LOG_EVT_SET_CAMERA_BRIGHTNESS_FAILED, CSimpleStringA::Format("set camera brightness to %d failed.", num.nValue).GetData());
-				}	
+				int ibrightness = num.nValue;
+				if (ibrightness < RVC_MIN_CAMERA_BRIGHNESS) {
+					ibrightness = RVC_MIN_CAMERA_BRIGHNESS;
+				}
+
+				if (eStand2sType == m_eDeviceType) {
+					if (capture_adj_brightness(m_capture, ibrightness, m_nCameraErrorCode) == true){
+						SendCameraBright(eStand2sType);
+						LogWarn(Severity_Low, Error_Debug, LOG_EVT_SET_CAMERA_BRIGHTNESS_INFO, CSimpleStringA::Format("set camera brightness to %d success.", ibrightness).GetData());
+						PostCameraBrightnessInfos(ibrightness);
+					}
+					else{
+						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ACM_SET_CAMERABRIGHT fail!");
+						LogWarn(Severity_Low, Error_Debug, LOG_EVT_SET_CAMERA_BRIGHTNESS_FAILED, CSimpleStringA::Format("set camera brightness to %d failed.", ibrightness).GetData());
+					}
+				}
+				else {
+					if (0 == capture_set_camera_brightness(ibrightness, m_capture, m_nCameraErrorCode, 0)) {
+						SendCameraBright(eStand1SPlusType);
+						LogWarn(Severity_Low, Error_Debug, LOG_EVT_SET_CAMERA_BRIGHTNESS_INFO, CSimpleStringA::Format("set camera brightness to %d success.", ibrightness).GetData());
+						PostCameraBrightnessInfos(ibrightness);
+					}
+					else {
+						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ACM_SET_CAMERABRIGHT fail!");
+						LogWarn(Severity_Low, Error_Debug, LOG_EVT_SET_CAMERA_BRIGHTNESS_FAILED, CSimpleStringA::Format("set camera brightness to %d failed.", ibrightness).GetData());
+					}
+				}
+
 			}
 			else
 			{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pad type cannot adj brightness");
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("device type cannot adj brightness");
 			}		
 		}
 		else
@@ -965,7 +1000,7 @@ ErrorCodeEnum CMediaControllerEntity::SetEnvCamRawBrightness(int iBrightness)
 }
 
 
-void CMediaControllerEntity::SendCameraBright()
+void CMediaControllerEntity::SendCameraBright(DeviceTypeEnum eType)
 {
 	ChannelService_Send_Info Info;
 	Info.compress = false;
@@ -977,7 +1012,13 @@ void CMediaControllerEntity::SendCameraBright()
 	SpBuffer buf;
 	buf.OpenWrite();
 	int nValue = 0;
-	nValue = capture_get_brightness(m_capture,m_nCameraErrorCode); 
+	if (eStand2sType == eType) {
+		nValue = capture_get_brightness(m_capture, m_nCameraErrorCode);
+	}
+	else if(eStand1SPlusType == eType){
+		capture_get_camera_brightness(&nValue, m_capture, m_nCameraErrorCode, 0);
+	}
+
 	if (nValue >= 0)
 	{
 		buf & nValue;
@@ -1017,25 +1058,48 @@ ErrorCodeEnum CMediaControllerEntity::GetEnvCameraVideoCaptureInfo(CSimpleString
 }
 
 
-ErrorCodeEnum CMediaControllerEntity::StartAllCameras()
+ErrorCodeEnum CMediaControllerEntity::StartAllCameras(bool bstartaudio)
 {
 	ErrorCodeEnum Error = Error_Succeed;
-	if (false == m_bStartCamera){
-		Error = StartCamera();
-		SetCameraStateInfo(Error);
+	if (!m_bStartCamera) {
+		CheckAutoVideoConfig(&conf);
+		Error = StartCamera(bstartaudio);
+		SetCameraState(Error);
 
-		if (m_bStartCamera) {
+		if (Error_Succeed == Error || Error_EnvCamera == Error || Error_OptCamera == Error) {
+			m_bStartCamera = true;
 			OnCameraStarted();
 		}
 	}
-	else{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("camera already start.");
+	else {
+		if (m_bCameraOffTimerOn) {
+			if (Error_Succeed != GetFunction()->KillTimer(RVC_CAMERA_OFF_TIMER)) {
+				LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_KILLTIMER_ERROR, "start camera for it's already on, kill camera off timer failed.");
+			}
+			else {
+				m_bCameraOffTimerOn = false;
+			}
+		}
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("camera is already on.");
 	}
 
 	return Error;
 }
 
 
+void CMediaControllerEntity::DelayCloseCameras() 
+{
+	if (false == m_bCameraOffTimerOn) {
+		if (Error_Succeed != GetFunction()->SetTimer(RVC_CAMERA_OFF_TIMER, this, m_iDelayTime * 1000)) {
+			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_SETTIMER_ERROR, "delay close camera, set camera off timer failed.");
+		}
+		else {
+			m_bCameraOffTimerOn = true;
+		}
+	}
+}
+
+
 ErrorCodeEnum CMediaControllerEntity::StopAllCameras()
 {
 	if (m_capture){
@@ -1070,7 +1134,7 @@ ErrorCodeEnum CMediaControllerEntity::StopCamerasAndRecord()
 
 ErrorCodeEnum CMediaControllerEntity::StartCamerasAndRecord()
 {
-	ErrorCodeEnum CamRet = StartAllCameras();
+	ErrorCodeEnum CamRet = StartAllCameras(true);
 	LogTransactionRecordCtrEvt(1);
 
 	return CamRet;
@@ -1245,6 +1309,8 @@ ErrorCodeEnum CMediaControllerEntity::LoadConfig(capture_config_t *conf)
 		int imtu = 1500;
 		int ienvfps = REC_COMMON_VIDEO_RAW_FPS;
 		int ioptfps = REC_COMMON_VIDEO_RAW_FPS;
+		int ienvbrightness = RVC_DEFAULT_CAMERA_BRIGHNESS;
+		int ioptbrightness = RVC_DEFAULT_CAMERA_BRIGHNESS;
 		table.AddEntryString("Audio", "handfree_in_dev", conf->strAudioIn, "$");
 		table.AddEntryString("Audio", "handfree_out_dev", conf->strAudioOut, "$");
 		table.AddEntryString("Video", "EnvCamera", conf->strVideoEnv, "$");
@@ -1254,6 +1320,8 @@ ErrorCodeEnum CMediaControllerEntity::LoadConfig(capture_config_t *conf)
 		table.AddEntryInt("Video", "EnvFps", ienvfps, REC_COMMON_VIDEO_RAW_FPS);
 		table.AddEntryInt("Video", "OptFps", ioptfps, REC_COMMON_VIDEO_RAW_FPS);
 		table.AddEntryInt("Video", "mtu", imtu, 1500);
+		table.AddEntryInt("Video", "EnvBrightness", ienvbrightness, RVC_DEFAULT_CAMERA_BRIGHNESS);
+		table.AddEntryInt("Video", "OptBrightness", ioptbrightness, RVC_DEFAULT_CAMERA_BRIGHNESS);
 		Error = table.Load(spConfig);
 		if (Error == Error_Succeed)
 		{
@@ -1275,11 +1343,21 @@ ErrorCodeEnum CMediaControllerEntity::LoadConfig(capture_config_t *conf)
 				conf->video_opt_fps = ioptfps;
 			}
 
+			conf->video_env_brightness = RVC_DEFAULT_CAMERA_BRIGHNESS;
+			if (ienvbrightness <= 100 && ienvbrightness >= RVC_MIN_CAMERA_BRIGHNESS) {
+				conf->video_env_brightness = ienvbrightness;
+			}
+
+			conf->video_opt_brightness = RVC_DEFAULT_CAMERA_BRIGHNESS;
+			if (ioptbrightness <= 100 && ioptbrightness >= RVC_MIN_CAMERA_BRIGHNESS) {
+				conf->video_opt_brightness = ioptbrightness;
+			}
 
 			LogWarn(Severity_Low, Error_Debug, ERROR_MOD_MEDIACONTROLLER_ENV_CAMERA_INFO, conf->strVideoEnv.GetData());
 			LogWarn(Severity_Low, Error_Debug, ERROR_MOD_MEDIACONTROLLER_OPT_CAMERA_INFO, conf->strVideoOpt.GetData());
 			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_CAMERA_INFOS, generateCameraInfosJson(conf->strVideoEnv, conf->strVideoOpt, conf->video_env_rotate, conf->video_opt_rotate, imtu).GetData());
-
+			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_CAMERA_BRIGHTNESS, CSimpleStringA::Format("env camera brightness is %d, opt camera brightness is %d.", conf->video_env_brightness, conf->video_opt_brightness).GetData());
+			
 #ifdef RVC_OS_WIN
 
 #else
@@ -1495,36 +1573,14 @@ void CMediaControllerEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID
 
 	case LOG_EVT_BEGIN_HANDLE_BUSINESS:
 		if (!m_bJsOccupyCamera) {
-			if (!m_bStartCamera) {
-				StartCameraAndSetSysVar();
-				if (m_bStartCamera) {
-					OnCameraStarted();
-				}
-			}
-			else {
-				if (m_bCameraOffTimerOn) {
-					if (Error_Succeed != GetFunction()->KillTimer(RVC_CAMERA_OFF_TIMER)) {
-						LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_KILLTIMER_ERROR, "begin handle business, and camera is already on, kill camera off timer failed.");
-					}
-					else {
-						m_bCameraOffTimerOn = false;
-					}
-				}
-			}
+			StartAllCameras(true);
 		}
 		m_bOnBusiness = true;
 		break;
 
 	case LOG_EVT_END_HANDLE_BUSINESS:
 		if (m_bStartCamera) {
-			if (false == m_bCameraOffTimerOn) {
-				if (Error_Succeed != GetFunction()->SetTimer(RVC_CAMERA_OFF_TIMER, this, m_iDelayTime * 1000)) {
-					LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_SETTIMER_ERROR, "end handle business, set camera off timer failed.");
-				}
-				else {
-					m_bCameraOffTimerOn = true;
-				}
-			}
+			DelayCloseCameras();
 		}
 		else {
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("end handle business, and camera is not on.");
@@ -1631,6 +1687,24 @@ void CMediaControllerEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID
 	}
 	break;
 
+	case LOG_EVT_MEDIACONTROLLER_NOMATCHED_RESOLUTION:
+	{
+		if (pszMessage) {
+			char cdevid = pszMessage[0];
+			int idevid = cdevid - '0';
+			if (idevid == capture_get_video_device_id(conf.strVideoEnv)) {
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V3").setResultCode("RTA2810")("上摄像分辨率不符合要求");
+			}
+			else if(idevid == capture_get_video_device_id(conf.strVideoOpt)){
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V3").setResultCode("RTA2810")("下摄像分辨率不符合要求");
+			}
+			else {
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("no mathed device id.");
+			}
+		}
+	}
+	break;
+
 	default:
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unknown event.");
 		break;
@@ -1731,7 +1805,7 @@ ErrorCodeEnum CMediaControllerEntity::StopSalesRecordAudioCapture()
 	return Error_Succeed;
 }
 
-ErrorCodeEnum CMediaControllerEntity::StartCamera()
+ErrorCodeEnum CMediaControllerEntity::StartCamera(bool bstartaudio)
 {
 	if (m_capture == NULL)
 	{
@@ -1746,12 +1820,14 @@ ErrorCodeEnum CMediaControllerEntity::StartCamera()
 		conf.envopt_mutex = &m_envopt_mutex;
 #endif
 		conf.uintervaltime = m_interValTime;
-		Error = (ErrorCodeEnum)capture_create(&conf, &m_capture);
+		Error = (ErrorCodeEnum)capture_create(&conf, &m_capture, bstartaudio);
 		if (Error == Error_Succeed) 
 		{
 #ifdef RVC_OS_WIN
 #else
-			m_capture->handfree_audio->paudiocap = m_pAudioCap;
+			if (bstartaudio) {
+				m_capture->handfree_audio->paudiocap = m_pAudioCap;
+			}
 #endif
 			CSmartPointer<IEntityFunction> Func = GetFunction();
 			CSimpleStringA strValue("");
@@ -1759,7 +1835,7 @@ ErrorCodeEnum CMediaControllerEntity::StartCamera()
 			m_capture->config.strAudioState = strValue;
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Sound Card State is %s.", strValue.GetData());
 
-			Error = capture_start(m_capture);
+			Error = capture_start(m_capture, bstartaudio);
 			if (Error != Error_Succeed)
 			{
 				if((Error == Error_AudioIN)||(Error == Error_AudioOut))
@@ -1775,7 +1851,11 @@ ErrorCodeEnum CMediaControllerEntity::StartCamera()
 				}
 				else
 				{
-					SetAutoBright(Error);
+					//SetAutoBright(Error);
+					if (!m_bsynchronized) {
+						SetConfigBright(Error);
+						m_bsynchronized = true;
+					}
 					GetFunction()->SetTimer(1, this, 5000);
 					if((Error == Error_OptCamera)&&(eStand1SPlusType == m_eDeviceType))
 					{
@@ -1789,7 +1869,11 @@ ErrorCodeEnum CMediaControllerEntity::StartCamera()
 			}
 			else
 			{
-				SetAutoBright(Error);
+				//SetAutoBright(Error);
+				if (!m_bsynchronized) {
+					SetConfigBright(Error);
+					m_bsynchronized = true;
+				}
 				GetFunction()->SetTimer(1, this, 5000);
 				return Error_Succeed;
 			}
@@ -1810,11 +1894,10 @@ ErrorCodeEnum CMediaControllerEntity::StartCamera()
 }
 
 
-void CMediaControllerEntity::SetCameraStateInfo(ErrorCodeEnum errorcode)
+void CMediaControllerEntity::SetCameraState(ErrorCodeEnum errorcode)
 {
 	if (Error_Succeed == errorcode) {
 		SetCameraSysVar(CAMERA_NO_ERROR);
-		m_bStartCamera = true;
 		m_nCameraErrorCode = Error_Succeed;
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR0402208V3")("摄像头打开成功");
 	}
@@ -1822,14 +1905,12 @@ void CMediaControllerEntity::SetCameraStateInfo(ErrorCodeEnum errorcode)
 		if (Error_EnvCamera == errorcode) {
 			SetCameraSysVar(CAMERA_ENV_ERROR);
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Camera State to CAMERA_ENV_ERROR");
-			m_bStartCamera = true;
 			m_nCameraErrorCode = Error_EnvCamera;
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V3").setResultCode("RTA2803")("上摄像头故障,打开失败");
 		}
 		else if (Error_OptCamera == errorcode) {
 			SetCameraSysVar(CAMERA_OPT_ERROR);
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Camera State to CAMERA_OPT_ERROR");
-			m_bStartCamera = true;
 			m_nCameraErrorCode = Error_OptCamera;
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V3").setResultCode("RTA2804")("下摄像头故障,打开失败");
 		}
@@ -1837,7 +1918,6 @@ void CMediaControllerEntity::SetCameraStateInfo(ErrorCodeEnum errorcode)
 			SetCameraSysVar(CAMERA_BOTH_ERROR);
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Camera State to CAMERA_BOTH_ERROR");
 			m_nCameraErrorCode = Error_AllCamera;
-			m_bStartCamera = false;
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V3").setResultCode("RTA2808")("上下摄像头都故障");
 		}
 		else {
@@ -1849,13 +1929,6 @@ void CMediaControllerEntity::SetCameraStateInfo(ErrorCodeEnum errorcode)
 	}
 }
 
-void CMediaControllerEntity::StartCameraAndSetSysVar()
-{
-	CheckAutoVideoConfig(&conf);
-	ErrorCodeEnum Error = StartCamera();
-	SetCameraStateInfo(Error);
-}
-
 ErrorCodeEnum CMediaControllerEntity::ReStartCamera(int nCamera)
 {
 	if (m_capture != NULL)
@@ -1873,11 +1946,11 @@ ErrorCodeEnum CMediaControllerEntity::ReStartCamera(int nCamera)
 		Error = capture_create(&conf, m_capture, nCamera);
 		if (Error == Error_Succeed) 
 		{
-			Error = capture_start(m_capture,nCamera);
+			Error = capture_start(m_capture, nCamera);
 			if (Error != Error_Succeed)
 			{
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ReStartCamera %d,capture_start fail!", nCamera);
-				capture_destroy(m_capture,nCamera);
+				capture_destroy(m_capture, nCamera);
 				return Error;
 			}
 			else
@@ -2127,6 +2200,14 @@ void CMediaControllerEntity::CheckAutoVideoConfig(capture_config_t* conf)
 void CMediaControllerEntity::OnCameraStarted()
 {
 	LogEvent(Severity_Middle, LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED, "camera started.");
+
+	int ienvbrightness = 0;
+	capture_get_camera_brightness(&ienvbrightness, m_capture, m_nCameraErrorCode, 0);
+
+	int ioptbrightness = 0;
+	capture_get_camera_brightness(&ioptbrightness, m_capture, m_nCameraErrorCode, 1);
+
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("current env camera brightness is %d, opt camera brightness is %d.", ienvbrightness, ioptbrightness).GetData());
 }
 
 
@@ -2185,102 +2266,163 @@ void CMediaControllerEntity::HandleStopCameraCapture()
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Stop Save EnvCam Photo failed.");
 	}
 }
-#endif
-#endif
 
-ChannelMediaControllerClient::ChannelMediaControllerClient( CMediaControllerEntity *pEntity ) : ChannelService_ClientBase(pEntity)
+void CMediaControllerEntity::SetPostCapInfoFlag(bool bpostcapinfo)
 {
+	m_bPostCapInfo = bpostcapinfo;
+}
 
+bool CMediaControllerEntity::GetPostCapInfoFlag()
+{
+	return m_bPostCapInfo;
 }
 
+#endif
+#endif
 
-void ChannelMediaControllerClient::OnMessage(ErrorCodeEnum Error, ChannelService_State_Info &Msg, CSmartPointer<IReleasable> pData)
+void CMediaControllerEntity::GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx)
 {
-	if (Error == Error_Succeed) 
-	{
-		CMediaControllerEntity *pEntity = static_cast<CMediaControllerEntity*>(m_pEntityBase);
-		if (Msg.state == eChannelState_Idle) 
-		{
-			if (pEntity->m_bStartCamera)
-			{
-				if (pEntity->SetAutoBright(pEntity->m_nCameraErrorCode)==false)
-				{
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SetAutoBright Fail!");
-				}
-			}
-		} 
-		else if (Msg.state == eChannelState_Connected) 
-		{
-			if (pEntity->m_bStartCamera)
-			{
-				pEntity->SendCameraBright();
-			}
+	int ibrightness = 0;
+	if (0 == capture_get_camera_brightness(&ibrightness, m_capture, m_nCameraErrorCode, ctx->Req.icameraid)) {
+		ctx->Ans.result = 0;
+		ctx->Ans.ibrightness = ibrightness;
+		ctx->Answer(Error_Succeed);
+	}
+	else {
+		ctx->Ans.result = -1;
+		if (0 == ctx->Req.icameraid) {
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280D").setAPI(__FUNCTION__)("上摄像头故障,请联系厂商排查");
+			ctx->Answer(Error_EnvCamera, LOG_WARN_ENVCAMERA_ERROR);
+		}
+		else if (1 == ctx->Req.icameraid) {
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280E").setAPI(__FUNCTION__)("下摄像头故障,请联系厂商排查");
+			ctx->Answer(Error_OptCamera, LOG_WARN_OPTCAMERA_ERROR);
 		}
 	}
 }
 
-
-void ChannelMediaControllerClient::OnMessage( ErrorCodeEnum Error, ChannelService_Packet_Info &Msg, CSmartPointer<IReleasable> pData )
+void CMediaControllerEntity::SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx)
 {
-	if (Error == Error_Succeed) 
-	{
-		CMediaControllerEntity *pEntity = static_cast<CMediaControllerEntity*>(m_pEntityBase);
-		pEntity->OnReceivePkt(Msg.sub_type, (const char*)Msg.data.m_pData, Msg.data.m_iLength);
+	int ibrightness = ctx->Req.ibrightness;
+	if (0 == capture_set_camera_brightness(ibrightness, m_capture, m_nCameraErrorCode, ctx->Req.icameraid)) {
+		if (0 == ctx->Req.icameraid) {
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("set env camera brightness to %d.", ibrightness);
+		}
+		else if (1 == ctx->Req.icameraid) {
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("set opt camera brightness to %d.", ibrightness);
+		}
+		ctx->Ans.result = 0;
+		ctx->Answer(Error_Succeed);
+	}
+	else {
+		ctx->Ans.result = -1;
+		if (0 == ctx->Req.icameraid) {
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280D").setAPI(__FUNCTION__)("上摄像头故障,请联系厂商排查");
+			ctx->Answer(Error_EnvCamera, LOG_WARN_ENVCAMERA_ERROR);
+		}
+		else if (1 == ctx->Req.icameraid) {
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280E").setAPI(__FUNCTION__)("下摄像头故障,请联系厂商排查");
+			ctx->Answer(Error_OptCamera, LOG_WARN_OPTCAMERA_ERROR);
+		}
 	}
 }
 
 
-void MediaServiceSession::Handle_GetVideoDeviceName(SpReqAnsContext<MediaService_GetVideoDeviceName_Req, MediaService_GetVideoDeviceName_Ans>::Pointer ctx)
+ErrorCodeEnum CMediaControllerEntity::PostCameraBrightnessInfos(int iBrightness)
 {
-	DbgToBeidou(ctx->link, __FUNCTION__)();
-
-	ctx->Answer(Error_Succeed);
-}
+	ErrorCodeEnum Error = Error_Failed;
 
+	brightness_info_t camera_brightness_params;
+	camera_brightness_params.strServerURL = m_strHttpServerAddr;
+	camera_brightness_params.strAPI = m_strHttpServerAPI;
+	camera_brightness_params.strAppVersion = m_strAppVersion;
+	camera_brightness_params.strTerminalNo = m_strTerminalId;
+
+	brightness_item_t* item_env = new brightness_item_t();
+	item_env->module = "Video";
+	item_env->name = "EnvBrightness";
+	item_env->value = CSimpleStringA::Format("%d", iBrightness).GetData();
+
+	brightness_item_t* item_opt = new brightness_item_t();
+	item_opt->module = "Video";
+	item_opt->name = "OptBrightness";
+	item_opt->value = CSimpleStringA::Format("%d", iBrightness).GetData();
+
+	camera_brightness_params.vBrightnessList.push_back(item_env);
+	camera_brightness_params.vBrightnessList.push_back(item_opt);
+
+	unsigned int uposttime = 0;
+	CSimpleStringA strErrorMsg("");
+	if (0 == post_camera_brightness_info_list(uposttime, strErrorMsg, &camera_brightness_params, m_iHttpTimeOut, false)) {
+		LogWarn(Severity_Low, Error_Debug, LOG_EVT_POST_CAMERA_BRIGHTNESSINFO_COST_TIME, CSimpleStringA::Format("post camera brightness infos cost time is %ums.", uposttime).GetData());
+		Error = Error_Succeed;
+	}
+	else {
+		LogWarn(Severity_Middle, Error_Exception, LOG_EVT_POST_CAMERA_BRIGHTNESSINFO_FAILED, strErrorMsg.GetData());
+	}
 
-void MediaServiceSession::Handle_StartCamera(SpOnewayCallContext<MediaService_StartCamera_Info>::Pointer ctx)
-{
+	for (vector<brightness_item_t*>::iterator it = camera_brightness_params.vBrightnessList.begin(); it < camera_brightness_params.vBrightnessList.end(); ++it) {
+		if (NULL != *it) {
+			delete* it;
+			*it = NULL;
+		}
+	}
+	camera_brightness_params.vBrightnessList.clear();
 
+	return Error;
 }
 
-
-void MediaServiceSession::Handle_StopCamera(SpOnewayCallContext<MediaService_StopCamera_Info>::Pointer ctx)
+bool CMediaControllerEntity::IsOnlineState()
 {
-
+	bool bret = true;
+	CSimpleStringA strCallState("");
+	if (Error_Succeed == GetFunction()->GetSysVar(SYSVAR_CALLSTATE, strCallState)) {
+		if (strCallState.Compare("O") == 0) {
+			bret = false;
+		}
+	}
+	return bret;
 }
 
-
-void MediaServiceSession::Handle_StartEnvCamera(SpReqAnsContext<MediaService_StartEnvCamera_Req, MediaService_StartEnvCamera_Ans>::Pointer ctx)
+ChannelMediaControllerClient::ChannelMediaControllerClient( CMediaControllerEntity *pEntity ) : ChannelService_ClientBase(pEntity)
 {
-	DbgToBeidou(ctx->link, __FUNCTION__)();
-	ctx->Answer(Error_Succeed);
-}
-
 
-void MediaServiceSession::Handle_StopEnvCamera(SpOnewayCallContext<MediaService_StopEnvCamera_Info>::Pointer ctx)
-{
-	DbgToBeidou(ctx->link, __FUNCTION__)();
 }
 
 
-void MediaServiceSession::Handle_StartSpeakerRender(SpOnewayCallContext<MediaService_StartSpeakerRender_Info>::Pointer ctx)
+void ChannelMediaControllerClient::OnMessage(ErrorCodeEnum Error, ChannelService_State_Info &Msg, CSmartPointer<IReleasable> pData)
 {
-	DbgToBeidou(ctx->link, __FUNCTION__)();
+	if (Error == Error_Succeed) 
+	{
+		CMediaControllerEntity *pEntity = static_cast<CMediaControllerEntity*>(m_pEntityBase);
+		if (Msg.state == eChannelState_Idle) 
+		{
+			//if (pEntity->m_bStartCamera)
+			//{
+			//	if (pEntity->SetAutoBright(pEntity->m_nCameraErrorCode)==false)
+			//	{
+			//		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SetAutoBright Fail!");
+			//	}
+			//}
+		} 
+		else if (Msg.state == eChannelState_Connected) 
+		{
+			if (pEntity->m_bStartCamera)
+			{
+				pEntity->SendCameraBright(pEntity->RvcDeviceType());
+			}
+		}
+	}
 }
 
 
-void MediaServiceSession::Handle_StopSpeakerRender(SpOnewayCallContext<MediaService_StopSpeakerRender_Info>::Pointer ctx)
-{
-	DbgToBeidou(ctx->link, __FUNCTION__)();
-}
-
-void MediaServiceSession::Handle_ManipulateMediaDevice(SpReqAnsContext<MediaService_ManipulateMediaDevice_Req, MediaService_ManipulateMediaDevice_Ans>::Pointer ctx)
+void ChannelMediaControllerClient::OnMessage( ErrorCodeEnum Error, ChannelService_Packet_Info &Msg, CSmartPointer<IReleasable> pData )
 {
-	DbgToBeidou(ctx->link, __FUNCTION__)();
-	ErrorCodeEnum Error = Error_NotImpl;
-
-	ctx->Ans.retCode = (int)Error;
-	ctx->Answer(Error_Succeed);
+	if (Error == Error_Succeed) 
+	{
+		CMediaControllerEntity *pEntity = static_cast<CMediaControllerEntity*>(m_pEntityBase);
+		pEntity->OnReceivePkt(Msg.sub_type, (const char*)Msg.data.m_pData, Msg.data.m_iLength);
+	}
 }
 	
 void MediaServiceSession::Handle_GetAudioDevices(SpReqAnsContext<MediaService_GetAudioDevices_Req, MediaService_GetAudioDevices_Ans>::Pointer ctx)
@@ -2386,6 +2528,7 @@ void MediaServiceSession::Handle_ManipulateCameras(SpReqAnsContext<MediaService_
 			Error = m_pEntity->StartCamerasAndRecord();
 		}
 		else {
+			m_pEntity->LogTransactionRecordCtrEvt(1);
 			Error = Error_Succeed;
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("current is not on business, not start camera.");
 		}
@@ -2405,6 +2548,18 @@ void MediaServiceSession::Handle_IsCameraOnStatus(SpReqAnsContext<MediaService_I
 	ctx->Answer(Error_Succeed);
 }
 
+void MediaServiceSession::Handle_GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx)
+{
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	m_pEntity->GetCameraBrightness(ctx);
+}
+
+void MediaServiceSession::Handle_SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx)
+{
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	m_pEntity->SetCameraBrightness(ctx);
+}
+
 void MediaServiceSession::Handle_GetEnvCameraVideoCaptureInfo(SpReqAnsContext<MediaService_GetEnvCameraVideoCaptureInfo_Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans>::Pointer ctx)
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
@@ -2464,17 +2619,50 @@ void MediaServiceSession::Handle_SetEnvCamRawBrightness(SpReqAnsContext<MediaSer
 void MediaServiceSession::Handle_TurnOnCamera(SpReqAnsContext<MediaService_TurnOnCamera_Req, MediaService_TurnOnCamera_Ans>::Pointer ctx)
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
+	
+	if (m_pEntity->m_bJsOccupyCamera || m_pEntity->IsOnlineState()) {
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280C").setAPI(__FUNCTION__)("摄像头正在使用中,请断开连线后再试");
+		ctx->Answer(Error_DevNotAvailable, LOG_WARN_CAMERAOCCUPYING);
+		return;
+	}
+
+	ErrorCodeEnum Error = m_pEntity->StartAllCameras(false);
+	if (Error_Unexpect == Error) {
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280F").setAPI(__FUNCTION__)("摄像头实体异常,请联系总行开发人员排查");
+		ctx->Answer(Error_Unexpect, LOG_ERROR_ENTITY_ALLOC_MEM_FAILED);
+		return;
+	}
 
-	ErrorCodeEnum Error = m_pEntity->StartAllCameras();
 #ifdef DEVOPS_ON_PRD
 #else
 #ifdef RVC_OS_WIN
 #else
-	m_pEntity->GetFunction()->SetTimer(RVC_CAMERA_CAP_PROCESS, m_pEntity, 5 * 1000);
+	if (ctx->Req.bPostCapInfo) {
+		m_pEntity->GetFunction()->SetTimer(RVC_CAMERA_CAP_PROCESS, m_pEntity, 5 * 1000);
+		m_pEntity->SetPostCapInfoFlag(true);
+	}
 #endif
 #endif
 
-	ctx->Answer(Error);
+	ErrorCodeEnum CameraErrorCode = m_pEntity->m_nCameraErrorCode;
+	if ( Error_AllCamera != CameraErrorCode) {
+		if (Error_Succeed == CameraErrorCode) {
+			ctx->Ans.result = 0;
+		}
+		else if (Error_EnvCamera == CameraErrorCode) {
+			ctx->Ans.result = -1;
+		}
+		else if (Error_OptCamera == CameraErrorCode) {
+			ctx->Ans.result = -2;
+		}
+		ctx->Answer(Error_Succeed);
+	}
+	else {
+		ctx->Ans.result = -3;
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2808").setAPI(__FUNCTION__)("摄像头故障,请联系厂商排查");
+		ctx->Answer(Error_AllCamera, LOG_WARN_ALLCAMERA_ERRORS);
+	}
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Error = %d, CameraErrorCode = %d, result = %d.", Error, CameraErrorCode, ctx->Ans.result);
 }
 
 void MediaServiceSession::Handle_TurnOffCamera(SpReqAnsContext<MediaService_TurnOffCamera_Req, MediaService_TurnOffCamera_Ans>::Pointer ctx)
@@ -2484,12 +2672,22 @@ void MediaServiceSession::Handle_TurnOffCamera(SpReqAnsContext<MediaService_Turn
 #else
 #ifdef RVC_OS_WIN
 #else
-	m_pEntity->GetFunction()->KillTimer(RVC_CAMERA_CAP_PROCESS);
+	if (m_pEntity->GetPostCapInfoFlag()) {
+		m_pEntity->GetFunction()->KillTimer(RVC_CAMERA_CAP_PROCESS);
+		m_pEntity->SetPostCapInfoFlag(false);
+	}
 #endif
 #endif
+
 	ErrorCodeEnum CamRet = m_pEntity->StopAllCameras();
+	if (Error_Succeed == CamRet) {
+		ctx->Ans.result = 0;
+	}
+	else {
+		ctx->Ans.result = -1;
+	}
 
-	ctx->Answer(CamRet);
+	ctx->Answer(Error_Succeed);
 }
 
 SP_BEGIN_ENTITY_MAP()

+ 22 - 15
Module/mod_mediacontroller/mod_mediacontroller.h

@@ -5,7 +5,6 @@
 
 #include "MediaController_server_g.h"
 #include "MediaController_msg_g.h"
-#include "ExternalCameraMsg.h"
 
 #include "../mod_healthmanager/HealthManager_client_g.h"
 #include "../mod_healthmanager/HealthManager_def_g.h"
@@ -44,14 +43,6 @@ class MediaServiceSession : public MediaService_ServerSessionBase
 {
 public:
 	MediaServiceSession(CMediaControllerEntity *pEntity) : m_pEntity(pEntity){}
-	virtual void Handle_GetVideoDeviceName(SpReqAnsContext<MediaService_GetVideoDeviceName_Req, MediaService_GetVideoDeviceName_Ans>::Pointer ctx);
-	virtual void Handle_StartCamera(SpOnewayCallContext<MediaService_StartCamera_Info>::Pointer ctx);
-	virtual void Handle_StopCamera(SpOnewayCallContext<MediaService_StopCamera_Info>::Pointer ctx);
-	virtual void Handle_StartEnvCamera(SpReqAnsContext<MediaService_StartEnvCamera_Req, MediaService_StartEnvCamera_Ans>::Pointer ctx);
-	virtual void Handle_StopEnvCamera(SpOnewayCallContext<MediaService_StopEnvCamera_Info>::Pointer ctx);
-	virtual void Handle_StartSpeakerRender(SpOnewayCallContext<MediaService_StartSpeakerRender_Info>::Pointer ctx);
-	virtual void Handle_StopSpeakerRender(SpOnewayCallContext<MediaService_StopSpeakerRender_Info>::Pointer ctx);
-	virtual void Handle_ManipulateMediaDevice(SpReqAnsContext<MediaService_ManipulateMediaDevice_Req, MediaService_ManipulateMediaDevice_Ans>::Pointer ctx);
 	virtual void Handle_GetAudioDevices(SpReqAnsContext<MediaService_GetAudioDevices_Req, MediaService_GetAudioDevices_Ans>::Pointer ctx);
 	virtual void Handle_GetVideoDevices(SpReqAnsContext<MediaService_GetVideoDevices_Req, MediaService_GetVideoDevices_Ans>::Pointer ctx);
 	virtual void Handle_GetCameraInfos(SpReqAnsContext<MediaService_GetCameraInfos_Req, MediaService_GetCameraInfos_Ans>::Pointer ctx);
@@ -62,7 +53,8 @@ public:
 	virtual void Handle_TurnOnCamera(SpReqAnsContext<MediaService_TurnOnCamera_Req, MediaService_TurnOnCamera_Ans>::Pointer ctx);
 	virtual void Handle_TurnOffCamera(SpReqAnsContext<MediaService_TurnOffCamera_Req, MediaService_TurnOffCamera_Ans>::Pointer ctx);
 	virtual void Handle_IsCameraOnStatus(SpReqAnsContext<MediaService_IsCameraOnStatus_Req, MediaService_IsCameraOnStatus_Ans>::Pointer ctx);
-
+	virtual void Handle_GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx);
+	virtual void Handle_SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx);
 private:
 	CMediaControllerEntity *m_pEntity;
 };
@@ -85,12 +77,14 @@ public:
 	virtual void OnPreClose(EntityCloseCauseEnum eCloseCause, CSmartPointer<ITransactionContext> pTransactionContext); 
 	virtual void OnTimeout(DWORD dwTimerID);
 	bool SetAutoBright(ErrorCodeEnum nCode);
+	bool SetConfigBright(ErrorCodeEnum nCode);
 	void OnReceivePkt(int sub_type, const char *buffer, int size);
 	ErrorCodeEnum RealSelfCheck();
-	void SendCameraBright();
-	ErrorCodeEnum StartAllCameras();
+	void SendCameraBright(DeviceTypeEnum eType);
+	ErrorCodeEnum StartAllCameras(bool bstartaudio = true);
 	ErrorCodeEnum StopAllCameras();
 	ErrorCodeEnum RvcCheckCameraInfo(int iCamNumber);
+	void DelayCloseCameras();
 
 	ErrorCodeEnum HandleSalesRecordPCMAudio(bool bRemoteRecord, const char* pszMessage, audio_frame* pFrame = NULL);
 	void HandleRemoteRecord(const char* pszMessage);
@@ -120,8 +114,7 @@ public:
 	ErrorCodeEnum ChangeSysvar(ErrorCodeEnum op);
 	ErrorCodeEnum StartSalesRecordAudioCapture(bool bRemoteRecord = false);
 	ErrorCodeEnum StopSalesRecordAudioCapture();
-	ErrorCodeEnum StartCamera();
-	void StartCameraAndSetSysVar();
+	ErrorCodeEnum StartCamera(bool bstartaudio = true);
 	ErrorCodeEnum ReStartCamera(int nCamera);
 	virtual CServerSessionBase* OnNewSession(const char* pszRemoteEntityName, const char* pszClass);
 	void OnTimeCameraStatusCheck();
@@ -141,10 +134,16 @@ public:
 	ErrorCodeEnum StopSaveEnvCamPhoto();
 	void HandleStartCameraCapture(const char* pszMessage);
 	void HandleStopCameraCapture();
+	void SetPostCapInfoFlag(bool bpostcapinfo);
+	bool GetPostCapInfoFlag();
 #endif
 #endif
 
-	void SetCameraStateInfo(ErrorCodeEnum errorcode);
+	void SetCameraState(ErrorCodeEnum errorcode);
+	void GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx);
+	void SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx);
+	ErrorCodeEnum PostCameraBrightnessInfos(int iBrightness);
+	bool IsOnlineState();
 
 public:
 	DeviceTypeEnum m_eDeviceType;
@@ -182,11 +181,19 @@ private:
 	int m_interValTime;
 	bool m_bCameraOffTimerOn;
 
+	CSimpleStringA m_strHttpServerAddr;
+	CSimpleStringA m_strHttpServerAPI;
+	int m_iHttpTimeOut;
+	CSimpleStringA m_strAppVersion;
+	CSimpleStringA m_strTerminalId;
+	bool m_bsynchronized;
+
 #ifdef DEVOPS_ON_PRD
 #else
 #ifdef RVC_OS_WIN
 #else
 	CSimpleStringA m_PhotoSaveDir;
+	bool m_bPostCapInfo;
 #endif
 #endif
 };

+ 1 - 1
Module/mod_recorder/CMakeLists.txt

@@ -19,7 +19,7 @@ target_include_directories(${MODULE_NAME} PRIVATE
     ${OTHER_LIB_BASE_DIR}/rvcmediacommon
     ${OTHER_LIB_BASE_DIR}/libfilecryption
     ${CONAN_INCLUDE_DIRS_JSONCPP}
-    )
+)
 
 target_link_directories(${MODULE_NAME} PRIVATE
 	${CONAN_LIB_DIRS_FFMPEG}

+ 9 - 3
Module/mod_recorder/mod_recorder.cpp

@@ -436,7 +436,7 @@ ErrorCodeEnum CRecorderEntity::PostVideoRecordInfos()
 	}
 
 	video_params.strRecordID = m_strRecordName;
-	for (vector<record_item_t>::iterator it = m_vRecordList.begin(); it < m_vRecordList.end(); ++it) {
+	for (vector<record_item_t*>::iterator it = m_vRecordList.begin(); it < m_vRecordList.end(); ++it) {
 		video_params.vRecordList.push_back(*it);
 	}
 
@@ -450,6 +450,12 @@ ErrorCodeEnum CRecorderEntity::PostVideoRecordInfos()
 		LogWarn(Severity_Middle, Error_Exception, LOG_EVT_POST_RECORDINFO_FAILED, strErrorMsg.GetData());
 	}
 
+	for (vector<record_item_t*>::iterator it = m_vRecordList.begin(); it < m_vRecordList.end(); ++it) {
+		if (NULL != *it) {
+			delete* it;
+			*it = NULL;
+		}
+	}
 	m_vRecordList.clear();
 
 	return Error;
@@ -459,7 +465,7 @@ ErrorCodeEnum CRecorderEntity::PostVideoRecordInfos()
 ErrorCodeEnum CRecorderEntity::HandleExceptionRecordVideos()
 {
 	ErrorCodeEnum Error = Error_Failed;
-	const char* videofilename = m_vRecordList[0].file_path.c_str();
+	const char* videofilename = m_vRecordList[0]->file_path.c_str();
 	if (NULL == videofilename) {
 		return Error;
 	}
@@ -499,7 +505,7 @@ ErrorCodeEnum CRecorderEntity::AddToVideoRecordList(const char* videofilename)
 		item->file_name = strfilename;
 	}
 
-	m_vRecordList.push_back(*item);
+	m_vRecordList.push_back(item);
 
 	Error = Error_Succeed;
 

+ 1 - 1
Module/mod_recorder/mod_recorder.h

@@ -100,7 +100,7 @@ namespace Recorder {
 		int m_iHttpTimeOut;
 		CSimpleStringA m_strAppVersion;
 		CSimpleStringA m_strTerminalId;
-		vector<record_item_t> m_vRecordList;
+		vector<record_item_t*> m_vRecordList;
 		char m_strRecordName[MAX_PATH];
 		eRvcBusinessStatus m_eBusinessStatus;
 	};

+ 7 - 6
Module/mod_recorder/recordinfo.cpp

@@ -1,8 +1,8 @@
 #include "recordinfo.h"
 #include "strutil.h"
-#include "Event.h"
 #include "CommEntityUtil.hpp"
 
+
 void HttpsLogCallBack(const char* logtxt) {
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI("HttpsLogCallBack")("HttpsLogCallBack: %s.", logtxt);
 }
@@ -11,6 +11,7 @@ void HttpsLogCallBack(const char* logtxt) {
 int post_video_recordinfo_list(unsigned int& uposttime, CSimpleStringA& errormsg, video_record_info_t* pinfo, int itimeout, bool bprintdbg)
 {
 	int iret = -1;
+
 	IHttpFunc* client = create_http(HttpsLogCallBack);
 	RecordInfoHTTPReq req;
 	req.m_timeOut = itimeout;
@@ -51,11 +52,11 @@ int post_video_recordinfo_list(unsigned int& uposttime, CSimpleStringA& errormsg
 
 	rootReq["business_status"] = pinfo->iBusinessStatus;
 
-	for (vector<record_item_t>::iterator it = pinfo->vRecordList.begin(); it < pinfo->vRecordList.end(); ++it) {
+	for (vector<record_item_t*>::iterator it = pinfo->vRecordList.begin(); it < pinfo->vRecordList.end(); ++it) {
 		Json::Value item;
-		item["file_name"] = it->file_name;
-		item["file_path"] = it->file_path;
-		item["file_length"] = it->file_length;
+		item["file_name"] = (*it)->file_name;
+		item["file_path"] = (*it)->file_path;
+		item["file_length"] = (*it)->file_length;
 		rootReq["file_list"].append(item);
 	}
 
@@ -77,7 +78,7 @@ int post_video_recordinfo_list(unsigned int& uposttime, CSimpleStringA& errormsg
 		iret = 0;
 	}
 	else {
-		errormsg = CSimpleStringA::Format("post video record infos fail, url=%s, syscode=%d, usercode=%s, errmsg=%s", req.m_url.c_str(), ret.m_sysCode, ret.m_userCode.c_str(), ret.m_errMsg.c_str());
+		errormsg = CSimpleStringA::Format("post video record info failed, url=%s, syscode=%d, usercode=%s, errmsg=%s", req.m_url.c_str(), ret.m_sysCode, ret.m_userCode.c_str(), ret.m_errMsg.c_str());
 	}
 
 	return iret;

+ 1 - 11
Module/mod_recorder/recordinfo.h

@@ -6,15 +6,6 @@
 #include "SpBase.h"
 
 
-#ifndef RVC_MAX_JSON_LENGTH
-#define RVC_MAX_JSON_LENGTH 512
-#endif // !RVC_MAX_JSON_LENGTH
-
-
-#ifndef RVC_MAX_RECORDITEM_JSON_LENGTH
-#define RVC_MAX_RECORDITEM_JSON_LENGTH 260
-#endif // !RVC_MAX_RECORDITEM_JSON_LENGTH
-
 #ifndef RVC_UPLOAD_VIDEORECORDING_HTTP_API
 #define RVC_UPLOAD_VIDEORECORDING_HTTP_API "/api/upload/video_recording"
 #endif // !RVC_UPLOAD_VIDEORECORDING_HTTP_API
@@ -49,7 +40,7 @@ typedef struct video_record_info_s {
 	CSimpleStringA strRecordEndTime;
 	CSimpleStringA strRecordID;
 	int iBusinessStatus;
-	vector<record_item_t> vRecordList;
+	vector<record_item_t*> vRecordList;
 }video_record_info_t;
 
 
@@ -83,7 +74,6 @@ struct RecordInfoHTTPRet : CHTTPRet {
 			m_data = root[REFLECTION(data)].asBool();
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("reader parse failed!");
 			m_success = false;
 		}
 

+ 2 - 3
Module/mod_sipphone/CMakeLists.txt

@@ -15,12 +15,9 @@ if(MSVC)
 	uuid.cpp 
 	volumekeeper.h 
 	volumekeeper.cpp
-	
 	)
 else()
 	set(${SIPPHONE_PLATFORM}_SRCS
-	video_render.h
-	video_render.cpp
 	)
 endif(MSVC)
 
@@ -34,6 +31,8 @@ set(${MODULE_PREFIX}_SRCS
     SIPPhone_server_g.h
     video_session.h
 	mod_sipphone.h
+	video_render.h
+	video_render.cpp
 	endpoint.cpp
     audio_session.cpp
     mod_sipphone.cpp

+ 147 - 1
Module/mod_sipphone/SIPPhone_client_g.h

@@ -32,7 +32,6 @@ public:
 	}
 	void OnClose(ErrorCodeEnum)
 	{
-		Dbg("session closed.");
 		bSessionClosed = true;
 	}
 	bool QuerySessionClosed()
@@ -764,6 +763,153 @@ public:
 		return Error;
 	}
 
+	ErrorCodeEnum StartCameraRender(PhoneService_StartCameraRender_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(PhoneService_Method_StartCameraRender, PhoneService_MethodSignature_StartCameraRender, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum StartCameraRender(PhoneService_StartCameraRender_Req &Req, PhoneService_StartCameraRender_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = StartCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum StartCameraRender(PhoneService_StartCameraRender_Req &Req, PhoneService_StartCameraRender_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = StartCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum StartCameraRender(PhoneService_StartCameraRender_Req &Req, PhoneService_StartCameraRender_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = StartCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
+	ErrorCodeEnum StopCameraRender(PhoneService_StopCameraRender_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(PhoneService_Method_StopCameraRender, PhoneService_MethodSignature_StopCameraRender, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum StopCameraRender(PhoneService_StopCameraRender_Req &Req, PhoneService_StopCameraRender_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = StopCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum StopCameraRender(PhoneService_StopCameraRender_Req &Req, PhoneService_StopCameraRender_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = StopCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum StopCameraRender(PhoneService_StopCameraRender_Req &Req, PhoneService_StopCameraRender_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = StopCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
+	ErrorCodeEnum IsCameraRender(PhoneService_IsCameraRender_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(PhoneService_Method_IsCameraRender, PhoneService_MethodSignature_IsCameraRender, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum IsCameraRender(PhoneService_IsCameraRender_Req &Req, PhoneService_IsCameraRender_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = IsCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum IsCameraRender(PhoneService_IsCameraRender_Req &Req, PhoneService_IsCameraRender_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = IsCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum IsCameraRender(PhoneService_IsCameraRender_Req &Req, PhoneService_IsCameraRender_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = IsCameraRender(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
 
 	bool SafeDelete()
 	{

+ 80 - 14
Module/mod_sipphone/SIPPhone_def_g.h

@@ -40,6 +40,9 @@ namespace SIPPhone {
 #define PhoneService_Method_SetPickupInVolume 18
 #define PhoneService_Method_GetPickupInVolume 19
 #define PhoneService_Method_GetAudioDevices 20
+#define PhoneService_Method_StartCameraRender 21
+#define PhoneService_Method_StopCameraRender 22
+#define PhoneService_Method_IsCameraRender 23
 
 #define PhoneService_MethodSignature_MakeCall -1045574280
 #define PhoneService_MethodSignature_HangupCall 507892508
@@ -62,6 +65,9 @@ namespace SIPPhone {
 #define PhoneService_MethodSignature_SetPickupInVolume 35636029
 #define PhoneService_MethodSignature_GetPickupInVolume -735373015
 #define PhoneService_MethodSignature_GetAudioDevices -271351251
+#define PhoneService_MethodSignature_StartCameraRender -1962833445
+#define PhoneService_MethodSignature_StopCameraRender 6416978
+#define PhoneService_MethodSignature_IsCameraRender 325255993
 
 #define PhoneService_LogCode_MakeCall "QLR040230100"
 #define PhoneService_LogCode_HangupCall "QLR040230101"
@@ -76,20 +82,14 @@ namespace SIPPhone {
 #define PhoneService_LogCode_GetPickupOutVolume "QLR040230113"
 #define PhoneService_LogCode_StartVideoRender "QLR040230114"
 #define PhoneService_LogCode_StopVideoRender "QLR040230115"
-
-#define PhoneService_LogCode_MakeCall "QLR040230100"
-#define PhoneService_LogCode_HangupCall "QLR040230101"
-#define PhoneService_LogCode_StartVideo "QLR040230102"
-#define PhoneService_LogCode_StopVideo "QLR040230103"
-#define PhoneService_LogCode_RealErrorCheck "QLR040230104"
-#define PhoneService_LogCode_ReleaseCall "QLR040230105"
-#define PhoneService_LogCode_SetCallingParam "QLR040230109"
-#define PhoneService_LogCode_GetHandfreeOutVolume "QLR040230110"
-#define PhoneService_LogCode_SetHandfreeOutVolume "QLR040230111"
-#define PhoneService_LogCode_SetPickupOutVolume "QLR040230112"
-#define PhoneService_LogCode_GetPickupOutVolume "QLR040230113"
-#define PhoneService_LogCode_StartVideoRender "QLR040230114"
-#define PhoneService_LogCode_StopVideoRender "QLR040230115"
+#define PhoneService_LogCode_GetHandfreeInVolume "QLR040230116"
+#define PhoneService_LogCode_SetHandfreeInVolume "QLR040230117"
+#define PhoneService_LogCode_SetPickupInVolume "QLR040230118"
+#define PhoneService_LogCode_GetPickupInVolume "QLR040230119"
+#define PhoneService_LogCode_GetAudioDevices "QLR040230120"
+#define PhoneService_LogCode_StartCameraRender "QLR040230121"
+#define PhoneService_LogCode_StopCameraRender "QLR040230122"
+#define PhoneService_LogCode_IsCameraRender "QLR040230123"
 
 struct PhoneService_MakeCall_Req
 {
@@ -456,6 +456,72 @@ struct PhoneService_GetAudioDevices_Ans
 
 };
 
+struct PhoneService_StartCameraRender_Req
+{
+	int icameraid;
+	int video_view_x;
+	int video_view_y;
+	int video_view_cx;
+	int video_view_cy;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & icameraid & video_view_x & video_view_y & video_view_cx & video_view_cy;
+	}
+
+};
+
+struct PhoneService_StartCameraRender_Ans
+{
+	int result;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & result;
+	}
+
+};
+
+struct PhoneService_StopCameraRender_Req
+{
+
+	void Serialize(SpBuffer &Buf)
+	{
+	}
+
+};
+
+struct PhoneService_StopCameraRender_Ans
+{
+	int result;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & result;
+	}
+
+};
+
+struct PhoneService_IsCameraRender_Req
+{
+
+	void Serialize(SpBuffer &Buf)
+	{
+	}
+
+};
+
+struct PhoneService_IsCameraRender_Ans
+{
+	bool result;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & result;
+	}
+
+};
+
 
 ///////////////////////////
 

+ 81 - 0
Module/mod_sipphone/SIPPhone_server_g.h

@@ -170,6 +170,27 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case PhoneService_Method_StartCameraRender:
+			if (dwSignature == PhoneService_MethodSignature_StartCameraRender) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case PhoneService_Method_StopCameraRender:
+			if (dwSignature == PhoneService_MethodSignature_StopCameraRender) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case PhoneService_Method_IsCameraRender:
+			if (dwSignature == PhoneService_MethodSignature_IsCameraRender) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -281,6 +302,21 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case PhoneService_Method_StartCameraRender:
+			if (dwSignature != PhoneService_MethodSignature_StartCameraRender) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case PhoneService_Method_StopCameraRender:
+			if (dwSignature != PhoneService_MethodSignature_StopCameraRender) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case PhoneService_Method_IsCameraRender:
+			if (dwSignature != PhoneService_MethodSignature_IsCameraRender) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -388,6 +424,21 @@ public:
 	/// override by user
 	}
 
+	virtual void Handle_StartCameraRender(SpReqAnsContext<PhoneService_StartCameraRender_Req, PhoneService_StartCameraRender_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
+	virtual void Handle_StopCameraRender(SpReqAnsContext<PhoneService_StopCameraRender_Req, PhoneService_StopCameraRender_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
+	virtual void Handle_IsCameraRender(SpReqAnsContext<PhoneService_IsCameraRender_Req, PhoneService_IsCameraRender_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
 	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CAutoBuffer Buf;
@@ -600,6 +651,36 @@ public:
 						Handle_GetAudioDevices(ctx);
 					}
 					break;
+				case PhoneService_Method_StartCameraRender:
+					{
+						SpReqAnsContext<PhoneService_StartCameraRender_Req,PhoneService_StartCameraRender_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<PhoneService_StartCameraRender_Req,PhoneService_StartCameraRender_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_StartCameraRender(ctx);
+					}
+					break;
+				case PhoneService_Method_StopCameraRender:
+					{
+						SpReqAnsContext<PhoneService_StopCameraRender_Req,PhoneService_StopCameraRender_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<PhoneService_StopCameraRender_Req,PhoneService_StopCameraRender_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_StopCameraRender(ctx);
+					}
+					break;
+				case PhoneService_Method_IsCameraRender:
+					{
+						SpReqAnsContext<PhoneService_IsCameraRender_Req,PhoneService_IsCameraRender_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<PhoneService_IsCameraRender_Req,PhoneService_IsCameraRender_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_IsCameraRender(ctx);
+					}
+					break;
 				default:
 					assert(0);
 					break;

+ 29 - 2
Module/mod_sipphone/SipService.xml

@@ -134,7 +134,7 @@
 				<param name="Volume" type="int"/>
 			</res>
 		</twoway>
-		<twoway name="GetCameraInfos" overlap="true">
+		<twoway name="GetAudioDevices" overlap="true" method_id="20">
 			<req>
 			</req>
       <res>
@@ -145,7 +145,34 @@
 				<param name="strPickupOut" type="string"/>
       </res>
     </twoway>
-	</class>
+    <twoway name="StartCameraRender" overlap="true" method_id="21">
+      <req>
+        <!-- 回显摄像头id, 0为env摄像头, 1为下摄像头 -->
+        <param name="icameraid" type="int"/>
+        <param name="video_view_x" type="int"/>
+        <param name="video_view_y" type="int"/>
+        <param name="video_view_cx" type="int"/>
+        <param name="video_view_cy" type="int"/>
+      </req>
+      <res>
+        <param name="result" type="int"/>
+      </res>
+    </twoway>
+    <twoway name="StopCameraRender" overlap="true" method_id="22">
+      <req>
+      </req>
+      <res>
+        <param name="result" type="int"/>
+      </res>
+    </twoway>
+	<twoway name="IsCameraRender" overlap="true" method_id="23">
+      <req>
+      </req>
+      <res>
+        <param name="result" type="bool"/>
+      </res>
+    </twoway>
+  </class>
 	<!-- 视频框开始移动消息 -->
 	<message name="VideoBoxStartMove">
 		<!-- 本地和远端表示,1为本地,2为远端 -->

+ 88 - 23
Module/mod_sipphone/mod_sipphone.cpp

@@ -114,27 +114,29 @@ static void __audiomgrlog(void* user_data, const char* fmt, va_list arg)
 	}
 }
 
-#ifdef RVC_OS_WIN
-#else
+
 
 static void __video_render_log(render_loglevel elevel, void* user_data, const char* fmt, va_list arg)
 {
-	int n = vsnprintf(NULL, 0, fmt, arg);
+	int n = rvc_vsnprintf(NULL, 0, fmt, arg);
 	if (elevel >= RENDER_LOG_INFO) {
 		if (n >= MAX_PATH) {
 			char* buf = (char*)malloc((size_t)(n + 1));
-			vsnprintf(buf, n + 1, fmt, arg);
+			rvc_vsnprintf(buf, n + 1, fmt, arg);
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
 			free(buf);
 		}
 		else {
 			char strlog[MAX_PATH] = { 0 };
-			vsnprintf(strlog, MAX_PATH, fmt, arg);
+			rvc_vsnprintf(strlog, MAX_PATH, fmt, arg);
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
 		}
 	}
 }
 
+
+#ifdef RVC_OS_WIN
+#else
 static int __on_stop_remote_video_render_callback(void* user_data)
 {
 	int iret = -1;
@@ -154,6 +156,8 @@ static int __remote_video_render_callback(void* videoframe, void* user_data)
 
 	return rvc_remote_video_render(pThis->m_render, videoframe);
 }
+#endif
+
 
 static int __on_window_type_callback(void* user_data)
 {
@@ -161,7 +165,6 @@ static int __on_window_type_callback(void* user_data)
 	return pThis->m_stVideoParam.bShowPersonArea;
 }
 
-#endif
 
 static CSimpleStringA generateAudioInfoJson(const char* handfreeIn, const char* handfreeOut, const char* pickupIn, const char* pickupOut)
 {
@@ -259,11 +262,12 @@ CSIPEntity::CSIPEntity() : m_pCurrentSession(NULL), m_state(INIT),m_iPickupPhone
 	m_pKeeperOut[0] = m_pKeeperOut[1] = NULL;
 	m_eVideoRenderType = eGDI;
 	m_bAudioMgrInited = false;
-#else
+#endif
+
 	m_ilocalvideo_freshtime = RVC_VIDEO_FRESH_TIME;
 	m_iremotevideo_freshtime = RVC_VIDEO_FRESH_TIME;
 	m_render = NULL;
-#endif
+
 	m_SipErrorCode = Error_Succeed;
 	m_pAudioMgr = NULL;
 	m_pSipphoneChannel = NULL;
@@ -280,6 +284,7 @@ CSIPEntity::CSIPEntity() : m_pCurrentSession(NULL), m_state(INIT),m_iPickupPhone
 	m_bFirstLaunched = false;
 	m_pEndpoint = NULL;
 	m_bMessageBox = false;
+	m_bIsCameraRender = false;
 }
 
 
@@ -474,7 +479,7 @@ void CSIPEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const
 			int isecond = 0;
 			sscanf(pszMessage, "%d@%d@%d@%d@%d@%s", &local_view_x, &local_view_y, &local_view_cx, &local_view_cy, &isecond, str);
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("local_view_x = %d, local_view_y = %d, local_view_cx = %d, local_view_cy = %d.", local_view_x, local_view_y, local_view_cx, local_view_cy);
-			StartCameraRender(local_view_x, local_view_y, local_view_cx, local_view_cy);
+			StartCameraRender(0, local_view_x, local_view_y, local_view_cx, local_view_cy);
 		#endif
 		}
 		break;
@@ -2428,10 +2433,14 @@ CSimpleStringA CSIPEntity::GetAudioDeviceJsonInfos(bool bmicro)
 
 #endif
 
-ErrorCodeEnum CSIPEntity::StartCameraRender(int ivideoview_x, int ivideoview_y, int ivideoview_cx, int ivideoview_cy)
+int CSIPEntity::StartCameraRender(int icamid, int ivideoview_x, int ivideoview_y, int ivideoview_cx, int ivideoview_cy)
 {
-#ifdef RVC_OS_WIN
-#else
+	int iRet = -1;
+
+	if (m_bIsCameraRender) {
+		return iRet;
+	}
+	
 	m_render = new rvc_video_render_t();
 	videorender_callback_t t_callback = { 0 };
 	t_callback.debug = &__video_render_log;
@@ -2440,14 +2449,22 @@ ErrorCodeEnum CSIPEntity::StartCameraRender(int ivideoview_x, int ivideoview_y,
 	render_param.ilocal_view_cy = ivideoview_cy;
 	render_param.ilocal_view_x = ivideoview_x;
 	render_param.ilocal_view_y = ivideoview_y;
-	render_param.ilocal_render_queue = 1;
+	render_param.erender_queue = eSnapshot_Queue;
 
 	m_render->plocal_render = CreateVideoRenderObj(&t_callback);
 	LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_LOCAL_VIDEO_RENDER_CREATE, "local video render create.");
 
 	memcpy(&m_render->render_param, &render_param, sizeof(rvc_video_render_params_t));
+
+#ifdef RVC_OS_WIN
+	m_render->local_render_stop_event = NULL;
+	m_render->remote_render_stop_event = NULL;
+	m_render->local_render_thread = NULL;
+	m_render->remote_render_thread = NULL;
+#else
 	m_render->local_render_threadid = 0;
 	m_render->remote_render_threadid = 0;
+#endif // RVC_OS_WIN
 
 	rvc_video_box_move_callback_t t_render_callback = { 0 };
 	t_render_callback.on_video_box_move = &__on_video_box_move;
@@ -2460,17 +2477,24 @@ ErrorCodeEnum CSIPEntity::StartCameraRender(int ivideoview_x, int ivideoview_y,
 	m_stVideoParam.bShowPersonArea = 0;
 
 	if (Error_Succeed == rvc_start_video_render(m_render, false, &t_render_callback)) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start video render success.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start video render success.");
+		m_bIsCameraRender = true;
 	}
-#endif // RVC_OS_WIN
 
-	return Error_Succeed;
+	iRet = 0;
+
+	return iRet;
 }
 
-ErrorCodeEnum CSIPEntity::StopCameraRender()
+int CSIPEntity::StopCameraRender()
 {
-#ifdef RVC_OS_WIN
-#else
+	int iRet = -1;
+
+	if (NULL == m_render) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop video render for render is null.");
+		return iRet;
+	}
+
 	if (Error_Succeed == rvc_stop_video_render(m_render)) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop video render success.");
 	}
@@ -2478,15 +2502,27 @@ ErrorCodeEnum CSIPEntity::StopCameraRender()
 		DestroyVideoRenderObj(m_render->plocal_render);
 	}
 
+#ifdef RVC_OS_WIN
+	if (NULL != m_render->local_render_stop_event) {
+		CloseHandle(m_render->local_render_stop_event);
+		m_render->local_render_stop_event = NULL;
+	}
+#else
 	if (NULL != &m_render->local_render_stop_sem) {
 		sem_destroy(&m_render->local_render_stop_sem);
 	}
-
-	delete(m_render);
-	m_render = NULL;
 #endif // RVC_OS_WIN
 
-	return Error_Succeed;
+	if (NULL != m_render) {
+		delete(m_render);
+		m_render = NULL;
+	}
+
+	m_bIsCameraRender = false;
+
+	iRet = 0;
+
+	return iRet;
 }
 
 //
@@ -2812,6 +2848,32 @@ void CSIPPhoneSession::Handle_GetAudioDevices(SpReqAnsContext<PhoneService_GetAu
 	ctx->Answer(Error_Succeed);
 }
 
+void CSIPPhoneSession::Handle_StartCameraRender(SpReqAnsContext<PhoneService_StartCameraRender_Req, PhoneService_StartCameraRender_Ans>::Pointer ctx)
+{	
+	int iRet = m_pEntity->StartCameraRender(ctx->Req.icameraid, ctx->Req.video_view_x, ctx->Req.video_view_y, ctx->Req.video_view_cx, ctx->Req.video_view_cy);
+	ctx->Ans.result = iRet;
+	ctx->Answer(Error_Succeed);
+}
+
+void CSIPPhoneSession::Handle_StopCameraRender(SpReqAnsContext<PhoneService_StopCameraRender_Req, PhoneService_StopCameraRender_Ans>::Pointer ctx)
+{
+	if (m_pEntity->m_bIsCameraRender) {
+		int iRet = m_pEntity->StopCameraRender();
+		ctx->Ans.result = iRet;
+	}
+	else {
+		ctx->Ans.result = 0;
+	}
+
+	ctx->Answer(Error_Succeed);
+}
+
+void CSIPPhoneSession::Handle_IsCameraRender(SpReqAnsContext<PhoneService_IsCameraRender_Req, PhoneService_IsCameraRender_Ans>::Pointer ctx)
+{
+	ctx->Ans.result = m_pEntity->m_bIsCameraRender;
+	ctx->Answer(Error_Succeed);
+}
+
 void CSIPPhoneSession::Handle_BeginState( SpSubscribeContext<PhoneService_BeginState_Sub, PhoneService_PhoneState_Info>::Pointer ctx )
 {
 	m_spCallbackContext = ctx;
@@ -3059,6 +3121,8 @@ void CSIPPhoneSession::control_video( ControlVideoCommand_t *pCmd)
 				render_param.iremote_move = pCmd->remote_hwd_move;
 				render_param.ilocal_fresh_time = pCmd->local_fresh_time;
 				render_param.iremote_fresh_time = pCmd->remote_fresh_time;
+				render_param.erender_queue = ePreview_Queue;
+
 				start_video_render(&render_param, false);
 			}
 		} 
@@ -3109,6 +3173,7 @@ void CSIPPhoneSession::video_render(VideoRenderCommand_t* pCmd)
 		render_param.iremote_move = pCmd->remote_hwd_move;
 		render_param.ilocal_fresh_time = pCmd->local_fresh_time;
 		render_param.iremote_fresh_time = pCmd->remote_fresh_time;
+		render_param.erender_queue = ePreview_Queue;
 
 		start_video_render(&render_param, true);
 	}

+ 10 - 13
Module/mod_sipphone/mod_sipphone.h

@@ -11,11 +11,12 @@ using namespace SIPPhone;
 #if defined(RVC_OS_WIN)
 #include "volumekeeper.h"
 #else
-#include "video_render.h"
 #include "Event.h"
 #include "EventCode.h"
 #endif //RVC_OS_WIN
 
+#include "video_render.h"
+
 #include "HealthManager_client_g.h"
 #include "HealthManager_def_g.h"
 using namespace HealthManager;
@@ -63,14 +64,6 @@ using namespace AssistantChannel;
 #endif
 #endif
 
-#ifndef rvc_snprintf
-#ifdef RVC_OS_WIN
-#define rvc_snprintf _snprintf
-#else
-#define rvc_snprintf snprintf
-#endif // RVC_OS_WIN
-#endif // rvc_snprintf
-
 typedef enum
 {
 	RVC_AUDIO_NO_ERROR = 0x0,				
@@ -244,6 +237,9 @@ public:
 	virtual void Handle_SetPickupInVolume(SpReqAnsContext<PhoneService_SetPickupInVolume_Req, PhoneService_SetPickupInVolume_Ans>::Pointer ctx);
 	virtual void Handle_GetPickupInVolume(SpReqAnsContext<PhoneService_GetPickupInVolume_Req, PhoneService_GetPickupInVolume_Ans>::Pointer ctx);
 	virtual void Handle_GetAudioDevices(SpReqAnsContext<PhoneService_GetAudioDevices_Req, PhoneService_GetAudioDevices_Ans>::Pointer ctx);
+	virtual void Handle_StartCameraRender(SpReqAnsContext<PhoneService_StartCameraRender_Req, PhoneService_StartCameraRender_Ans>::Pointer ctx);
+	virtual void Handle_StopCameraRender(SpReqAnsContext<PhoneService_StopCameraRender_Req, PhoneService_StopCameraRender_Ans>::Pointer ctx);
+	virtual void Handle_IsCameraRender(SpReqAnsContext<PhoneService_IsCameraRender_Req, PhoneService_IsCameraRender_Ans>::Pointer ctx);
 
 public:
 	void on_call_state(int state, const char *state_desc, const char *phrase);
@@ -327,6 +323,8 @@ public:
 	CSimpleStringA MakeUri(const char *terminal_id);
 	void SetMessageBoxFlag(bool bFlag);
 	void HandleSendBroadcastMsg(bool bHandfreeError);
+	int StartCameraRender(int icamid, int ivideoview_x, int ivideoview_y, int ivideoview_cx, int ivideoview_cy);
+	int StopCameraRender();
 
 private:
 	ErrorCodeEnum LoadConfig(endpoint_conf_t *conf);
@@ -362,23 +360,22 @@ private:
 	uint32_t CheckAudioDevice();
 	ErrorCodeEnum SetSoundCardSysVar(const CSimpleStringA& newVal);
  	void HandleCheckAudioDevice(const char* pszValue);
-	ErrorCodeEnum StartCameraRender(int ivideoview_x, int ivideoview_y, int ivideoview_cx, int ivideoview_cy);
-	ErrorCodeEnum StopCameraRender();
 
 public:
 	int m_kept_volume_in[2];
 	int m_kept_volume_out[2];
 	IAudioMgr* m_pAudioMgr;
+	bool m_bIsCameraRender;
 
 #ifdef RVC_OS_WIN
 	void* m_pKeeperIn[2];
 	void* m_pKeeperOut[2];
 	eVideoRenderType m_eVideoRenderType;
-#else
+#endif
+
 	int m_ilocalvideo_freshtime;
 	int m_iremotevideo_freshtime;
 	rvc_video_render_t* m_render;
-#endif
 
 	bool m_bAudioMgrInited;
 	CSimpleStringA m_strStartTime;

+ 181 - 58
Module/mod_sipphone/video_render.cpp

@@ -6,11 +6,6 @@
 #include "rvc_media_common.h"
 #include "fileutil.h"
 
-extern "C"{
-	#include <libavutil/avutil.h>
-	#include <libavcodec/avcodec.h>
-	#include <libswscale/swscale.h>
-}
 #include "video_common/ffmpeg_api_cpp_adapter.h"
 
 #include "cv.h"
@@ -63,17 +58,20 @@ static int rvc_video_shm_enqueue(Clibvideoqueue* shm_queue, video_frame* frame,
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("caution: rvc render shm_queue video insert shm video failed!");
 		return Error_Unexpect;
 	}
-	else
-	{
+	else{
 		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("video render shm_queue video insert shm video ok, and nowtime is %d, and frame id is %d.", nowtime, iframeid);
 		return Error_Succeed;
 	}
 }
 
-static int get_local_video_frame(video_frame** frame, int itype, Clibvideoqueue* local_video_queue, int iwidth, int iheight, IplImage* personimage, IplImage* personmask)
+static bool get_local_video_frame(video_frame** frame, int itype, Clibvideoqueue* local_video_queue, int iwidth, int iheight, IplImage* personimage, IplImage* personmask)
 {
+	bool result = false;
 	video_frame* tmp_frame_preview = NULL;
 	tmp_frame_preview = video_frame_new(iwidth, iheight, VIDEO_FORMAT_RGB24);
+	if (NULL == tmp_frame_preview) {
+		return result;
+	}
 	videoq_frame frm;
 	frm.data = tmp_frame_preview->data[0];
 
@@ -86,8 +84,7 @@ static int get_local_video_frame(video_frame** frame, int itype, Clibvideoqueue*
 		blog = false;
 	}
 
-	//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d, session->video_shm_q_preview = 0x%08x.", __FUNCTION__, __LINE__, local_video_queue);
-	bool result = local_video_queue->GetVideo(&frm, VIDEOQUEUE_FLAG_HORIZONTAL_FLIP);
+	result = local_video_queue->GetVideo(&frm, VIDEOQUEUE_FLAG_HORIZONTAL_FLIP);
 	if (result){
 		if (1 == itype) {
 			if (NULL != personimage && NULL != personmask)
@@ -111,8 +108,12 @@ static int get_local_video_frame(video_frame** frame, int itype, Clibvideoqueue*
 		}
 		*frame = tmp_frame_preview;
 	}
-
-	return 0;
+	else {
+		video_frame_delete(tmp_frame_preview);
+		tmp_frame_preview = NULL;
+	}
+	
+	return result;
 }
 
 
@@ -135,41 +136,87 @@ int rvc_remote_video_render(rvc_video_render_t* prender, void* videoframe)
 	return 0;
 }
 
-void* rvc_videorender_func(void* arg)
+
+static int rvc_getrender_videoqueue(Clibvideoqueue** render_video_queue, int* render_width, int* render_height, RVC_RendererFlip* renderflip, rvc_video_render_t* param)
 {
-	rvc_video_render_t* param = (rvc_video_render_t*)arg;
-	int ilocal_video_fresh_time = param->render_param.ilocal_fresh_time;
-	bool bremote_video = false;
+	int iret = -1;
 
 	int irender_camera = CAMERA_TYPE_ENV;
 	if (param->render_param.ilocal_view_cx < param->render_param.ilocal_view_cy) {
 		irender_camera = CAMERA_TYPE_OPT;
 	}
 
-	Clibvideoqueue* local_video_queue = NULL;
-	RVC_RendererFlip renderflip = RVC_FLIP_VERTICAL;
-	int iwidth = 0;
-	int iheight = 0;
 	if (CAMERA_TYPE_ENV == irender_camera) {
-		if (0 == param->render_param.ilocal_render_queue) {
-			local_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE);
-			iwidth = REC_COMMON_VIDEO_PREVIEW_WIDTH;
-			iheight = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
+		if (ePreview_Queue == param->render_param.erender_queue) {
+			*render_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE);
+			*render_width = REC_COMMON_VIDEO_PREVIEW_WIDTH;
+			*render_height = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
 		}
 		else {
-			local_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE);
-			iwidth = REC_COMMON_VIDEO_SNAPSHOT_WIDTH;
-			iheight = REC_COMMON_VIDEO_SNAPSHOT_HEIGHT;
+			*render_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE);
+			*render_width = REC_COMMON_VIDEO_SNAPSHOT_WIDTH;
+			*render_height = REC_COMMON_VIDEO_SNAPSHOT_HEIGHT;
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("use sanpshot queue.");
 		}
+#ifdef RVC_OS_WIN
+		*renderflip = RVC_FLIP_HORIZONTAL;
+#endif // RVC_OS_WIN
 	}
 	else {
-		local_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_OPT_SHM_PREVIEW_QUEUE);
-		iwidth = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
-		iheight = REC_COMMON_VIDEO_PREVIEW_WIDTH;
-		renderflip = RVC_FLIP_NONE;
+		if (ePreview_Queue == param->render_param.erender_queue) {
+			*render_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_OPT_SHM_PREVIEW_QUEUE);
+			*render_width = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
+			*render_height = REC_COMMON_VIDEO_PREVIEW_WIDTH;
+		}
+		else {
+			*render_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE);
+			*render_width = REC_COMMON_VIDEO_SNAPSHOT_HEIGHT;
+			*render_height = REC_COMMON_VIDEO_SNAPSHOT_WIDTH;
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("use sanpshot queue.");
+		}
+		*renderflip = RVC_FLIP_NONE;
+	}
+
+	iret = 0;
+
+	return iret;
+}
+
+
+static int rvc_getrxkimage(IplImage** personimage, IplImage** personmask)
+{
+	int iret = -1;
+
+	char strPersonPath[MAX_PATH] = { 0 };
+	rvc_snprintf(strPersonPath, MAX_PATH, "./bin/rxk.jpg");
+
+	if (ExistsFile(strPersonPath)) {
+		*personimage = cvLoadImage(strPersonPath);
+		*personmask = cvLoadImage(strPersonPath, 0);
+		iret = 0;
 	}
 
+	return iret;
+}
+
+
+#ifdef RVC_OS_WIN
+static unsigned int __stdcall rvc_videorender_func(void* arg)
+#else
+static void* rvc_videorender_func(void* arg)
+#endif
+{
+	rvc_video_render_t* param = (rvc_video_render_t*)arg;
+	int ilocal_video_fresh_time = param->render_param.ilocal_fresh_time;
+	bool bremote_video = false;
+
+	Clibvideoqueue* local_video_queue = NULL;
+	RVC_RendererFlip renderflip = RVC_FLIP_VERTICAL;
+	int iwidth = 0;
+	int iheight = 0;
+
+	rvc_getrender_videoqueue(&local_video_queue, &iwidth, &iheight, &renderflip, param);
+
 	int ivideo_width = 0;
 	int ivideo_height = 0;
 	int isize = local_video_queue->GetFrameSize(ivideo_width, ivideo_height);
@@ -179,15 +226,9 @@ void* rvc_videorender_func(void* arg)
 		iheight = ivideo_height;
 	}
 
-	char strPersonPath[MAX_PATH] = { 0 };
-	snprintf(strPersonPath, MAX_PATH, "./bin/rxk.jpg");
 	IplImage* personimage = NULL;
 	IplImage* personmask = NULL;
-
-	if (ExistsFile(strPersonPath)){
-		personimage = cvLoadImage(strPersonPath);
-		personmask = cvLoadImage(strPersonPath, 0);
-	}
+	rvc_getrxkimage(&personimage, &personmask);
 
 	if (NULL != param->plocal_render) {
 		videorender_param_t tparam = { 0 };
@@ -233,13 +274,17 @@ void* rvc_videorender_func(void* arg)
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d isize = %d, ivideo_width = %d, ivideo_height = %d.", __FUNCTION__, __LINE__, isize, ivideo_width, ivideo_height);
 
 		for (; ; ) {
+#ifdef RVC_OS_WIN
+			DWORD dwRet = WaitForSingleObject(param->local_render_stop_event, ilocal_video_fresh_time);
+			if (WAIT_TIMEOUT == dwRet) {
+#else
 			struct timespec ts;
 			clock_gettime(CLOCK_REALTIME, &ts);
 			long unsec = ts.tv_nsec + (1000 * 1000 * ilocal_video_fresh_time);
 			ts.tv_sec += (unsec / 1000000000);
 			ts.tv_nsec = (unsec % 1000000000);
-			if (0 != sem_timedwait(&param->local_render_stop_sem, &ts) && (ETIMEDOUT == errno))
-			{
+			if (0 != sem_timedwait(&param->local_render_stop_sem, &ts) && (ETIMEDOUT == errno)){
+#endif
 				video_frame* local_video_frame = NULL;
 				int iwindowstate = param->cb.on_window_type(param->cb.user_data);
 				get_local_video_frame(&local_video_frame, iwindowstate, local_video_queue, iwidth, iheight, personimage, personmask);
@@ -290,22 +335,19 @@ void* rvc_videorender_func(void* arg)
 }
 
 
-void* rvc_remote_videorender_func(void* arg)
+static int rvc_get_remote_videoframe(video_frame** remote_frame)
 {
-	rvc_video_render_t* param = (rvc_video_render_t*)arg;
-	int iremote_video_fresh_time = param->render_param.iremote_fresh_time;
+	int iret = -1;
+
 	char strImgPath[MAX_PATH] = { 0 };
+	rvc_snprintf(strImgPath, MAX_PATH, "%s", "./bin/agent.jpg");
 	int irecord_video_frame_width = REC_COMMON_VIDEO_SNAPSHOT_PREVIEW_WIDTH;
 	int irecord_video_frame_heigt = REC_COMMON_VIDEO_SNAPSHOT_PREVIEW_HEIGHT;
 
-	Clibvideoqueue* video_shm_q_remote = new Clibvideoqueue(REC_COMMON_VIDEO_REMOTE_SHM_RTP_QUEUE);
-	
-	snprintf(strImgPath, MAX_PATH, "%s", "./bin/agent.jpg");
-
-	video_frame* remote_frame = video_frame_new(irecord_video_frame_width, irecord_video_frame_heigt, VIDEO_FORMAT_RGB24);
-	video_frame_fill_black(remote_frame);
+	*remote_frame = video_frame_new(irecord_video_frame_width, irecord_video_frame_heigt, VIDEO_FORMAT_RGB24);
+	video_frame_fill_black(*remote_frame);
 
-	if (ExistsFile(strImgPath)){
+	if (ExistsFileA(strImgPath)) {
 		IplImage* img = cvLoadImage(strImgPath, 1);
 		videoq_frame* vframe = new videoq_frame;
 
@@ -326,9 +368,9 @@ void* rvc_remote_videorender_func(void* arg)
 			SWS_POINT, NULL, NULL, NULL);
 
 		uint8_t* src_data[4] = { (unsigned char*)vframe->data + (vframe->height - 1) * vframe->width * 3, NULL, NULL, NULL };
-		int src_linesize[4] = { -vframe->width * 3, 0, 0, 0};
-		unsigned char* dst[4] = { remote_frame->data[0],NULL,NULL,NULL };
-		int dst_linesize[4] = { remote_frame->linesize[0], 0, 0, 0};
+		int src_linesize[4] = { -vframe->width * 3, 0, 0, 0 };
+		unsigned char* dst[4] = { (*remote_frame)->data[0],NULL,NULL,NULL };
+		int dst_linesize[4] = { (*remote_frame)->linesize[0], 0, 0, 0 };
 		sws_scale(sws, src_data, src_linesize, 0, vframe->height, dst, dst_linesize);
 		sws_freeContext(sws);
 
@@ -337,8 +379,28 @@ void* rvc_remote_videorender_func(void* arg)
 			delete vframe;
 			vframe = NULL;
 		}
+
+		iret = 0;
 	}
 
+	return iret;
+}
+
+
+#ifdef RVC_OS_WIN
+static unsigned int __stdcall rvc_remote_videorender_func(void* arg)
+#else
+static void* rvc_remote_videorender_func(void* arg)
+#endif
+{
+	rvc_video_render_t* param = (rvc_video_render_t*)arg;
+	int iremote_video_fresh_time = param->render_param.iremote_fresh_time;
+
+	Clibvideoqueue* video_shm_q_remote = new Clibvideoqueue(REC_COMMON_VIDEO_REMOTE_SHM_RTP_QUEUE);
+
+	video_frame* remote_frame = NULL;
+	rvc_get_remote_videoframe(&remote_frame);
+
 	video_frame* showframe = NULL;
 	if (-1 == translate_image_resolution(&showframe, param->render_param.iremote_view_cx, param->render_param.iremote_view_cy, remote_frame)) {
 		showframe = video_frame_new(param->render_param.iremote_view_cx, param->render_param.iremote_view_cy, VIDEO_FORMAT_RGB24);
@@ -353,12 +415,17 @@ void* rvc_remote_videorender_func(void* arg)
 	}
 
 	for (; ; ) {
+#ifdef RVC_OS_WIN
+		DWORD dwRet = WaitForSingleObject(param->remote_render_stop_event, iremote_video_fresh_time);
+		if (WAIT_TIMEOUT == dwRet){
+#else
 		struct timespec ts;
 		clock_gettime(CLOCK_REALTIME, &ts);
 		long unsec = ts.tv_nsec + (1000 * 1000 * iremote_video_fresh_time);
 		ts.tv_sec += (unsec / 1000000000);
 		ts.tv_nsec = (unsec % 1000000000);
 		if (0 != sem_timedwait(&param->remote_render_stop_sem, &ts) && (ETIMEDOUT == errno)){
+#endif // RVC_OS_WIN
 			rvc_remote_video_render(param, showframe);
 			if (NULL != video_shm_q_remote){
 				rc = rvc_video_shm_enqueue(video_shm_q_remote, remote_frame, VIDEOQUEUE_FLAG_VERTICAL_FLIP, iframeid++);
@@ -384,13 +451,46 @@ void* rvc_remote_videorender_func(void* arg)
 
 int rvc_start_video_render(rvc_video_render_t* prender, bool bremote, rvc_video_box_move_callback_t* cb)
 {
+	int errcode = -1;
+	if (NULL == prender) {
+		return errcode;
+	}
+
+#ifdef RVC_OS_WIN
+	prender->local_render_stop_event = CreateEventA(NULL, false, false, NULL);
+	if (NULL == prender->local_render_stop_event) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create local stop event failed!");
+		return Error_Resource;
+	}
+
+	prender->local_render_thread = (HANDLE)_beginthreadex(NULL, 0, rvc_videorender_func, prender, 0, NULL);
+	if (NULL == prender->local_render_thread) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create local video render thread failed.");
+		return Error_Resource;
+	}
+
+	if (bremote) {
+		prender->remote_render_stop_event = CreateEventA(NULL, false, false, NULL);
+		if (NULL == prender->local_render_stop_event) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create remote stop event failed!");
+			return Error_Resource;
+		}
+
+		prender->remote_render_thread = (HANDLE)_beginthreadex(NULL, 0, rvc_remote_videorender_func, prender, 0, NULL);
+		if (NULL == prender->remote_render_thread) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create remote video render thread failed.");
+			return Error_Resource;
+		}
+	}
+	errcode = 0;
+#else
 	if (0 != sem_init(&prender->local_render_stop_sem, 0, 0)) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create local stop sem failed!");
 		return Error_Resource;
 	}
 
-	int err = pthread_create(&prender->local_render_threadid, NULL, rvc_videorender_func, prender);
-	if (Error_Succeed != err) {
+	errcode = pthread_create(&prender->local_render_threadid, NULL, rvc_videorender_func, prender);
+	if (Error_Succeed != errcode) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create local video render thread failed.");
 		return Error_Resource;
 	}
@@ -401,14 +501,15 @@ int rvc_start_video_render(rvc_video_render_t* prender, bool bremote, rvc_video_
 			return Error_Resource;
 		}
 
-		err = pthread_create(&prender->remote_render_threadid, NULL, rvc_remote_videorender_func, prender);
-		if (Error_Succeed != err) {
+		errcode = pthread_create(&prender->remote_render_threadid, NULL, rvc_remote_videorender_func, prender);
+		if (Error_Succeed != errcode) {
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create remote video render thread failed.");
 			return Error_Resource;
 		}
 	}
+#endif // RVC_OS_WIN
 
-	return err;
+	return errcode;
 }
 
 
@@ -418,6 +519,17 @@ int rvc_stop_video_render(rvc_video_render_t* prender)
 		return Error_Param;
 	}
 
+#ifdef RVC_OS_WIN
+	if (prender->local_render_stop_event) {
+		SetEvent(prender->local_render_stop_event);
+	}
+	rvc_stop_remote_video_render(prender);
+	if (NULL != prender->local_render_thread) {
+		WaitForSingleObject(prender->local_render_thread, INFINITE);
+		CloseHandle(prender->local_render_thread);
+		prender->local_render_thread = NULL;
+	}
+#else
 	sem_post(&prender->local_render_stop_sem);
 	rvc_stop_remote_video_render(prender);
 	if (prender->local_render_threadid > 0) {
@@ -428,11 +540,21 @@ int rvc_stop_video_render(rvc_video_render_t* prender)
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("video render thread pthread join error for %s.", strerror(errno));
 		}
 	}
+#endif // RVC_OS_WIN
+
 	return Error_Succeed;
 }
 
 int rvc_stop_remote_video_render(rvc_video_render_t* prender)
 {
+#ifdef RVC_OS_WIN
+	if (NULL != prender->remote_render_thread) {
+		SetEvent(prender->remote_render_stop_event);
+		WaitForSingleObject(prender->remote_render_thread, INFINITE);
+		CloseHandle(prender->remote_render_thread);
+		prender->remote_render_thread = NULL;
+	}
+#else
 	if (prender->remote_render_threadid > 0) {
 		sem_post(&prender->remote_render_stop_sem);
 		if (0 == pthread_join(prender->remote_render_threadid, NULL)) {
@@ -442,6 +564,7 @@ int rvc_stop_remote_video_render(rvc_video_render_t* prender)
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("remote video render thread pthread join error for %s.", strerror(errno));
 		}
 	}
+#endif
 
 	return Error_Succeed;
 }

+ 20 - 3
Module/mod_sipphone/video_render.h

@@ -2,16 +2,30 @@
 
 #include "ivideorenderinterface.h"
 #ifdef _WIN32
+#include <windows.h>
+#include <process.h>
 #else
 #include<semaphore.h>
 #endif // _WIN32
 
 
-
 #ifndef MAX_PATH
 #define MAX_PATH 260
 #endif
 
+#ifndef rvc_snprintf
+#ifdef RVC_OS_WIN
+#define rvc_snprintf _snprintf
+#else
+#define rvc_snprintf snprintf
+#endif // RVC_OS_WIN
+#endif // rvc_snprintf
+
+enum eVideoRenderQueue {
+	ePreview_Queue,
+	eSnapshot_Queue
+};
+
 typedef struct rvc_video_box_move_callback_s {
 	void (*on_video_box_move)(int imessagetype, int ivideotype, int ileft, int ibottom, void* user_data);
 	void* user_data;
@@ -43,7 +57,7 @@ typedef struct rvc_video_render_params_s {
 	int iremote_move; 
 	int ilocal_fresh_time;
 	int iremote_fresh_time;
-	int ilocal_render_queue;
+	eVideoRenderQueue erender_queue;
 }rvc_video_render_params_t;
 
 
@@ -51,7 +65,10 @@ typedef struct rvc_video_render_s {
 	IVideoRender* plocal_render;
 	IVideoRender* premote_render;
 #ifdef _WIN32
-
+	HANDLE local_render_thread;
+	HANDLE local_render_stop_event;
+	HANDLE remote_render_thread;
+	HANDLE remote_render_stop_event;
 #else
 	pthread_t local_render_threadid;
 	sem_t local_render_stop_sem;

+ 1 - 1
Other/unix/libvideocapture/ivideocaptureinterface.h

@@ -128,7 +128,7 @@ typedef struct videocap_callback_s {
 	void (*onvideocapexcption)();
 #ifdef _WIN32
 #else
-	void (*logevent)(int itype, const char* strmessage);
+	void (*logevent)(int itype, int idevid, const char* strmessage);
 #endif
 	
 	void* user_data;

+ 1 - 1
Other/unix/libvideocapture/linux/videocapture_linux.cpp

@@ -1139,6 +1139,6 @@ void VideoCaptureImpl::CapLog(const char* fmt, ...)
 void VideoCaptureImpl::CapLogEvent(int itype, const char* strmessage)
 {
 	if (m_callback.logevent) {
-		(*m_callback.logevent)(itype, strmessage);
+		(*m_callback.logevent)(itype, m_deviceId, strmessage);
 	}
 }

+ 3 - 1
Other/win/libvideoframework/video_common/ffmpeg_api_cpp_adapter.h

@@ -1,8 +1,10 @@
 #ifndef __FFMPEG_API_CPP_ADAPTER_H__
 #define __FFMPEG_API_CPP_ADAPTER_H__
 
-
+#ifndef av_always_inline
 #define av_always_inline __inline
+#endif
+
 #define inline __inline
 
 #ifndef INT64_C

+ 4 - 3
Other/win/libvideoframework/video_common/videoutil.c

@@ -1,9 +1,9 @@
 #include "precompile.h"
 #include "videoutil.h"
 
-
 #include <malloc.h>
 
+
 int video_frame_alloc(int width, int height, int format, video_frame *frame)
 {
     if (!frame)
@@ -109,7 +109,8 @@ int video_frame_copy(video_frame *dst, video_frame *src)
     if (src->format == VIDEO_FORMAT_RGB24) {
         //memcpy(dst->data[0], src->data[0], src->width*src->height*3);
 		videohorflip_fast_copy(dst->data[0], src->data[0], src->width*src->height*3);
-    } else {
+    } 
+    else {
         videohorflip_fast_copy(dst->data[0], src->data[0], src->width*src->height);
         videohorflip_fast_copy(dst->data[1], src->data[1], src->width*src->height/4);
         videohorflip_fast_copy(dst->data[2], src->data[2], src->width*src->height/4);
@@ -205,7 +206,7 @@ int video_frame_save_bmpfile(const char*bmpfile, video_frame *frame)
     return 0;
 }
 
-video_frame *video_frame_new(int width, int height, int format)
+video_frame* video_frame_new(int width, int height, int format)
 {
 	video_frame *frm = (video_frame*)malloc(sizeof(video_frame));
 	int rc = video_frame_alloc(width, height, format, frm);

+ 59 - 31
Other/win/libvideoframework/videocap.cpp

@@ -40,13 +40,15 @@ int RGB24DataSize(int height, int stride_y, int stride_u, int stride_v) {
 	return stride_y * height * 2 + ((stride_u + stride_v) * ((height + 1) / 2) * 2);
 }
 
-static void capLogEvent(videocap_param *cap, int itype, const char* strmessage)
+
+static void capLogEvent(videocap_param *cap, int ilogtype, const char* strmessage)
 {
 	if (cap->logevent) {
-		(*cap->logevent)(itype, strmessage);
+		(*cap->logevent)(ilogtype, cap->dev_id, strmessage);
 	}
 }
 
+
 static void i420_flip_vertical(video_frame *frame)
 {
 	if (frame->format == VIDEO_FORMAT_I420) {
@@ -61,6 +63,7 @@ static void i420_flip_vertical(video_frame *frame)
 	}
 }
 
+
 static HRESULT AddToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)
 {
     IMoniker * pMoniker;
@@ -1038,18 +1041,6 @@ static HRESULT STDMETHODCALLTYPE BufferCB(ISampleGrabberCB * This, double Sample
 }
 
 
-//static ISampleGrabberCB* CreateISampleGrabberCBImpl(videocap *vcap)
-//{
-//    ISampleGrabberCBImpl *pImpl = 
-//        (ISampleGrabberCBImpl*)malloc(sizeof(ISampleGrabberCBImpl));
-//    if (pImpl) {
-//        pImpl->pCb->BufferCB = &RvcBufferCB;
-//        pImpl->pCb->SampleCB = &RvcSampleCB;
-//        pImpl->vcap = vcap;
-//    }
-//    return (ISampleGrabberCB*)pImpl;
-//}
-
 static HRESULT TryConnectFilters(IGraphBuilder *pGraphBuilder, int cnt, IBaseFilter *pFilters[])
 {
 	HRESULT hr = S_OK;
@@ -1240,6 +1231,47 @@ void videocap_destroy(videocap_t h)
     free(h);
 }
 
+//100 to real brightness value
+static int transtorealbrightnessvalue(int ibright, int imaxbrightness, int iminbrightness)
+{
+	float fvalue = ibright * (imaxbrightness - iminbrightness) / 10;
+	int ivalue = fvalue;
+	int ilast = ivalue % 10;
+	int inum = ivalue / 10;
+	if (ilast >= 5) {
+		inum++;
+	}
+
+	inum += iminbrightness;
+
+	if (inum < iminbrightness) {
+		inum = iminbrightness;
+	}
+
+	if (inum > imaxbrightness) {
+		inum = imaxbrightness;
+	}
+
+	return inum;
+}
+
+
+//real brightness value to [0-100]
+static int transfromrealbrightnessvalue(int ibright, int imaxbrightness, int iminbrightness)
+{
+	int itotal = imaxbrightness - iminbrightness;
+	int ivalue = ibright - iminbrightness;
+	float fvalue = ivalue * 1000 / itotal;
+	ivalue = fvalue;
+	int ilast = ivalue % 10;
+	int inum = ivalue / 10;
+	if (ilast >= 5) {
+		inum++;
+	}
+
+	return inum;
+}
+
 
 int videocap_adj_brightness(videocap_t h, int nValue)
 {
@@ -1253,23 +1285,18 @@ int videocap_adj_brightness(videocap_t h, int nValue)
 	{
 		long Min, Max, Step, Default, Flags, Val;
 		// 亮度. 
-		if(( nValue > 0 )&&(nValue < 100 ))
+		if(( nValue >= 0 )&&(nValue <= 100 ))
 		{
 			hr = pProcAmp->GetRange(VideoProcAmp_Brightness, &Min, &Max, &Step,
 				&Default, &Flags);
 			if(SUCCEEDED(hr))
 			{
 				Flags = VideoProcAmp_Flags_Manual;
+
 				hr = pProcAmp->Get(VideoProcAmp_Brightness, &Val, &Flags);
-				Val = ((Max-Min)*nValue/100)+Min;
-				if (Val>Max)
-				{
-					Val = Max;
-				}
-				else if (Val<Min)
-				{
-					Val = Min;
-				}
+
+				Val = transtorealbrightnessvalue((int)nValue, (int)Max, (int)Min);
+
 				hr = pProcAmp->Set(VideoProcAmp_Brightness, Val, Flags);
 			}
 		}
@@ -1313,12 +1340,11 @@ int videocap_get_brightness(videocap_t h,int*nValue)
 	{
 		long Min, Max, Step, Default, Flags, Val;
 		// 亮度. 
-		hr = pProcAmp->GetRange(VideoProcAmp_Brightness, &Min, &Max, &Step,
-			&Default, &Flags);
+		hr = pProcAmp->GetRange(VideoProcAmp_Brightness, &Min, &Max, &Step, &Default, &Flags);
 		if(SUCCEEDED(hr))
 		{
 			hr = pProcAmp->Get(VideoProcAmp_Brightness, &Val, &Flags);
-			*nValue = (Val-Min)*100/(Max-Min);
+			*nValue = transfromrealbrightnessvalue((int)Val, (int)Max, (int)Min);
 		}
 	}
 	return hr;
@@ -1865,7 +1891,7 @@ HRESULT get_output_mediatype(videocap *vcap)
 	vcap->iout_width = videoHeader->bmiHeader.biWidth;
 	vcap->iout_height = videoHeader->bmiHeader.biHeight;
 
-	if (mode_width[vcap->param.cap_mode] != videoHeader->bmiHeader.biWidth || mode_height[vcap->param.cap_mode] != videoHeader->bmiHeader.biHeight) {
+	if ((mode_width[vcap->param.cap_mode] != videoHeader->bmiHeader.biWidth) || (mode_height[vcap->param.cap_mode] != videoHeader->bmiHeader.biHeight)) {
 		char* subtype_str = NULL;
 		char strmsg[MAX_PATH * 2] = { 0 };
 		subtype_str = GuidToString(mt.subtype);
@@ -1882,11 +1908,13 @@ HRESULT get_output_mediatype(videocap *vcap)
 			mt.lSampleSize,
 			mt.bFixedSizeSamples,
 			mt.bTemporalCompression);
-		capLogEvent(&vcap->param, 2, strmsg);
+		capLogEvent(&vcap->param, 1, strmsg);
+
+		if ((mode_width[vcap->param.cap_mode] != videoHeader->bmiHeader.biWidth) && (mode_height[vcap->param.cap_mode] != videoHeader->bmiHeader.biHeight)) {
+			capLogEvent(&vcap->param, 3, strmsg);
+		}
 	}
 	
-
-
 	return S_OK;
 }
 

+ 1 - 1
Other/win/libvideoframework/videocap.h

@@ -146,7 +146,7 @@ typedef struct videocap_param
 	/* after grab */
 	void (*on_grab)(void *user_data, video_frame *frame);
 	void (*dbg)(const char *fmt, va_list arg);
-	void (*logevent)(int itype, const char* strmessage);
+	void (*logevent)(int itype, int idevid, const char* strmessage);
     void *user_data;
 
     int option; /* combination of VIDEOCAP_OPT_ xxx */