Jelajahi Sumber

Z991239-5381 #comment 优化交易录像取视频帧流程

80274480 1 tahun lalu
induk
melakukan
655c020085

+ 6 - 4
Other/unix/libvideorecord/libvideorecord_impl.cpp

@@ -1022,7 +1022,7 @@ bool libvideorecord_impl::GetVideoFrame(video_frame* Video, int flags, Clibvideo
 int libvideorecord_impl::GetDestTypeVideoFrameData(videoq_frame* Video, int flags, const bool bSwitchCam, int iInitCam, eRvcRecordType eRecordType)
 {
 	int iRet = 0;
-	if (m_opt_videoqueue && m_opt_videoqueue->GetVideoLens() > 0) {
+	if (m_opt_videoqueue) {
 		iRet = GetDoubleCameraVideoFrameData(Video, flags, bSwitchCam, iInitCam, eRecordType);
 	}
 	else {
@@ -1075,6 +1075,7 @@ int libvideorecord_impl::GetStand2SVideoFrameData(videoq_frame* Video, int flags
 	}
 	//将大机摄像头和远端视频拼接到一张画布中
 	memset(Video->data, 0, Video->framesize);
+
 	bool bRslt = false;
 	int width = 0;
 	int height = 0;
@@ -1192,16 +1193,17 @@ int libvideorecord_impl::GetStand2SVideoFrameData(videoq_frame* Video, int flags
 int libvideorecord_impl::GetSingleSideVideoFrameData(videoq_frame* Video, int flags, const bool bSwitchCam, int iInitCam)
 {
 	bool bRslt = false;
+	int iwidth = 0;
+	int iheight = 0;
+	m_env_videoqueue->GetFrameSize(iwidth, iheight);
+
 	memset(Video->data, 0, Video->framesize);
 	int nActiveCam = iInitCam;
 	if (bSwitchCam) {
 		nActiveCam = m_pHostApi->GetActiveCamera();
 	}
 
-	int iwidth = 0;
-	int iheight = 0;
 	if (0 == nActiveCam) {			// get env snapshot
-		m_env_videoqueue->GetFrameSize(iwidth, iheight);
 		videoq_frame* tmp_frm = new videoq_frame;
 		if (!m_SubtitleParam.bSubtitle || !m_SubtitleParam.bSubtitleSection) {
 			tmp_frm->data = Video->data + Video->width * (iwidth - iheight) / 2 * 3;

+ 4 - 4
Other/win/libvideorecord/libvideorecord_impl.cpp

@@ -958,7 +958,7 @@ bool libvideorecord_impl::GetVideoFrame(video_frame* Video, int flags, Clibvideo
 int libvideorecord_impl::GetDestTypeVideoFrameData(videoq_frame* Video, int flags, const bool bSwitchCam, int iInitCam, eRvcRecordType eRecordType)
 {
 	int iRet = 0;
-	if (m_opt_videoqueue && m_opt_videoqueue->GetVideoLens() > 0) {  
+	if (m_opt_videoqueue) {  
 		iRet = GetDoubleCameraVideoFrameData(Video, flags, bSwitchCam, iInitCam, eRecordType);
 	}
 	else {
@@ -1113,6 +1113,9 @@ int libvideorecord_impl::GetStand2SVideoFrameData(videoq_frame* Video, int flags
 int libvideorecord_impl::GetSingleSideVideoFrameData(videoq_frame* Video, int flags, const bool bSwitchCam, int iInitCam)
 {
 	bool bRslt = false;
+	int iwidth = 0;
+	int iheight = 0;
+	m_env_videoqueue->GetFrameSize(iwidth, iheight);
 	memset(Video->data, 0, Video->framesize);
 
 	int nActiveCam = iInitCam;
@@ -1120,10 +1123,7 @@ int libvideorecord_impl::GetSingleSideVideoFrameData(videoq_frame* Video, int fl
 		nActiveCam = m_pHostApi->GetActiveCamera();
 	}
 
-	int iwidth = 0;
-	int iheight = 0;
 	if (0 == nActiveCam) {			// get env snapshot
-		m_env_videoqueue->GetFrameSize(iwidth, iheight);
 		videoq_frame* tmp_frm = new videoq_frame;
 		if (!m_SubtitleParam.bSubtitle || !m_SubtitleParam.bSubtitleSection) {
 			tmp_frm->data = Video->data + Video->width * (iwidth - iheight) / 2 * 3;