| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |