From c38c7fe42fc20c5a5330e789db1a0650dc0ad694 Mon Sep 17 00:00:00 2001 From: Barry <870709864@qq.com> Date: Sun, 18 Nov 2018 21:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=A7=A3=E7=A0=81=E5=99=A8?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtScrcpy/decoder/decoder.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/QtScrcpy/decoder/decoder.cpp b/QtScrcpy/decoder/decoder.cpp index 8d0407e..aabd391 100644 --- a/QtScrcpy/decoder/decoder.cpp +++ b/QtScrcpy/decoder/decoder.cpp @@ -56,10 +56,17 @@ qint32 Decoder::recvData(quint8* buf, qint32 bufSize) if (!buf) { return 0; } - if (m_deviceSocket) { - return m_deviceSocket->recvData(buf, bufSize); - } - return 0; + if (m_deviceSocket) { + qint32 len = m_deviceSocket->recvData(buf, bufSize); + if (len == -1) { + return AVERROR(errno); + } + if (len == 0) { + return AVERROR_EOF; + } + return len; + } + return AVERROR_EOF; } bool Decoder::startDecode()