Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: content/common/sandbox_linux/bpf_gpu_policy_linux.cc

Issue 2398883002: Add support for multiple V4L2 video devices of the same type. (Closed)
Patch Set: Address comments, reorganize V4L2Device::Type. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/gpu/generic_v4l2_device.h » ('j') | media/gpu/generic_v4l2_device.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_linux/bpf_gpu_policy_linux.cc
diff --git a/content/common/sandbox_linux/bpf_gpu_policy_linux.cc b/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
index 47c0bebeecc5450188030a1203daa616046d8dfd..09eedbb37e54698af0fc47af1f5df41937725805 100644
--- a/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
+++ b/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
@@ -19,6 +19,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
+#include "base/files/file_enumerator.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
@@ -154,9 +155,16 @@ intptr_t GpuSIGSYS_Handler(const struct arch_seccomp_data& args,
void AddV4L2GpuWhitelist(std::vector<BrokerFilePermission>* permissions) {
if (IsAcceleratedVideoDecodeEnabled()) {
- // Device node for V4L2 video decode accelerator drivers.
- static const char kDevVideoDecPath[] = "/dev/video-dec";
- permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoDecPath));
+ // Device nodes for V4L2 video decode accelerator drivers.
+ static const base::FilePath::CharType kDevicePath[] =
+ FILE_PATH_LITERAL("/dev/");
+ static const base::FilePath::CharType kVideoDecPattern[] = "video-dec[0-9]";
+ base::FileEnumerator enumerator(base::FilePath(kDevicePath), false,
+ base::FileEnumerator::FILES,
+ base::FilePath(kVideoDecPattern).value());
+ for (base::FilePath name = enumerator.Next(); !name.empty();
+ name = enumerator.Next())
+ permissions->push_back(BrokerFilePermission::ReadWrite(name.value()));
}
// Device node for V4L2 video encode accelerator drivers.
« no previous file with comments | « no previous file | media/gpu/generic_v4l2_device.h » ('j') | media/gpu/generic_v4l2_device.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698