Commit 7c7112f1 authored by Christian Fremerey's avatar Christian Fremerey Committed by Commit Bot

Reland "Reland "Enable video capture service by default on platforms where it...

Reland "Reland "Enable video capture service by default on platforms where it is rolling out with M61.""

This is a reland of 0fdb7a80

The reason for the second revert was anouther Webkit layout tests failing with this CL.
With https://chromium-review.googlesource.com/c/chromium/src/+/811865 landed to fix
the test, this CL should now be able to reland without modification.

Original change's description:
> Reland "Enable video capture service by default on platforms where it is rolling out with M61."
>
> This is a reland of 1e2e99ef
>
> The reason for the revert was a Webkit layout test failing with this CL. With
> https://chromium-review.googlesource.com/c/chromium/src/+/806442 landed to fix that test,
> this CL should now be able to reland without modification.
>
> Original change's description:
> > 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: Emircan Uysaler <emircan@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#517761}
>
> TBR=emircan@chromium.org
>
> Bug: 721812
> Change-Id: If69cdb660b0b97a28084b6bd0610234d5abb232f
> Reviewed-on: https://chromium-review.googlesource.com/809530
> Reviewed-by: Christian Fremerey <chfremer@chromium.org>
> Commit-Queue: Christian Fremerey <chfremer@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#521800}

TBR=emircan@chromium.org

Bug: 721812
Change-Id: I3287fbfc810caf3d7472c0871a9e0bb73c871841
Reviewed-on: https://chromium-review.googlesource.com/812484
Commit-Queue: Christian Fremerey <chfremer@chromium.org>
Reviewed-by: default avatarChristian Fremerey <chfremer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522270}
parent a4193270
......@@ -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