plugins/screencast: Avoid resetting m_dmabufParams when resizing the stream
ScreenCastStream::onStreamAddBuffer() can be called before the stream params are updated. This is problematic because that function expects a valid m_dmabufParams. The reason why m_dmabufParams is reset is to force the onStreamParamChanged() function to check whether dmabufs can be still allocated with the new size.
This commit is contained in:
parent
31f80d18f2
commit
e2611d710f
1 changed files with 2 additions and 3 deletions
|
@ -174,7 +174,7 @@ void ScreenCastStream::onStreamParamChanged(uint32_t id, const struct spa_pod *f
|
||||||
std::sort(receivedModifiers.begin(), receivedModifiers.end());
|
std::sort(receivedModifiers.begin(), receivedModifiers.end());
|
||||||
receivedModifiers.erase(std::unique(receivedModifiers.begin(), receivedModifiers.end()), receivedModifiers.end());
|
receivedModifiers.erase(std::unique(receivedModifiers.begin(), receivedModifiers.end()), receivedModifiers.end());
|
||||||
|
|
||||||
if (!m_dmabufParams || !receivedModifiers.contains(m_dmabufParams->modifier)) {
|
if (!m_dmabufParams || m_dmabufParams->width != m_resolution.width() || m_dmabufParams->height != m_resolution.height() || !receivedModifiers.contains(m_dmabufParams->modifier)) {
|
||||||
if (modifierProperty->flags & SPA_POD_PROP_FLAG_DONT_FIXATE) {
|
if (modifierProperty->flags & SPA_POD_PROP_FLAG_DONT_FIXATE) {
|
||||||
// DRM_MOD_INVALID should be used as a last option. Do not just remove it it's the only
|
// DRM_MOD_INVALID should be used as a last option. Do not just remove it it's the only
|
||||||
// item on the list
|
// item on the list
|
||||||
|
@ -259,7 +259,7 @@ void ScreenCastStream::onStreamRenegotiateFormat(uint64_t)
|
||||||
|
|
||||||
m_streaming = false; // pause streaming as we wait for the renegotiation
|
m_streaming = false; // pause streaming as we wait for the renegotiation
|
||||||
char buffer[2048];
|
char buffer[2048];
|
||||||
auto params = buildFormats(m_dmabufParams.has_value(), buffer);
|
auto params = buildFormats(false, buffer);
|
||||||
pw_stream_update_params(m_pwStream, params.data(), params.count());
|
pw_stream_update_params(m_pwStream, params.data(), params.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,6 @@ void ScreenCastStream::recordFrame(const QRegion &_damagedRegion)
|
||||||
if (size != m_resolution) {
|
if (size != m_resolution) {
|
||||||
m_resolution = size;
|
m_resolution = size;
|
||||||
m_waitForNewBuffers = true;
|
m_waitForNewBuffers = true;
|
||||||
m_dmabufParams = std::nullopt;
|
|
||||||
pw_loop_signal_event(m_pwCore->pwMainLoop, m_pwRenegotiate);
|
pw_loop_signal_event(m_pwCore->pwMainLoop, m_pwRenegotiate);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue