Skip to content

Commit

Permalink
Reland "Enable video capture service by default on platforms where it…
Browse files Browse the repository at this point in the history
… is rolling out with M61."

This is a reland of 1e2e99e

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}
  • Loading branch information
Christian Fremerey authored and Commit Bot committed Dec 5, 2017
1 parent 7994385 commit 0fdb7a8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -43,6 +44,7 @@
#endif

using testing::_;
using testing::Invoke;

namespace content {

Expand Down Expand Up @@ -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(); }
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions services/video_capture/public/cpp/constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0fdb7a8

Please sign in to comment.