summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-05-12 16:13:25 +0200
committerLars Knoll <lars.knoll@qt.io>2021-05-18 08:44:01 +0000
commite6800008635d992ad0339048729f6b452b3bc10d (patch)
treebe93f25c29db356c5a3861912bb66a9e4067bf95 /src/multimedia
parentabb3d5589cdb640527e2ab4cd01d7845984c0305 (diff)
Fix a crash in QGstAppSrc when using pull mode
In this case m_stream is a nullptr, make sure we never access it. Change-Id: I095d18fc99a60bc9b5cd9fe1bc33b7879f109c8a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/platform/gstreamer/common/qgstappsrc.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/multimedia/platform/gstreamer/common/qgstappsrc.cpp b/src/multimedia/platform/gstreamer/common/qgstappsrc.cpp
index 2cf33fbce..801db5aff 100644
--- a/src/multimedia/platform/gstreamer/common/qgstappsrc.cpp
+++ b/src/multimedia/platform/gstreamer/common/qgstappsrc.cpp
@@ -167,10 +167,10 @@ void QGstAppSrc::pushData()
if (m_appSrc.isNull() || !m_dataRequestSize)
return;
- qCDebug(qLcAppSrc) << "pushData" << m_stream << m_stream->atEnd() << m_buffer.size();
+ qCDebug(qLcAppSrc) << "pushData" << (m_stream ? m_stream : nullptr) << m_buffer.size();
if ((m_stream && m_stream->atEnd())) {
eosOrIdle();
- qCDebug(qLcAppSrc) << "end pushData" << m_stream << m_stream->atEnd() << m_buffer.size();
+ qCDebug(qLcAppSrc) << "end pushData" << (m_stream ? m_stream : nullptr) << m_buffer.size();
return;
}
@@ -183,11 +183,11 @@ void QGstAppSrc::pushData()
if (!m_dataRequestSize)
m_dataRequestSize = m_maxBytes;
size = qMin(size, (qint64)m_dataRequestSize);
- qCDebug(qLcAppSrc) << " reading" << size << "bytes" << m_stream->bytesAvailable() << m_dataRequestSize;
+ qCDebug(qLcAppSrc) << " reading" << size << "bytes" << size << m_dataRequestSize;
GstBuffer* buffer = gst_buffer_new_and_alloc(size);
- if (m_sequential && m_stream)
+ if (m_sequential || !m_stream)
buffer->offset = bytesReadSoFar;
else
buffer->offset = m_stream->pos();
@@ -218,7 +218,7 @@ void QGstAppSrc::pushData()
if (bytesRead == 0) {
gst_buffer_unref(buffer);
eosOrIdle();
- qCDebug(qLcAppSrc) << "end pushData" << m_stream << m_stream->atEnd() << m_buffer.size();
+ qCDebug(qLcAppSrc) << "end pushData" << (m_stream ? m_stream : nullptr) << m_buffer.size();
return;
}
m_noMoreData = false;
@@ -230,7 +230,7 @@ void QGstAppSrc::pushData()
} else if (ret == GST_FLOW_FLUSHING) {
qWarning() << "QGstAppSrc: push buffer wrong state";
}
- qCDebug(qLcAppSrc) << "end pushData" << m_stream << m_stream->atEnd() << m_buffer.size();
+ qCDebug(qLcAppSrc) << "end pushData" << (m_stream ? m_stream : nullptr) << m_buffer.size();
}