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

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

Issue 2378943002: Let clients interact with VideoCaptureDeviceClient instead of VideoCaptureDevice (Closed)
Patch Set: Remove method AsClientBuffer() 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 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/video_capture_device_factory_impl.h" 5 #include "services/video_capture/video_capture_device_factory_impl.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 void VideoCaptureDeviceFactoryImpl::DeviceEntry::Unbind() { 56 void VideoCaptureDeviceFactoryImpl::DeviceEntry::Unbind() {
57 binding_->Unbind(); 57 binding_->Unbind();
58 device_proxy_->Stop(); 58 device_proxy_->Stop();
59 } 59 }
60 60
61 void VideoCaptureDeviceFactoryImpl::DeviceEntry::OnConnectionErrorOrClose() { 61 void VideoCaptureDeviceFactoryImpl::DeviceEntry::OnConnectionErrorOrClose() {
62 Unbind(); 62 Unbind();
63 } 63 }
64 64
65 VideoCaptureDeviceFactoryImpl::VideoCaptureDeviceFactoryImpl() = default; 65 VideoCaptureDeviceFactoryImpl::VideoCaptureDeviceFactoryImpl(
66 const media::VideoCaptureJpegDecoderFactoryCB&
67 jpeg_decoder_factory_callback)
68 : jpeg_decoder_factory_callback_(jpeg_decoder_factory_callback) {}
66 69
67 VideoCaptureDeviceFactoryImpl::~VideoCaptureDeviceFactoryImpl() = default; 70 VideoCaptureDeviceFactoryImpl::~VideoCaptureDeviceFactoryImpl() = default;
68 71
69 void VideoCaptureDeviceFactoryImpl::AddMojoDevice( 72 void VideoCaptureDeviceFactoryImpl::AddMojoDevice(
70 std::unique_ptr<VideoCaptureDeviceProxyImpl> device, 73 std::unique_ptr<VideoCaptureDeviceProxyImpl> device,
71 mojom::VideoCaptureDeviceDescriptorPtr descriptor) { 74 mojom::VideoCaptureDeviceDescriptorPtr descriptor) {
72 devices_.emplace_back(std::move(descriptor), std::move(device)); 75 devices_.emplace_back(std::move(descriptor), std::move(device));
73 } 76 }
74 77
75 void VideoCaptureDeviceFactoryImpl::AddMediaDevice( 78 void VideoCaptureDeviceFactoryImpl::AddMediaDevice(
76 std::unique_ptr<media::VideoCaptureDevice> device, 79 std::unique_ptr<media::VideoCaptureDevice> device,
77 mojom::VideoCaptureDeviceDescriptorPtr descriptor) { 80 mojom::VideoCaptureDeviceDescriptorPtr descriptor) {
78 AddMojoDevice( 81 AddMojoDevice(base::MakeUnique<VideoCaptureDeviceProxyImpl>(
79 base::MakeUnique<VideoCaptureDeviceProxyImpl>(std::move(device)), 82 std::move(device), jpeg_decoder_factory_callback_),
80 std::move(descriptor)); 83 std::move(descriptor));
81 } 84 }
82 85
83 void VideoCaptureDeviceFactoryImpl::AddMockDevice( 86 void VideoCaptureDeviceFactoryImpl::AddMockDevice(
84 mojom::MockVideoCaptureDevicePtr device, 87 mojom::MockVideoCaptureDevicePtr device,
85 mojom::VideoCaptureDeviceDescriptorPtr descriptor) { 88 mojom::VideoCaptureDeviceDescriptorPtr descriptor) {
86 AddMediaDevice(base::MakeUnique<DeviceMockToMediaAdapter>(std::move(device)), 89 AddMediaDevice(base::MakeUnique<DeviceMockToMediaAdapter>(std::move(device)),
87 std::move(descriptor)); 90 std::move(descriptor));
88 } 91 }
89 92
90 void VideoCaptureDeviceFactoryImpl::EnumerateDeviceDescriptors( 93 void VideoCaptureDeviceFactoryImpl::EnumerateDeviceDescriptors(
(...skipping 20 matching lines...) Expand all
111 entry.Unbind(); 114 entry.Unbind();
112 entry.Bind(std::move(proxy_request)); 115 entry.Bind(std::move(proxy_request));
113 callback.Run(mojom::DeviceAccessResultCode::SUCCESS); 116 callback.Run(mojom::DeviceAccessResultCode::SUCCESS);
114 return; 117 return;
115 } 118 }
116 } 119 }
117 callback.Run(mojom::DeviceAccessResultCode::ERROR_DEVICE_NOT_FOUND); 120 callback.Run(mojom::DeviceAccessResultCode::ERROR_DEVICE_NOT_FOUND);
118 } 121 }
119 122
120 } // namespace video_capture 123 } // namespace video_capture
OLDNEW
« no previous file with comments | « services/video_capture/video_capture_device_factory_impl.h ('k') | services/video_capture/video_capture_device_proxy_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698