mirror of
https://git.freebsd.org/ports.git
synced 2025-07-06 20:09:14 -04:00
Approved by: rene (mentor) Security: https://vuxml.freebsd.org/freebsd/310ca30e-a951-11ed-8314-a8a1599412c6.html
74 lines
3.3 KiB
C++
74 lines
3.3 KiB
C++
--- media/base/video_frame.cc.orig 2023-02-08 09:03:45 UTC
|
|
+++ media/base/video_frame.cc
|
|
@@ -79,7 +79,7 @@ std::string VideoFrame::StorageTypeToString(
|
|
return "OWNED_MEMORY";
|
|
case VideoFrame::STORAGE_SHMEM:
|
|
return "SHMEM";
|
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
case VideoFrame::STORAGE_DMABUFS:
|
|
return "DMABUFS";
|
|
#endif
|
|
@@ -94,7 +94,7 @@ std::string VideoFrame::StorageTypeToString(
|
|
// static
|
|
bool VideoFrame::IsStorageTypeMappable(VideoFrame::StorageType storage_type) {
|
|
return
|
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
// This is not strictly needed but makes explicit that, at VideoFrame
|
|
// level, DmaBufs are not mappable from userspace.
|
|
storage_type != VideoFrame::STORAGE_DMABUFS &&
|
|
@@ -306,7 +306,7 @@ static absl::optional<VideoFrameLayout> GetDefaultLayo
|
|
return VideoFrameLayout::CreateWithPlanes(format, coded_size, planes);
|
|
}
|
|
|
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_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
|
|
@@ -646,7 +646,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalGpuM
|
|
for (size_t i = 0; i < num_planes; ++i)
|
|
planes[i].stride = gpu_memory_buffer->stride(i);
|
|
uint64_t modifier = gfx::NativePixmapHandle::kNoModifier;
|
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
if (gpu_memory_buffer->GetType() == gfx::NATIVE_PIXMAP) {
|
|
const auto gmb_handle = gpu_memory_buffer->CloneHandle();
|
|
if (gmb_handle.is_null() ||
|
|
@@ -692,7 +692,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalGpuM
|
|
return frame;
|
|
}
|
|
|
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
// static
|
|
scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
|
|
const VideoFrameLayout& layout,
|
|
@@ -912,7 +912,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame(
|
|
}
|
|
}
|
|
|
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_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_;
|
|
@@ -1303,7 +1303,7 @@ const gpu::MailboxHolder& VideoFrame::mailbox_holder(
|
|
: mailbox_holders_[texture_index];
|
|
}
|
|
|
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
const std::vector<base::ScopedFD>& VideoFrame::DmabufFds() const {
|
|
DCHECK_EQ(storage_type_, STORAGE_DMABUFS);
|
|
|
|
@@ -1415,7 +1415,7 @@ VideoFrame::VideoFrame(const VideoFrameLayout& layout,
|
|
storage_type_(storage_type),
|
|
visible_rect_(Intersection(visible_rect, gfx::Rect(layout.coded_size()))),
|
|
natural_size_(natural_size),
|
|
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
|
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
|
|
dmabuf_fds_(base::MakeRefCounted<DmabufHolder>()),
|
|
#endif
|
|
timestamp_(timestamp),
|