Commit 432ae894 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Add VideoCaptureDeviceFactory stub

VideoCaptureSystemImpl expects to have non-null
VideoCaptureDeviceFactory, but it was getting nullptr value on Fuchsia.
As result the browser was crashing

Bug: 866669
Change-Id: I73ec5c850acdc392a7984f62d9f66edb0961809a
Reviewed-on: https://chromium-review.googlesource.com/1147514
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarChristian Fremerey <chfremer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577415}
parent b5274745
...@@ -270,6 +270,13 @@ component("capture_lib") { ...@@ -270,6 +270,13 @@ component("capture_lib") {
"//third_party/libsync", "//third_party/libsync",
] ]
} }
if (is_fuchsia) {
sources += [
"video/fuchsia/video_capture_device_factory_fuchsia.cc",
"video/fuchsia/video_capture_device_factory_fuchsia.h",
]
}
} }
source_set("test_support") { source_set("test_support") {
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "media/capture/video/mac/video_capture_device_factory_mac.h" #include "media/capture/video/mac/video_capture_device_factory_mac.h"
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
#include "media/capture/video/android/video_capture_device_factory_android.h" #include "media/capture/video/android/video_capture_device_factory_android.h"
#elif defined(OS_FUCHSIA)
#include "media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h"
#endif #endif
namespace media { namespace media {
...@@ -54,6 +56,8 @@ CreatePlatformSpecificVideoCaptureDeviceFactory( ...@@ -54,6 +56,8 @@ CreatePlatformSpecificVideoCaptureDeviceFactory(
return std::make_unique<VideoCaptureDeviceFactoryMac>(); return std::make_unique<VideoCaptureDeviceFactoryMac>();
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
return std::make_unique<VideoCaptureDeviceFactoryAndroid>(); return std::make_unique<VideoCaptureDeviceFactoryAndroid>();
#elif defined(OS_FUCHSIA)
return std::make_unique<VideoCaptureDeviceFactoryFuchsia>();
#else #else
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return nullptr; return nullptr;
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h"
#include "base/logging.h"
namespace media {
VideoCaptureDeviceFactoryFuchsia::VideoCaptureDeviceFactoryFuchsia() = default;
VideoCaptureDeviceFactoryFuchsia::~VideoCaptureDeviceFactoryFuchsia() = default;
std::unique_ptr<VideoCaptureDevice>
VideoCaptureDeviceFactoryFuchsia::CreateDevice(
const VideoCaptureDeviceDescriptor& device_descriptor) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
NOTIMPLEMENTED();
return nullptr;
}
void VideoCaptureDeviceFactoryFuchsia::GetDeviceDescriptors(
VideoCaptureDeviceDescriptors* device_descriptors) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
device_descriptors->clear();
}
void VideoCaptureDeviceFactoryFuchsia::GetSupportedFormats(
const VideoCaptureDeviceDescriptor& device,
VideoCaptureFormats* capture_formats) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
capture_formats->clear();
}
} // namespace media
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_CAPTURE_VIDEO_FUCHSIA_VIDEO_CAPTURE_DEVICE_FACTORY_FUCHSIA_H_
#define MEDIA_CAPTURE_VIDEO_FUCHSIA_VIDEO_CAPTURE_DEVICE_FACTORY_FUCHSIA_H_
#include "media/capture/video/video_capture_device_factory.h"
namespace media {
class CAPTURE_EXPORT VideoCaptureDeviceFactoryFuchsia
: public VideoCaptureDeviceFactory {
public:
VideoCaptureDeviceFactoryFuchsia();
~VideoCaptureDeviceFactoryFuchsia() override;
std::unique_ptr<VideoCaptureDevice> CreateDevice(
const VideoCaptureDeviceDescriptor& device_descriptor) override;
void GetDeviceDescriptors(
VideoCaptureDeviceDescriptors* device_descriptors) override;
void GetSupportedFormats(const VideoCaptureDeviceDescriptor& device,
VideoCaptureFormats* supported_formats) override;
private:
DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactoryFuchsia);
};
} // namespace media
#endif // MEDIA_CAPTURE_VIDEO_FUCHSIA_VIDEO_CAPTURE_DEVICE_FACTORY_FUCHSIA_H_
...@@ -113,6 +113,8 @@ void DeviceFactoryProviderImpl::LazyInitializeDeviceFactory() { ...@@ -113,6 +113,8 @@ void DeviceFactoryProviderImpl::LazyInitializeDeviceFactory() {
std::unique_ptr<media::VideoCaptureDeviceFactory> media_device_factory = std::unique_ptr<media::VideoCaptureDeviceFactory> media_device_factory =
media::CreateVideoCaptureDeviceFactory( media::CreateVideoCaptureDeviceFactory(
base::ThreadTaskRunnerHandle::Get()); base::ThreadTaskRunnerHandle::Get());
DCHECK(media_device_factory);
auto video_capture_system = std::make_unique<media::VideoCaptureSystemImpl>( auto video_capture_system = std::make_unique<media::VideoCaptureSystemImpl>(
std::move(media_device_factory)); std::move(media_device_factory));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment