PipeWire capture: fix mmap arguments

Do not add offset to the "length" argument for mmap call as it should be
passed as the last argument instead. This was not causing any problems
since the offset is usually 0, but it's still better to do it correctly.

Bug: webrtc:42225999
Change-Id: If1dbe7dfd2fb22c53493c0fafd23d782f0683a11
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/354521
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#42481}
This commit is contained in:
Jan Grulich 2024-06-12 17:14:07 +02:00 committed by WebRTC LUCI CQ
parent 093824c4d2
commit 3252f5d8e4

View File

@ -418,11 +418,10 @@ void VideoCaptureModulePipeWire::ProcessBuffers() {
ScopedBuf frame;
frame.initialize(
static_cast<uint8_t*>(
mmap(nullptr,
spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)),
spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
spaBuffer->datas[0].fd, spaBuffer->datas[0].type == SPA_DATA_DmaBuf);
mmap(nullptr, spaBuffer->datas[0].maxsize, PROT_READ, MAP_PRIVATE,
spaBuffer->datas[0].fd, spaBuffer->datas[0].mapoffset)),
spaBuffer->datas[0].maxsize, spaBuffer->datas[0].fd,
spaBuffer->datas[0].type == SPA_DATA_DmaBuf);
if (!frame) {
RTC_LOG(LS_ERROR) << "Failed to mmap the memory: "