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

Side by Side Diff: services/video_capture/service_impl.cc

Issue 2818513003: [Mojo Video Capture] Adapt video_capture service to refactored video capture stack (Closed)
Patch Set: Fix compile errors Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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"
13 #include "services/service_manager/public/cpp/service_info.h" 14 #include "services/service_manager/public/cpp/service_info.h"
14 #include "services/video_capture/device_factory_media_to_mojo_adapter.h" 15 #include "services/video_capture/device_factory_media_to_mojo_adapter.h"
15 16
16 namespace { 17 namespace {
17 18
18 // TODO(chfremer): Replace with an actual decoder factory. 19 // TODO(chfremer): Replace with an actual decoder factory.
19 // https://crbug.com/584797 20 // https://crbug.com/584797
20 std::unique_ptr<media::VideoCaptureJpegDecoder> CreateJpegDecoder() { 21 std::unique_ptr<media::VideoCaptureJpegDecoder> CreateJpegDecoder() {
21 return nullptr; 22 return nullptr;
22 } 23 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 59
59 void ServiceImpl::LazyInitializeDeviceFactory() { 60 void ServiceImpl::LazyInitializeDeviceFactory() {
60 if (device_factory_) 61 if (device_factory_)
61 return; 62 return;
62 63
63 // Create the platform-specific device factory. 64 // Create the platform-specific device factory.
64 // Task runner does not seem to actually be used. 65 // Task runner does not seem to actually be used.
65 std::unique_ptr<media::VideoCaptureDeviceFactory> media_device_factory = 66 std::unique_ptr<media::VideoCaptureDeviceFactory> media_device_factory =
66 media::VideoCaptureDeviceFactory::CreateFactory( 67 media::VideoCaptureDeviceFactory::CreateFactory(
67 base::MessageLoop::current()->task_runner()); 68 base::MessageLoop::current()->task_runner());
69 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystemImpl>(
70 std::move(media_device_factory));
68 71
69 device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>( 72 device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>(
70 std::move(media_device_factory), base::Bind(CreateJpegDecoder)); 73 std::move(video_capture_system), base::Bind(CreateJpegDecoder));
71 } 74 }
72 75
73 void ServiceImpl::LazyInitializeFakeDeviceFactory() { 76 void ServiceImpl::LazyInitializeFakeDeviceFactory() {
74 if (fake_device_factory_) 77 if (fake_device_factory_)
75 return; 78 return;
76 79
80 auto factory = base::MakeUnique<media::FakeVideoCaptureDeviceFactory>();
81 auto video_capture_system =
82 base::MakeUnique<media::VideoCaptureSystemImpl>(std::move(factory));
83
77 fake_device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>( 84 fake_device_factory_ = base::MakeUnique<DeviceFactoryMediaToMojoAdapter>(
78 base::MakeUnique<media::FakeVideoCaptureDeviceFactory>(), 85 std::move(video_capture_system), base::Bind(&CreateJpegDecoder));
79 base::Bind(&CreateJpegDecoder));
80 } 86 }
81 87
82 } // namespace video_capture 88 } // namespace video_capture
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698