Skip to content

Commit

Permalink
Add Interface to be implemented in internal Chromecast repo
Browse files Browse the repository at this point in the history
This CL defined the CastRuntimeService interface. It is to be used for
building the Cast Runtime Service inside internal Chromecast code, and
it will act as the border between public Chromium and this internal
implementation to provide a mechanism through which internal constants
and implementations of public Chromium types available during an
internally-built executable's runtime may be accessed.

NOTE: This interface is intended to wrap an existing internal class:
go/castruntimeservicewrapper

Change-Id: I1aeaf69c824fe491051ffc47dd21e027dced83f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2827503
Reviewed-by: Yuchen Liu <yucliu@chromium.org>
Commit-Queue: Ryan Keane <rwkeane@google.com>
Cr-Commit-Position: refs/heads/master@{#872966}
  • Loading branch information
Ryan Keane authored and Chromium LUCI CQ committed Apr 15, 2021
1 parent 970d910 commit a7da67b
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 45 deletions.
1 change: 1 addition & 0 deletions chromecast/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ group("cast_shell_lib") {
"//chromecast/app",
"//chromecast/base:default_create_sys_info",
"//chromecast/browser",
"//chromecast/cast_core",
"//chromecast/common",
"//chromecast/renderer",
]
Expand Down
17 changes: 17 additions & 0 deletions chromecast/cast_core/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2021 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.

import("//chromecast/chromecast.gni")

cast_source_set("cast_core") {
sources = [
"cast_runtime_service.cc",
"cast_runtime_service.h",
]

deps = [
"//chromecast/media/cma/backend/proxy:headers",
"//chromecast/service",
]
}
4 changes: 4 additions & 0 deletions chromecast/cast_core/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include_rules = [
"+chromecast/media",
'+chromecast/service',
]
3 changes: 3 additions & 0 deletions chromecast/cast_core/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
btolsch@chromium.org
mfoltz@chromium.org
rwkeane@google.com
15 changes: 15 additions & 0 deletions chromecast/cast_core/cast_runtime_service.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2021 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 "chromecast/cast_core/cast_runtime_service.h"

namespace chromecast {
namespace media {

CastRuntimeService::CastRuntimeService() = default;

CastRuntimeService::~CastRuntimeService() = default;

} // namespace media
} // namespace chromecast
49 changes: 49 additions & 0 deletions chromecast/cast_core/cast_runtime_service.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2021 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 CHROMECAST_CAST_CORE_CAST_RUNTIME_SERVICE_H_
#define CHROMECAST_CAST_CORE_CAST_RUNTIME_SERVICE_H_

#include <memory>

#include "chromecast/media/cma/backend/proxy/cast_runtime_audio_channel_endpoint_manager.h"
#include "chromecast/service/cast_service.h"

namespace chromecast {

class WebCryptoServer;

namespace receiver {
class MediaManager;
} // namespace receiver

namespace media {

// This interface is to be used for building the Cast Runtime Service and act as
// the border between shared Chromium code and the specifics of that
// implementation.
//
// NOTE: When adding a new interface to this class, first add it to all
// implementations of this interface in downstream repos. Else, the roll of this
// code into those repos will break.
class CastRuntimeService : public CastService,
public CastRuntimeAudioChannelEndpointManager {
public:
// Returns current instance of CastRuntimeService in the browser process.
// TODO(rwkeane): After dependent repos have implemented this interface,
// implement it in public Chromium as-well. Do not implement before then, to
// ensure that integration cross-repo remains relatively simple.
static CastRuntimeService* GetInstance();

CastRuntimeService();
~CastRuntimeService() override;

virtual WebCryptoServer* GetWebCryptoServer() = 0;
virtual receiver::MediaManager* GetMediaManager() = 0;
};

} // namespace media
} // namespace chromecast

#endif // CHROMECAST_CAST_CORE_CAST_RUNTIME_SERVICE_H_
97 changes: 52 additions & 45 deletions chromecast/media/cma/backend/proxy/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,54 +24,61 @@ template("chromecast_media_grpc_library") {
}
}

