mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Warn on failed frame maping
This commit is contained in:
parent
f5793b0db8
commit
a9b76253af
|
@ -13,9 +13,10 @@ AudioBuffer::~AudioBuffer()
|
|||
|
||||
qint64 AudioBuffer::readData(char *data, qint64 len)
|
||||
{
|
||||
qint64 total;
|
||||
bufferMutex.lock();
|
||||
try {
|
||||
const qint64 total = qMin((qint64)buffer.size(), len);
|
||||
total = qMin((qint64)buffer.size(), len);
|
||||
memcpy(data, buffer.constData(), total);
|
||||
buffer = buffer.mid(total);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,11 @@ bool Camera::start(const QVideoSurfaceFormat &format)
|
|||
bool Camera::present(const QVideoFrame &frame)
|
||||
{
|
||||
QVideoFrame frameMap(frame); // Basically a const_cast because shallow copies
|
||||
frameMap.map(QAbstractVideoBuffer::ReadOnly);
|
||||
if (!frameMap.map(QAbstractVideoBuffer::ReadOnly))
|
||||
{
|
||||
qWarning() << "Camera::present: Unable to map frame";
|
||||
return false;
|
||||
}
|
||||
int w = frameMap.width(), h = frameMap.height();
|
||||
int bpl = frameMap.bytesPerLine(), size = frameMap.mappedBytes();
|
||||
QVideoFrame frameCopy(size, QSize(w, h), bpl, frameMap.pixelFormat());
|
||||
|
|
Loading…
Reference in New Issue
Block a user