mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 03:25:02 +00:00
feat: change qt atomic to std::atomic
This commit is contained in:
parent
88874c9693
commit
bbb758e684
2 changed files with 5 additions and 6 deletions
|
@ -16,7 +16,7 @@ typedef qint32 (*ReadPacketFunc)(void*, quint8*, qint32);
|
|||
Stream::Stream(QObject *parent)
|
||||
: QThread(parent)
|
||||
{
|
||||
m_quit.store(0);
|
||||
m_quit = false;
|
||||
}
|
||||
|
||||
Stream::~Stream()
|
||||
|
@ -227,14 +227,14 @@ bool Stream::startDecode()
|
|||
if (!m_videoSocket) {
|
||||
return false;
|
||||
}
|
||||
m_quit.store(0);
|
||||
m_quit = false;
|
||||
start();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Stream::stopDecode()
|
||||
{
|
||||
m_quit.store(1);
|
||||
m_quit = true;
|
||||
if (m_decoder) {
|
||||
m_decoder->interrupt();
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ void Stream::run()
|
|||
packet.size = 0;
|
||||
|
||||
while (!av_read_frame(formatCtx, &packet)) {
|
||||
if (m_quit.load()) {
|
||||
if (m_quit) {
|
||||
// if the stream is stopped, the socket had been shutdown, so the
|
||||
// last packet is probably corrupted (but not detected as such by
|
||||
// FFmpeg) and will not be decoded correctly
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <QThread>
|
||||
#include <QPointer>
|
||||
#include <QMutex>
|
||||
#include <QAtomicInteger>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -53,7 +52,7 @@ protected:
|
|||
|
||||
private:
|
||||
QPointer<VideoSocket> m_videoSocket;
|
||||
QAtomicInteger<qint8> m_quit;
|
||||
std::atomic_bool m_quit;
|
||||
|
||||
// for recorder
|
||||
Recorder* m_recorder = Q_NULLPTR;
|
||||
|
|
Loading…
Add table
Reference in a new issue