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

Unified Diff: media/capture/video/file_video_capture_device_factory.cc

Issue 2358093002: File Video Capture: allow IO operations from Device thread (Closed)
Patch Set: #include "base/threading/thread_restrictions.h" Created 4 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/video/file_video_capture_device_factory.cc
diff --git a/media/capture/video/file_video_capture_device_factory.cc b/media/capture/video/file_video_capture_device_factory.cc
index 0ead703662115d63c6419c94c8af87b99629807e..78ad6c86831f5d18aa34b180f063ef9b0512fcf0 100644
--- a/media/capture/video/file_video_capture_device_factory.cc
+++ b/media/capture/video/file_video_capture_device_factory.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/strings/sys_string_conversions.h"
+#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "media/base/media_switches.h"
#include "media/capture/video/file_video_capture_device.h"
@@ -28,6 +29,7 @@ base::FilePath GetFilePathFromCommandLine() {
std::unique_ptr<VideoCaptureDevice> FileVideoCaptureDeviceFactory::CreateDevice(
const VideoCaptureDeviceDescriptor& device_descriptor) {
DCHECK(thread_checker_.CalledOnValidThread());
+ base::ThreadRestrictions::AssertIOAllowed();
#if defined(OS_WIN)
return std::unique_ptr<VideoCaptureDevice>(new FileVideoCaptureDevice(
base::FilePath(base::SysUTF8ToWide(device_descriptor.display_name))));
@@ -41,6 +43,8 @@ void FileVideoCaptureDeviceFactory::GetDeviceDescriptors(
VideoCaptureDeviceDescriptors* device_descriptors) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(device_descriptors->empty());
+ base::ThreadRestrictions::SetIOAllowed(true);
+
const base::FilePath command_line_file_path = GetFilePathFromCommandLine();
device_descriptors->emplace_back(
#if defined(OS_WIN)
@@ -63,6 +67,7 @@ void FileVideoCaptureDeviceFactory::GetSupportedFormats(
const VideoCaptureDeviceDescriptor& device_descriptor,
VideoCaptureFormats* supported_formats) {
DCHECK(thread_checker_.CalledOnValidThread());
+ base::ThreadRestrictions::AssertIOAllowed();
VideoCaptureFormat capture_format;
if (!FileVideoCaptureDevice::GetVideoCaptureFormat(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698