pipewire: Don't crash if we're passed a null spa_data
I just had that crash, this is what coredumpctl suggested it was happening. We don't need to make sure we're in dmabuf mode to remove the buffer. Worst case scenario it won't remove anything. Check the spa_data before querying in case it's null.
This commit is contained in:
parent
11c3ada121
commit
8950b78121
1 changed files with 2 additions and 4 deletions
|
@ -158,13 +158,11 @@ void PipeWireStream::onStreamAddBuffer(void *data, pw_buffer *buffer)
|
|||
void PipeWireStream::onStreamRemoveBuffer(void *data, pw_buffer *buffer)
|
||||
{
|
||||
PipeWireStream *stream = static_cast<PipeWireStream *>(data);
|
||||
stream->m_dmabufDataForPwBuffer.remove(buffer);
|
||||
|
||||
struct spa_buffer *spa_buffer = buffer->buffer;
|
||||
struct spa_data *spa_data = spa_buffer->datas;
|
||||
|
||||
if (spa_data->type == SPA_DATA_DmaBuf) {
|
||||
stream->m_dmabufDataForPwBuffer.remove(buffer);
|
||||
} else if (spa_data->type == SPA_DATA_MemFd) {
|
||||
if (spa_data && spa_data->type == SPA_DATA_MemFd) {
|
||||
munmap (spa_data->data, spa_data->maxsize);
|
||||
close (spa_data->fd);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue