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

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

Issue 2900583002: Revert of [Mojo Video Capture] Hook up video capture service behind a feature flag (Closed)
Patch Set: Rebase Created 3 years, 7 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
« no previous file with comments | « media/capture/video/video_capture_system.h ('k') | services/video_capture/public/cpp/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/device_factory_media_to_mojo_adapter.h" 5 #include "services/video_capture/device_factory_media_to_mojo_adapter.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 17 matching lines...) Expand all
28 // instead of VideoCaptureSystem. 28 // instead of VideoCaptureSystem.
29 static void TranslateDeviceInfos( 29 static void TranslateDeviceInfos(
30 const video_capture::mojom::DeviceFactory::GetDeviceInfosCallback& callback, 30 const video_capture::mojom::DeviceFactory::GetDeviceInfosCallback& callback,
31 const std::vector<media::VideoCaptureDeviceInfo>& device_infos) { 31 const std::vector<media::VideoCaptureDeviceInfo>& device_infos) {
32 std::vector<media::VideoCaptureDeviceInfo> translated_device_infos; 32 std::vector<media::VideoCaptureDeviceInfo> translated_device_infos;
33 for (const auto& device_info : device_infos) { 33 for (const auto& device_info : device_infos) {
34 media::VideoCaptureDeviceInfo translated_device_info; 34 media::VideoCaptureDeviceInfo translated_device_info;
35 translated_device_info.descriptor = device_info.descriptor; 35 translated_device_info.descriptor = device_info.descriptor;
36 for (const auto& format : device_info.supported_formats) { 36 for (const auto& format : device_info.supported_formats) {
37 media::VideoCaptureFormat translated_format; 37 media::VideoCaptureFormat translated_format;
38 translated_format.pixel_format = 38 switch (format.pixel_format) {
39 (format.pixel_format == media::PIXEL_FORMAT_Y16) 39 case media::PIXEL_FORMAT_I420:
40 ? media::PIXEL_FORMAT_Y16 40 case media::PIXEL_FORMAT_MJPEG:
41 : media::PIXEL_FORMAT_I420; 41 translated_format.pixel_format = media::PIXEL_FORMAT_I420;
42 break;
43 case media::PIXEL_FORMAT_Y16:
44 translated_format.pixel_format = media::PIXEL_FORMAT_Y16;
45 default:
46 // Any other format cannot be consumed by VideoCaptureDeviceClient.
47 continue;
48 }
42 translated_format.frame_size = format.frame_size; 49 translated_format.frame_size = format.frame_size;
43 translated_format.frame_rate = format.frame_rate; 50 translated_format.frame_rate = format.frame_rate;
44 translated_format.pixel_storage = media::PIXEL_STORAGE_CPU; 51 translated_format.pixel_storage = media::PIXEL_STORAGE_CPU;
45 if (base::ContainsValue(translated_device_info.supported_formats, 52 if (base::ContainsValue(translated_device_info.supported_formats,
46 translated_format)) 53 translated_format))
47 continue; 54 continue;
48 translated_device_info.supported_formats.push_back(translated_format); 55 translated_device_info.supported_formats.push_back(translated_format);
49 } 56 }
50 if (translated_device_info.supported_formats.empty()) 57 if (translated_device_info.supported_formats.empty())
51 continue; 58 continue;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 callback.Run(mojom::DeviceAccessResultCode::SUCCESS); 163 callback.Run(mojom::DeviceAccessResultCode::SUCCESS);
157 } 164 }
158 165
159 void DeviceFactoryMediaToMojoAdapter::OnClientConnectionErrorOrClose( 166 void DeviceFactoryMediaToMojoAdapter::OnClientConnectionErrorOrClose(
160 const std::string& device_id) { 167 const std::string& device_id) {
161 active_devices_by_id_[device_id].device->Stop(); 168 active_devices_by_id_[device_id].device->Stop();
162 active_devices_by_id_.erase(device_id); 169 active_devices_by_id_.erase(device_id);
163 } 170 }
164 171
165 } // namespace video_capture 172 } // namespace video_capture
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_system.h ('k') | services/video_capture/public/cpp/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698