chromecast_media_grpc_library("cast_audio_decoder_service_proto") {
# This rule cannot be built on android because it causes linker issues,
# as both `protobuf_lite` and `protobuf_full` are present.
assert(!is_android)

sources = [ "//third_party/openscreen/src/cast/cast_core/api/runtime/cast_audio_channel_service.proto" ]
cast_source_set("headers") {
sources = [ "cast_runtime_audio_channel_endpoint_manager.h" ]
}

cast_source_set("proxy") {
sources = [
"audio_channel_broker_impl.cc",
"audio_channel_broker_impl.h",
"audio_channel_push_buffer_handler.h",
"audio_decoder_pipeline_node.cc",
"audio_decoder_pipeline_node.h",
"buffer_id_manager.cc",
"buffer_id_manager.h",
"cast_runtime_audio_channel_broker.cc",
"cast_runtime_audio_channel_broker.h",
"cast_runtime_audio_channel_endpoint_manager.h",
"cma_backend_proxy.cc",
"cma_backend_proxy.h",
"cma_proxy_handler.h",
"media_pipeline_buffer_extension.cc",
"media_pipeline_buffer_extension.h",
"multizone_audio_decoder_proxy.h",
"multizone_audio_decoder_proxy_impl.cc",
"multizone_audio_decoder_proxy_impl.h",
"proxy_call_translator.cc",
"proxy_call_translator.h",
"push_buffer_pending_handler.cc",
"push_buffer_pending_handler.h",
"push_buffer_queue.cc",
"push_buffer_queue.h",
]
if (!is_android) {
chromecast_media_grpc_library("cast_audio_decoder_service_proto") {
# This rule cannot be built on android because it causes linker issues,
# as both `protobuf_lite` and `protobuf_full` are present.

sources = [ "//third_party/openscreen/src/cast/cast_core/api/runtime/cast_audio_channel_service.proto" ]
}

cast_source_set("proxy") {
assert(!is_android)

sources = [
"audio_channel_broker_impl.cc",
"audio_channel_broker_impl.h",
"audio_channel_push_buffer_handler.h",
"audio_decoder_pipeline_node.cc",
"audio_decoder_pipeline_node.h",
"buffer_id_manager.cc",
"buffer_id_manager.h",
"cast_runtime_audio_channel_broker.cc",
"cast_runtime_audio_channel_broker.h",
"cma_backend_proxy.cc",
"cma_backend_proxy.h",
"cma_proxy_handler.h",
"media_pipeline_buffer_extension.cc",
"media_pipeline_buffer_extension.h",
"multizone_audio_decoder_proxy.h",
"multizone_audio_decoder_proxy_impl.cc",
"multizone_audio_decoder_proxy_impl.h",
"proxy_call_translator.cc",
"proxy_call_translator.h",
"push_buffer_pending_handler.cc",
"push_buffer_pending_handler.h",
"push_buffer_queue.cc",
"push_buffer_queue.h",
]

deps = [
":cast_audio_decoder_service_proto",
"//base",
"//chromecast/base",
"//chromecast/media/api",
"//chromecast/public/media",
"//third_party/grpc:grpc++",
"//third_party/protobuf:protobuf_full",
]
deps = [
":cast_audio_decoder_service_proto",
":headers",
"//base",
"//chromecast/base",
"//chromecast/media/api",
"//chromecast/public/media",
"//third_party/grpc:grpc++",
"//third_party/protobuf:protobuf_full",
]

if (!enable_chromium_runtime_cast_renderer ||
chromecast_branding == "public") {
sources += [ "cast_runtime_audio_channel_endpoint_simple.cc" ]
if (!enable_chromium_runtime_cast_renderer ||
chromecast_branding == "public") {
sources += [ "cast_runtime_audio_channel_endpoint_simple.cc" ]
}
}
}

0 comments on commit a7da67b

Please sign in to comment.