Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gamera_videos_no_ui
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liusq
gamera_videos_no_ui
Commits
dd5b951a
Commit
dd5b951a
authored
Aug 06, 2024
by
“liusq”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取消等待线程池执行完
parent
9a1411ee
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
AlgorithmTaskManage.h
+3
-0
CameraHandle.cpp
+8
-4
CameraHandle.h
+5
-3
No files found.
AlgorithmTaskManage.h
View file @
dd5b951a
...
...
@@ -12,6 +12,7 @@
#include <vector>
#include <opencv2/opencv.hpp>
#include <mutex>
#include <condition_variable>
class
AlgorithmTaskManage
{
public
:
AlgorithmTaskManage
();
...
...
@@ -90,6 +91,7 @@ private:
selected
->
setIsRunning
(
true
);
// 立刻标记为正在运行
return
selected
;
}
template
<
typename
T
>
void
resetSemaphoreAndClearObjects
(
Common
&
instance
,
QSemaphore
*&
semaphore
,
std
::
vector
<
T
*>&
containers
,
int
len
)
{
if
(
semaphore
!=
nullptr
)
{
...
...
@@ -107,6 +109,7 @@ private:
instance
.
deleteObj
(
semaphore
);
}
}
static
AlgorithmTaskManage
*
instance
;
std
::
vector
<
HumanDetection
*>
humanDetections
;
...
...
CameraHandle.cpp
View file @
dd5b951a
...
...
@@ -30,11 +30,16 @@ CameraHandle::CameraHandle(QString &url, QString &httpUrl, QString &sSn, int &ch
}
CameraHandle
::~
CameraHandle
()
{
stopRequested_
=
true
;
semaphore
.
acquire
();
Common
&
instace
=
Common
::
getInstance
();
dev_snap_syn_timer
->
stop
();
QThreadPool
::
globalInstance
()
->
waitForDone
();
ScopeSemaphoreExit
guard
([
this
]()
{
semaphore
.
release
();
// 释放信号量
});
instace
.
deleteObj
(
dev_snap_syn_timer
);
instace
.
deleteObj
(
loginParam
);
instace
.
deleteObj
(
sxMediaFaceImageReq
);
...
...
@@ -362,7 +367,6 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
}
int
CameraHandle
::
callbackFunction
(
XSDK_HANDLE
hObject
,
QString
&
szString
)
{
if
(
stopRequested_
)
return
-
1
;
if
(
!
semaphore
.
tryAcquire
())
{
qInfo
()
<<
sSn
<<
"sdkDevSnapSyn:正在执行线程"
;
...
...
@@ -408,7 +412,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
}
void
CameraHandle
::
sdkDevSnapSyn
(
XSDK_HANDLE
hDevice
,
int
nChannel
){
if
(
stopRequested_
)
return
;
if
(
hDevice
<=
0
){
qInfo
()
<<
"相机断线"
;
return
;
...
...
CameraHandle.h
View file @
dd5b951a
...
...
@@ -25,20 +25,22 @@
#include <memory>
#include <functional>
#include <QString>
#include <QObject>
#include <QTimer>
#include <QThreadPool>
#include <QQueue>
#include <opencv2/opencv.hpp>
#include <QSemaphore>
#include <atomic>
enum
CAR_INFORMATION
{
Exit
,
//出场
Mobilization
,
//进场
ExitAndMobilization
//
};
class
CameraHandle
:
public
QObject
{
class
CameraHandle
:
public
QObject
{
Q_OBJECT
public
:
CameraHandle
(
QString
&
url
,
QString
&
httpUrl
,
QString
&
sSn
,
int
&
channel
,
int
imageSave
,
float
&
heightReference
,
vides_data
::
responseConfig
&
devConfig
);
...
...
@@ -145,6 +147,7 @@ public:
int
findPointRegion
(
ParkingSpaceInfo
&
prakArea
);
int
determineArea
(
ParkingSpaceInfo
&
prakArea
);
signals
:
void
callbackFrameReady
(
const
cv
::
Mat
&
frame
,
const
QString
&
url
);
...
...
@@ -159,7 +162,6 @@ private :
int
hDevice
;
int
channel
;
QString
httpUrl
;
bool
stopRequested_
=
false
;
SXSDKLoginParam
*
loginParam
;
SXMediaFaceImageReq
*
sxMediaFaceImageReq
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment