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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
AlgorithmTaskManage.h
+3
-0
CameraHandle.cpp
+10
-6
CameraHandle.h
+6
-4
No files found.
AlgorithmTaskManage.h
View file @
dd5b951a
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <vector>
#include <vector>
#include <opencv2/opencv.hpp>
#include <opencv2/opencv.hpp>
#include <mutex>
#include <mutex>
#include <condition_variable>
class
AlgorithmTaskManage
{
class
AlgorithmTaskManage
{
public
:
public
:
AlgorithmTaskManage
();
AlgorithmTaskManage
();
...
@@ -90,6 +91,7 @@ private:
...
@@ -90,6 +91,7 @@ private:
selected
->
setIsRunning
(
true
);
// 立刻标记为正在运行
selected
->
setIsRunning
(
true
);
// 立刻标记为正在运行
return
selected
;
return
selected
;
}
}
template
<
typename
T
>
template
<
typename
T
>
void
resetSemaphoreAndClearObjects
(
Common
&
instance
,
QSemaphore
*&
semaphore
,
std
::
vector
<
T
*>&
containers
,
int
len
)
{
void
resetSemaphoreAndClearObjects
(
Common
&
instance
,
QSemaphore
*&
semaphore
,
std
::
vector
<
T
*>&
containers
,
int
len
)
{
if
(
semaphore
!=
nullptr
)
{
if
(
semaphore
!=
nullptr
)
{
...
@@ -107,6 +109,7 @@ private:
...
@@ -107,6 +109,7 @@ private:
instance
.
deleteObj
(
semaphore
);
instance
.
deleteObj
(
semaphore
);
}
}
}
}
static
AlgorithmTaskManage
*
instance
;
static
AlgorithmTaskManage
*
instance
;
std
::
vector
<
HumanDetection
*>
humanDetections
;
std
::
vector
<
HumanDetection
*>
humanDetections
;
...
...
CameraHandle.cpp
View file @
dd5b951a
...
@@ -23,18 +23,23 @@ CameraHandle::CameraHandle(QString &url, QString &httpUrl, QString &sSn, int &ch
...
@@ -23,18 +23,23 @@ CameraHandle::CameraHandle(QString &url, QString &httpUrl, QString &sSn, int &ch
devConfig
(
devConfig
)
devConfig
(
devConfig
)
{
{
connect
(
this
,
SIGNAL
(
afterDownloadFile
(
int
,
int
,
QString
)),
this
,
SLOT
(
pushRecordToCloud
(
int
,
int
,
QString
)),
Qt
::
QueuedConnection
);
connect
(
this
,
SIGNAL
(
afterDownloadFile
(
int
,
int
,
QString
)),
this
,
SLOT
(
pushRecordToCloud
(
int
,
int
,
QString
)),
Qt
::
QueuedConnection
);
faceMapWorker
.
setX
(
0
);
faceMapWorker
.
setX
(
0
);
faceMapWorker
.
setY
(
0
);
faceMapWorker
.
setY
(
0
);
}
}
CameraHandle
::~
CameraHandle
()
{
CameraHandle
::~
CameraHandle
()
{
stopRequested_
=
true
;
semaphore
.
acquire
();
Common
&
instace
=
Common
::
getInstance
();
Common
&
instace
=
Common
::
getInstance
();
dev_snap_syn_timer
->
stop
();
dev_snap_syn_timer
->
stop
();
QThreadPool
::
globalInstance
()
->
waitForDone
();
ScopeSemaphoreExit
guard
([
this
]()
{
semaphore
.
release
();
// 释放信号量
});
instace
.
deleteObj
(
dev_snap_syn_timer
);
instace
.
deleteObj
(
dev_snap_syn_timer
);
instace
.
deleteObj
(
loginParam
);
instace
.
deleteObj
(
loginParam
);
instace
.
deleteObj
(
sxMediaFaceImageReq
);
instace
.
deleteObj
(
sxMediaFaceImageReq
);
...
@@ -362,7 +367,6 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
...
@@ -362,7 +367,6 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
}
}
int
CameraHandle
::
callbackFunction
(
XSDK_HANDLE
hObject
,
QString
&
szString
)
{
int
CameraHandle
::
callbackFunction
(
XSDK_HANDLE
hObject
,
QString
&
szString
)
{
if
(
stopRequested_
)
return
-
1
;
if
(
!
semaphore
.
tryAcquire
())
{
if
(
!
semaphore
.
tryAcquire
())
{
qInfo
()
<<
sSn
<<
"sdkDevSnapSyn:正在执行线程"
;
qInfo
()
<<
sSn
<<
"sdkDevSnapSyn:正在执行线程"
;
...
@@ -408,7 +412,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
...
@@ -408,7 +412,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
}
}
void
CameraHandle
::
sdkDevSnapSyn
(
XSDK_HANDLE
hDevice
,
int
nChannel
){
void
CameraHandle
::
sdkDevSnapSyn
(
XSDK_HANDLE
hDevice
,
int
nChannel
){
if
(
stopRequested_
)
return
;
if
(
hDevice
<=
0
){
if
(
hDevice
<=
0
){
qInfo
()
<<
"相机断线"
;
qInfo
()
<<
"相机断线"
;
return
;
return
;
...
...
CameraHandle.h
View file @
dd5b951a
...
@@ -25,20 +25,22 @@
...
@@ -25,20 +25,22 @@
#include <memory>
#include <memory>
#include <functional>
#include <functional>
#include <QString>
#include <QString>
#include <QObject>
#include <QTimer>
#include <QTimer>
#include <QThreadPool>
#include <QThreadPool>
#include <QQueue>
#include <QQueue>
#include <opencv2/opencv.hpp>
#include <opencv2/opencv.hpp>
#include <QSemaphore>
#include <QSemaphore>
#include <atomic>
#include <atomic>
enum
CAR_INFORMATION
{
enum
CAR_INFORMATION
{
Exit
,
//出场
Exit
,
//出场
Mobilization
,
//进场
Mobilization
,
//进场
ExitAndMobilization
//
ExitAndMobilization
//
};
};
class
CameraHandle
:
public
QObject
{
class
CameraHandle
:
public
QObject
{
Q_OBJECT
Q_OBJECT
public
:
public
:
CameraHandle
(
QString
&
url
,
QString
&
httpUrl
,
QString
&
sSn
,
int
&
channel
,
int
imageSave
,
CameraHandle
(
QString
&
url
,
QString
&
httpUrl
,
QString
&
sSn
,
int
&
channel
,
int
imageSave
,
float
&
heightReference
,
vides_data
::
responseConfig
&
devConfig
);
float
&
heightReference
,
vides_data
::
responseConfig
&
devConfig
);
...
@@ -145,6 +147,7 @@ public:
...
@@ -145,6 +147,7 @@ public:
int
findPointRegion
(
ParkingSpaceInfo
&
prakArea
);
int
findPointRegion
(
ParkingSpaceInfo
&
prakArea
);
int
determineArea
(
ParkingSpaceInfo
&
prakArea
);
int
determineArea
(
ParkingSpaceInfo
&
prakArea
);
signals
:
signals
:
void
callbackFrameReady
(
const
cv
::
Mat
&
frame
,
const
QString
&
url
);
void
callbackFrameReady
(
const
cv
::
Mat
&
frame
,
const
QString
&
url
);
...
@@ -159,8 +162,7 @@ private :
...
@@ -159,8 +162,7 @@ private :
int
hDevice
;
int
hDevice
;
int
channel
;
int
channel
;
QString
httpUrl
;
QString
httpUrl
;
bool
stopRequested_
=
false
;
SXSDKLoginParam
*
loginParam
;
SXSDKLoginParam
*
loginParam
;
SXMediaFaceImageReq
*
sxMediaFaceImageReq
;
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