Commit 1e2e99ef authored by Christian Fremerey's avatar Christian Fremerey Committed by Commit Bot

Enable video capture service by default on platforms where it is rolling

out with M61.

Bug: 721812
Change-Id: I1de0f625a1fb106e2dea664675e94267e66fc2fd
Reviewed-on: https://chromium-review.googlesource.com/719416
Commit-Queue: Christian Fremerey <chfremer@chromium.org>
Reviewed-by: default avatarEmircan Uysaler <emircan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517761}
parent ef7bf539
......@@ -18,6 +18,7 @@
#include "content/browser/browser_thread_impl.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
#include "content/browser/renderer_host/media/mock_video_capture_provider.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "media/audio/audio_device_description.h"
......@@ -43,6 +44,7 @@
#endif
using testing::_;
using testing::Invoke;
namespace content {
......@@ -138,9 +140,19 @@ class MediaStreamManagerTest : public ::testing::Test {
audio_manager_ = std::make_unique<MockAudioManager>();
audio_system_ =
std::make_unique<media::AudioSystemImpl>(audio_manager_.get());
auto video_capture_provider = std::make_unique<MockVideoCaptureProvider>();
video_capture_provider_ = video_capture_provider.get();
media_stream_manager_ = std::make_unique<MediaStreamManager>(
audio_system_.get(), audio_manager_->GetTaskRunner());
audio_system_.get(), audio_manager_->GetTaskRunner(),
std::move(video_capture_provider));
base::RunLoop().RunUntilIdle();
ON_CALL(*video_capture_provider_, DoGetDeviceInfosAsync(_))
.WillByDefault(Invoke(
[](VideoCaptureProvider::GetDeviceInfosCallback& result_callback) {
std::vector<media::VideoCaptureDeviceInfo> stub_results;
base::ResetAndReturn(&result_callback).Run(stub_results);
}));
}
~MediaStreamManagerTest() override { audio_manager_->Shutdown(); }
......@@ -176,6 +188,7 @@ class MediaStreamManagerTest : public ::testing::Test {
content::TestBrowserThreadBundle thread_bundle_;
std::unique_ptr<MockAudioManager> audio_manager_;
std::unique_ptr<media::AudioSystem> audio_system_;
MockVideoCaptureProvider* video_capture_provider_;
base::RunLoop run_loop_;
private:
......
......@@ -20,20 +20,28 @@ class ServiceConnectorImpl
public:
ServiceConnectorImpl() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
connector_ = content::ServiceManagerConnection::GetForProcess()
->GetConnector()
->Clone();
DETACH_FROM_SEQUENCE(sequence_checker_);
// In unit test environments, there may not be any connector.
auto* connection = content::ServiceManagerConnection::GetForProcess();
if (!connection)
return;
auto* connector = connection->GetConnector();
if (!connector)
return;
connector_ = connector->Clone();
}
void BindFactoryProvider(
video_capture::mojom::DeviceFactoryProviderPtr* provider) override {
if (!connector_) {
CHECK(false) << "Attempted to connect to the video capture service from "
"a process that does not provide a "
"ServiceManagerConnection";
}
connector_->BindInterface(video_capture::mojom::kServiceName, provider);
}
private:
std::unique_ptr<service_manager::Connector> connector_;
SEQUENCE_CHECKER(sequence_checker_);
};
} // anonymous namespace
......
......@@ -4,9 +4,18 @@
#include "services/video_capture/public/cpp/constants.h"
#include "build/build_config.h"
namespace video_capture {
const base::Feature kMojoVideoCapture{"MojoVideoCapture",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kMojoVideoCapture {
"MojoVideoCapture",
#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) || \
defined(OS_WIN)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
} // namespace video_capture
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