blob: cefeb5c004349234275c5f7bc514126d7f3b07d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/capture/video/video_capture_device_factory.h"
#include <utility>
#include "base/command_line.h"
#include "build/build_config.h"
#include "media/base/media_switches.h"
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "media/capture/video/file_video_capture_device_factory.h"
namespace media {
// static
std::unique_ptr<VideoCaptureDeviceFactory>
VideoCaptureDeviceFactory::CreateFactory(
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
gpu::GpuMemoryBufferManager* gpu_buffer_manager) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
// Use a Fake or File Video Device Factory if the command line flags are
// present, otherwise use the normal, platform-dependent, device factory.
if (command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream)) {
if (command_line->HasSwitch(switches::kUseFileForFakeVideoCapture)) {
return std::unique_ptr<VideoCaptureDeviceFactory>(
new media::FileVideoCaptureDeviceFactory());
} else {
std::vector<FakeVideoCaptureDeviceSettings> config;
FakeVideoCaptureDeviceFactory::ParseFakeDevicesConfigFromOptionsString(
command_line->GetSwitchValueASCII(
switches::kUseFakeDeviceForMediaStream),
&config);
auto result = base::MakeUnique<media::FakeVideoCaptureDeviceFactory>();
result->SetToCustomDevicesConfig(config);
return std::move(result);
}
} else {
// |ui_task_runner| is needed for the Linux ChromeOS factory to retrieve
// screen rotations.
return std::unique_ptr<VideoCaptureDeviceFactory>(
CreateVideoCaptureDeviceFactory(ui_task_runner, gpu_buffer_manager));
}
}
VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() {
thread_checker_.DetachFromThread();
}
VideoCaptureDeviceFactory::~VideoCaptureDeviceFactory() = default;
#if !defined(OS_MACOSX) && !defined(OS_LINUX) && !defined(OS_ANDROID) && \
!defined(OS_WIN)
// static
VideoCaptureDeviceFactory*
VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory(
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
gpu::GpuMemoryBufferManager* gpu_buffer_manager) {
NOTIMPLEMENTED();
return NULL;
}
#endif
} // namespace media
|