pkgsrc-wip/chromium/patches/patch-media_base_video__fra...

68 lines
2.4 KiB
C++

$NetBSD$
--- media/base/video_frame.cc.orig 2020-07-08 21:40:45.000000000 +0000
+++ media/base/video_frame.cc
@@ -57,7 +57,7 @@ std::string VideoFrame::StorageTypeToStr
return "OWNED_MEMORY";
case VideoFrame::STORAGE_SHMEM:
return "SHMEM";
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
case VideoFrame::STORAGE_DMABUFS:
return "DMABUFS";
#endif
@@ -74,7 +74,7 @@ std::string VideoFrame::StorageTypeToStr
// static
bool VideoFrame::IsStorageTypeMappable(VideoFrame::StorageType storage_type) {
return
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
// This is not strictly needed but makes explicit that, at VideoFrame
// level, DmaBufs are not mappable from userspace.
storage_type != VideoFrame::STORAGE_DMABUFS &&
@@ -259,7 +259,7 @@ static base::Optional<VideoFrameLayout>
return VideoFrameLayout::CreateWithPlanes(format, coded_size, planes);
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
// This class allows us to embed a vector<ScopedFD> into a scoped_refptr, and
// thus to have several VideoFrames share the same set of DMABUF FDs.
class VideoFrame::DmabufHolder
@@ -589,7 +589,7 @@ scoped_refptr<VideoFrame> VideoFrame::Wr
return frame;
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
// static
scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
const VideoFrameLayout& layout,
@@ -725,7 +725,7 @@ scoped_refptr<VideoFrame> VideoFrame::Wr
}
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
DCHECK(frame->dmabuf_fds_);
// If there are any |dmabuf_fds_| plugged in, we should refer them too.
wrapping_frame->dmabuf_fds_ = frame->dmabuf_fds_;
@@ -1058,7 +1058,7 @@ VideoFrame::mailbox_holder(size_t textur
: mailbox_holders_[texture_index];
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
const std::vector<base::ScopedFD>& VideoFrame::DmabufFds() const {
DCHECK_EQ(storage_type_, STORAGE_DMABUFS);
@@ -1141,7 +1141,7 @@ VideoFrame::VideoFrame(const VideoFrameL
storage_type_(storage_type),
visible_rect_(Intersection(visible_rect, gfx::Rect(layout.coded_size()))),
natural_size_(natural_size),
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
dmabuf_fds_(base::MakeRefCounted<DmabufHolder>()),
#endif
timestamp_(timestamp),