Prechádzať zdrojové kódy

Revert "Z991239-5945 #comment 优化摄像头分辨率不符合应用要求处理逻辑"

This reverts commit a1a3e571e48e96c69d4104437406856b9c92b208.
80274480 8 mesiacov pred
rodič
commit
70f86ece75

+ 3 - 11
Module/mod_mediacontroller/capture.cpp

@@ -48,16 +48,8 @@ static void __dbg(const char *fmt, va_list arg)
 	}
 }
 
-static void handle_no_matched_resolution_evt(void* user_data, int idevid) 
-{
-	video_capture_t* video_cap = (video_capture_t*)user_data;
-	if (NULL != video_cap) {
-		capture_t* cap = video_cap->parent;
-		cap->config.capevent(cap->config.user_data, idevid);
-	}
-}
 
-static void __logevent(void* user_data, int ilogtype, int idevid, const char* strmessage)
+static void __logevent(int ilogtype, int idevid, const char* strmessage)
 {
 	if (0 == ilogtype){
 		LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_CAMERA_MATCHED_FORMAT, strmessage);
@@ -69,8 +61,8 @@ static void __logevent(void* user_data, int ilogtype, int idevid, const char* st
 		LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_CAMOPEN_FAILED_INFO, strmessage);
 	}
 	else if (3 == ilogtype) {
-		handle_no_matched_resolution_evt(user_data, idevid);
-		LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_NOMATCHED_RESOLUTION, strmessage);
+		LogEvent(Severity_Middle, LOG_EVT_MEDIACONTROLLER_NOMATCHED_RESOLUTION, CSimpleStringA::Format("%d", idevid).GetData());
+
 	}
 	else{
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unknown type event.");

+ 2 - 4
Module/mod_mediacontroller/capture.h

@@ -83,8 +83,6 @@ namespace MediaController {
 		pthread_mutex_t* opt_mutex;
 		pthread_mutex_t* envopt_mutex;
 #endif
-		void (*capevent)(void* user_data, int ierrdevid);
-		void* user_data;
 	}capture_config_t;
 
 
@@ -174,11 +172,11 @@ namespace MediaController {
 	};
 
 	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);
+	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, bool bstartaudio = true);
 	ErrorCodeEnum start_audio_capture(audio_capture_t *paudio);
-	ErrorCodeEnum capture_start(capture_t *cap, int nCamera);
+	ErrorCodeEnum capture_start(capture_t *cap,int nCamera);
 	void capture_stop(capture_t *cap);
 	int capture_lib_init(int* ivideonum);
 

+ 39 - 41
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -81,12 +81,6 @@ static void __audiomgrlog(void* user_data, const char* fmt, va_list arg)
 }
 #endif
 
-static void __capevent(void* user_data, int ierrdevid)
-{
-	CMediaControllerEntity* pEntity = (CMediaControllerEntity*)user_data;
-	pEntity->UpdateCameraState(ierrdevid);
-}
-
 static int GetFormatString(char* strVala, size_t uValaLen, char* strValb, size_t uValbLen, const char* pSrc, size_t uSrcLen, char cWord)
 {
 	int iRet = -1;
@@ -212,7 +206,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);
@@ -228,6 +222,7 @@ 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);
 }
@@ -1655,6 +1650,43 @@ 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")("上摄像分辨率不符合要求");
+				if (eStand1SPlusType == m_eDeviceType) {
+					m_nCameraErrorCode = Error_AllCamera;
+				}
+				else {
+					if (m_nCameraErrorCode == Error_Succeed) {
+						m_nCameraErrorCode = Error_EnvCamera;
+					}
+					else if (m_nCameraErrorCode == Error_OptCamera) {
+						m_nCameraErrorCode = Error_AllCamera;
+					}
+				}
+				ChangeSysvar(m_nCameraErrorCode);
+			}
+			else if(idevid == capture_get_video_device_id(conf.strVideoOpt)){
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V3").setResultCode("RTA2810")("下摄像分辨率不符合要求");
+				if (m_nCameraErrorCode == Error_Succeed){
+					m_nCameraErrorCode = Error_OptCamera;
+				}
+				else if (m_nCameraErrorCode == Error_EnvCamera){
+					m_nCameraErrorCode = Error_AllCamera;
+				}
+				ChangeSysvar(m_nCameraErrorCode);
+			}
+			else {
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("no mathed device id.");
+			}
+		}
+	}
+	break;
+
 	default:
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unknown event.");
 		break;
