forked from youtube/cobalt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add VideoGeometrySetter Service for Cobalt (youtube#4810)
StarboardRender needs to be informed with the video geometry information from the display compositor. VideoGeometrySetter provides the IPC between the StarobardRenderer and the display compositor so the video geometry information can reach StarboardRenderer. This refers to https://chromium-review.googlesource.com/c/chromium/src/+/1799692 with the following modifications: - VideoGeometrySetterService is in Renderer thread, and it is exposed to ContentBrowserClient. - ContentBrowserClient binds VideoGeometrySetterService after receiving mojo::PendingRemote\<cobalt::media::mojom::VideoGeometrySetter\> from compositing thread (viz) to Renderer thread. - ContentRendererClient creates a custom StarboardRendererFactory, which allows to bind |overlay_plane_id| for each StarboardRenderer with VideoGeometrySetterService. This CL also cleans up the old implementations for setting video bounds: youtube#4385, because it is unnecessary with this PR. b/391938746
- Loading branch information
Showing
40 changed files
with
609 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "cobalt/browser/cobalt_single_render_process_observer.h" | ||
|
||
#include "content/public/browser/browser_thread.h" | ||
#include "content/public/browser/render_process_host.h" | ||
#include "content/public/browser/render_process_host_observer.h" | ||
|
||
namespace cobalt { | ||
|
||
CobaltSingleRenderProcessObserver::CobaltSingleRenderProcessObserver() = | ||
default; | ||
CobaltSingleRenderProcessObserver::~CobaltSingleRenderProcessObserver() = | ||
default; | ||
|
||
void CobaltSingleRenderProcessObserver::UpdateRenderProcessHost( | ||
content::RenderProcessHost* host) { | ||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | ||
DCHECK_EQ(renderer_id_, content::kInvalidChildProcessUniqueId) | ||
<< "Cobalt should only have one renderer."; | ||
renderer_id_ = host->GetID(); | ||
process_observation_.Reset(); | ||
if (auto* rph = content::RenderProcessHost::FromID(renderer_id_)) { | ||
process_observation_.Observe(rph); | ||
} | ||
} | ||
|
||
void CobaltSingleRenderProcessObserver::RenderProcessExited( | ||
content::RenderProcessHost* host, | ||
const content::ChildProcessTerminationInfo& info) { | ||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | ||
NOTIMPLEMENTED() | ||
<< "CobaltSingleRenderProcessObserver only supports single process."; | ||
} | ||
|
||
void CobaltSingleRenderProcessObserver::InProcessRendererExiting( | ||
content::RenderProcessHost* host) { | ||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | ||
DCHECK_EQ(host->GetID(), renderer_id_) | ||
<< "Cobalt should only have one renderer."; | ||
process_observation_.Reset(); | ||
} | ||
|
||
} // namespace cobalt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef COBALT_BROWSER_COBALT_SINGLE_RENDER_PROCESS_OBSERVER_H_ | ||
#define COBALT_BROWSER_COBALT_SINGLE_RENDER_PROCESS_OBSERVER_H_ | ||
|
||
#include "base/memory/weak_ptr.h" | ||
#include "base/scoped_observation.h" | ||
#include "content/public/browser/render_process_host_observer.h" | ||
#include "content/public/common/content_constants.h" | ||
|
||
namespace content { | ||
class RenderProcessHost; | ||
class RenderProcessHostObserver; | ||
} // namespace content | ||
|
||
namespace cobalt { | ||
|
||
// This class keeps track of a Renderer ID during its lifetime. It must | ||
// be used on the UI thread, and can observe one such Renderer. | ||
class CobaltSingleRenderProcessObserver | ||
: public content::RenderProcessHostObserver { | ||
public: | ||
CobaltSingleRenderProcessObserver(); | ||
|
||
CobaltSingleRenderProcessObserver(const CobaltSingleRenderProcessObserver&) = | ||
delete; | ||
CobaltSingleRenderProcessObserver& operator=( | ||
const CobaltSingleRenderProcessObserver&) = delete; | ||
|
||
~CobaltSingleRenderProcessObserver() override; | ||
|
||
void UpdateRenderProcessHost(content::RenderProcessHost* host); | ||
int renderer_id() const { return renderer_id_; } | ||
|
||
// content::RenderProcessHostObserver implementation | ||
void RenderProcessExited( | ||
content::RenderProcessHost* host, | ||
const content::ChildProcessTerminationInfo& info) override; | ||
void InProcessRendererExiting(content::RenderProcessHost* host) override; | ||
|
||
private: | ||
int renderer_id_ = content::kInvalidChildProcessUniqueId; | ||
base::ScopedObservation<content::RenderProcessHost, | ||
content::RenderProcessHostObserver> | ||
process_observation_{this}; | ||
}; | ||
|
||
} // namespace cobalt | ||
|
||
#endif // COBALT_BROWSER_COBALT_SINGLE_RENDER_PROCESS_OBSERVER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
source_set("gpu") { | ||
sources = [ | ||
"cobalt_content_gpu_client.cc", | ||
"cobalt_content_gpu_client.h", | ||
] | ||
|
||
deps = [ | ||
"//base", | ||
"//cobalt/media/service/mojom", | ||
"//components/viz/common", | ||
"//components/viz/service", | ||
"//content/public/child", | ||
"//content/public/gpu", | ||
] | ||
} |
Oops, something went wrong.