| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/video_capture/service_impl.h" | 5 #include "services/video_capture/service_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "media/capture/video/fake_video_capture_device_factory.h" | 9 #include "media/capture/video/fake_video_capture_device_factory.h" |
| 10 #include "media/capture/video/video_capture_buffer_pool.h" | 10 #include "media/capture/video/video_capture_buffer_pool.h" |
| 11 #include "media/capture/video/video_capture_buffer_tracker.h" | 11 #include "media/capture/video/video_capture_buffer_tracker.h" |
| 12 #include "media/capture/video/video_capture_jpeg_decoder.h" | 12 #include "media/capture/video/video_capture_jpeg_decoder.h" |
| 13 #include "media/capture/video/video_capture_system_impl.h" | |
| 14 #include "services/service_manager/public/cpp/service_info.h" | 13 #include "services/service_manager/public/cpp/service_info.h" |
| 15 #include "services/video_capture/device_factory_media_to_mojo_adapter.h" | 14 #include "services/video_capture/device_factory_media_to_mojo_adapter.h" |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 // TODO(chfremer): Replace with an actual decoder factory. | 18 // TODO(chfremer): Replace with an actual decoder factory. |
| 20 // https://crbug.com/584797 | 19 // https://crbug.com/584797 |
| 21 std::unique_ptr<media::VideoCaptureJpegDecoder> CreateJpegDecoder() { | 20 std::unique_ptr<media::VideoCaptureJpegDecoder> CreateJpegDecoder() { |
| 22 return nullptr; | 21 return nullptr; |
| 23 } | 22 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 58 |
| 60 void ServiceImpl::LazyInitializeDeviceFactory() { | 59 void ServiceImpl::LazyInitializeDeviceFactory() { |
| 61 if (device_factory_) | 60 if (device_factory_) |
| 62 return; | 61 return; |
| 63 | 62 |
| 64 // Create the platform-specific device factory. | 63 // Create the platform-specific device factory. |
| 65 // Task runner does not seem to actually be used. | 64 // Task runner does not seem to actually be used. |
| 66 std::unique_ptr<media::VideoCaptureDeviceFactory> media_device_factory = | 65 std::unique_ptr<media::VideoCaptureDeviceFactory> media_device_factory = |
| 67 media::VideoCaptureDeviceFactory::CreateFactory( | 66 media::VideoCaptureDeviceFactory::CreateFactory( |
| 68 base::MessageLoop::current()->task_runner()); | 67 base::MessageLoop::current()->task_runner()); |
| 69 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystemImpl>( | |
| 70 std::move(media_device_factory)); | |
| 71 | 68 |
| 72 device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>( | 69 device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>( |
| 73 std::move(video_capture_system), base::Bind(CreateJpegDecoder)); | 70 std::move(media_device_factory), base::Bind(CreateJpegDecoder)); |
| 74 } | 71 } |
| 75 | 72 |
| 76 void ServiceImpl::LazyInitializeFakeDeviceFactory() { | 73 void ServiceImpl::LazyInitializeFakeDeviceFactory() { |
| 77 if (fake_device_factory_) | 74 if (fake_device_factory_) |
| 78 return; | 75 return; |
| 79 | 76 |
| 80 auto factory = base::MakeUnique<media::FakeVideoCaptureDeviceFactory>(); | |
| 81 auto video_capture_system = | |
| 82 base::MakeUnique<media::VideoCaptureSystemImpl>(std::move(factory)); | |
| 83 | |
| 84 fake_device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>( | 77 fake_device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>( |
| 85 std::move(video_capture_system), base::Bind(&CreateJpegDecoder)); | 78 base::MakeUnique<media::FakeVideoCaptureDeviceFactory>(), |
| 79 base::Bind(&CreateJpegDecoder)); |
| 86 } | 80 } |
| 87 | 81 |
| 88 } // namespace video_capture | 82 } // namespace video_capture |
| OLD | NEW |