@@ -1770,8 +1802,6 @@ ErrorCodeEnum CMediaControllerEntity::StartCamera(bool bstartaudio)
 		conf.envopt_mutex = &m_envopt_mutex;
 #endif
 		conf.uintervaltime = m_interValTime;
-		conf.capevent = &__capevent;
-		conf.user_data = this;
 		Error = (ErrorCodeEnum)capture_create(&conf, &m_capture, bstartaudio);
 		if (Error == Error_Succeed) 
 		{
@@ -2306,38 +2336,6 @@ bool CMediaControllerEntity::IsOnlineState()
 	return bret;
 }
 
-void CMediaControllerEntity::UpdateCameraState(int ierrdevid)
-{
-	if (ierrdevid == capture_get_video_device_id(conf.strVideoEnv)) {
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V3").setResultCode("RTA2810")("上摄像分辨率不符合要求");
-		if (eStand1SPlusType == m_eDeviceType) {
-			m_nCameraErrorCode = Error_AllCamera;
-		}
-		else {
-			if (m_nCameraErrorCode == Error_Succeed) {
-				m_nCameraErrorCode = Error_EnvCamera;
-			}
-			else if (m_nCameraErrorCode == Error_OptCamera) {
-				m_nCameraErrorCode = Error_AllCamera;
-			}
-		}
-		ChangeSysvar(m_nCameraErrorCode);
-	}
-	else if (ierrdevid == capture_get_video_device_id(conf.strVideoOpt)) {
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V3").setResultCode("RTA2810")("下摄像分辨率不符合要求");
-		if (m_nCameraErrorCode == Error_Succeed) {
-			m_nCameraErrorCode = Error_OptCamera;
-		}
-		else if (m_nCameraErrorCode == Error_EnvCamera) {
-			m_nCameraErrorCode = Error_AllCamera;
-		}
-		ChangeSysvar(m_nCameraErrorCode);
-	}
-	else {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("no mathed device id.");
-	}
-}
-
 ChannelMediaControllerClient::ChannelMediaControllerClient( CMediaControllerEntity *pEntity ) : ChannelService_ClientBase(pEntity)
 {
 

+ 0 - 1
Module/mod_mediacontroller/mod_mediacontroller.h

@@ -143,7 +143,6 @@ public:
 	void SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx);
 	ErrorCodeEnum PostCameraBrightnessInfos(int iBrightness);
 	bool IsOnlineState();
-	void UpdateCameraState(int ierrdevid);
 
 public:
 	DeviceTypeEnum m_eDeviceType;

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

@@ -128,7 +128,7 @@ typedef struct videocap_callback_s {
 	void (*onvideocapexcption)();
 #ifdef _WIN32
 #else
-	void (*logevent)(void* user_data, int ilogtype, int idevid, 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)(m_callback.user_data, itype, m_deviceId, strmessage);
+		(*m_callback.logevent)(itype, m_deviceId, strmessage);
 	}
 }

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

@@ -44,7 +44,7 @@ int RGB24DataSize(int height, int stride_y, int stride_u, int stride_v) {
 static void capLogEvent(videocap_param *cap, int ilogtype, const char* strmessage)
 {
 	if (cap->logevent) {
-		(*cap->logevent)(cap->user_data, ilogtype, cap->dev_id, strmessage);
+		(*cap->logevent)(ilogtype, cap->dev_id, strmessage);
 	}
 }
 

+ 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)(void* user_data, int ilogtype, int idevid, const char* strmessage);
+	void (*logevent)(int itype, int idevid, const char* strmessage);
     void *user_data;
 
     int option; /* combination of VIDEOCAP_OPT_ xxx */