aboutsummaryrefslogtreecommitdiff
path: root/cast/cast_core/api
diff options
context:
space:
mode:
Diffstat (limited to 'cast/cast_core/api')
-rw-r--r--cast/cast_core/api/BUILD.gn171
-rw-r--r--cast/cast_core/api/bindings/api_bindings.proto6
-rw-r--r--cast/cast_core/api/common/application_config.proto2
-rw-r--r--cast/cast_core/api/common/runtime_metadata.proto5
-rw-r--r--cast/cast_core/api/common/service_info.proto2
-rw-r--r--cast/cast_core/api/core/cast_core_service.proto36
-rw-r--r--cast/cast_core/api/metrics/metrics_recorder.proto12
-rw-r--r--cast/cast_core/api/platform/platform_service.proto7
-rw-r--r--cast/cast_core/api/runtime/cast_audio_channel_service.proto (renamed from cast/cast_core/api/runtime/cast_audio_decoder_service.proto)328
-rw-r--r--cast/cast_core/api/runtime/runtime_service.proto74
-rw-r--r--cast/cast_core/api/v2/cast_message.proto4
-rw-r--r--cast/cast_core/api/v2/core_application_service.proto38
-rw-r--r--cast/cast_core/api/v2/core_message_port_application_service.proto30
-rw-r--r--cast/cast_core/api/v2/core_v2_application_service.proto19
-rw-r--r--cast/cast_core/api/v2/runtime_application_service.proto28
-rw-r--r--cast/cast_core/api/v2/runtime_message_port_application_service.proto21
-rw-r--r--cast/cast_core/api/v2/runtime_v2_application_service.proto19
-rw-r--r--cast/cast_core/api/v2/url_rewrite.proto2
-rw-r--r--cast/cast_core/api/web/message_channel.proto2
19 files changed, 554 insertions, 252 deletions
diff --git a/cast/cast_core/api/BUILD.gn b/cast/cast_core/api/BUILD.gn
new file mode 100644
index 00000000..dd9ff283
--- /dev/null
+++ b/cast/cast_core/api/BUILD.gn
@@ -0,0 +1,171 @@
+# 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("//third_party/grpc/grpc_library.gni")
+import("//third_party/protobuf/proto_library.gni")
+
+# NOTE: Our local lite versions of the builtin protos have to retain their
+# "google/protobuf" path in order to generate certain correct symbols. However,
+# this leads to include confusion with the default committed full versions. The
+# work-around is to force an extra include path to reach our local compiled
+# versions.
+config("force_local_well_known_protos") {
+ include_dirs = [ "$target_gen_dir" ]
+}
+
+proto_library("base_protos") {
+ generate_python = false
+ proto_in_dir = "//third_party/protobuf/src"
+ proto_out_dir = rebase_path(".", "//")
+ sources = [ "//third_party/protobuf/src/google/protobuf/duration.proto" ]
+ cc_generator_options = "lite"
+ extra_configs = [ ":force_local_well_known_protos" ]
+}
+
+template("cast_core_proto_library_base") {
+ target(invoker.target_type, target_name) {
+ proto_in_dir = "//" + rebase_path("../../..", "//")
+ generate_python = false
+
+ # NOTE: For using built-in proto files like empty.proto.
+ import_dirs = [ "//third_party/protobuf/src" ]
+
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "sources",
+ ])
+ if (!defined(deps)) {
+ deps = []
+ }
+ deps += [ ":base_protos" ]
+ extra_configs = [ ":force_local_well_known_protos" ]
+ }
+}
+
+# For .proto files without RPC definitions.
+template("cast_core_proto_library") {
+ cast_core_proto_library_base(target_name) {
+ target_type = "proto_library"
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "sources",
+ ])
+ }
+}
+
+# For .proto files with RPC definitions.
+template("cast_core_grpc_library") {
+ cast_core_proto_library_base(target_name) {
+ target_type = "grpc_library"
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "sources",
+ ])
+ }
+}
+
+group("api") {
+ public_deps = [
+ ":api_bindings_proto",
+ ":application_config_proto",
+ ":cast_audio_channel_service_proto",
+ ":cast_core_service_proto",
+ ":cast_message_proto",
+ ":core_application_service_proto",
+ ":message_channel_proto",
+ ":metrics_recorder_proto",
+ ":platform_service_proto",
+ ":runtime_application_service_proto",
+ ":runtime_message_port_application_service_proto",
+ ":runtime_metadata_proto",
+ ":runtime_service_proto",
+ ":service_info_proto",
+ ":url_rewrite_proto",
+ ]
+}
+
+cast_core_proto_library("api_bindings_proto") {
+ sources = [ "bindings/api_bindings.proto" ]
+ deps = [ ":message_channel_proto" ]
+}
+
+cast_core_proto_library("application_config_proto") {
+ sources = [ "common/application_config.proto" ]
+}
+
+cast_core_proto_library("runtime_metadata_proto") {
+ sources = [ "common/runtime_metadata.proto" ]
+}
+
+cast_core_proto_library("service_info_proto") {
+ sources = [ "common/service_info.proto" ]
+}
+
+cast_core_grpc_library("cast_core_service_proto") {
+ sources = [ "core/cast_core_service.proto" ]
+ deps = [ ":runtime_metadata_proto" ]
+}
+
+cast_core_grpc_library("platform_service_proto") {
+ sources = [ "platform/platform_service.proto" ]
+ deps = [ ":service_info_proto" ]
+}
+
+cast_core_grpc_library("cast_audio_channel_service_proto") {
+ sources = [ "runtime/cast_audio_channel_service.proto" ]
+}
+
+cast_core_grpc_library("runtime_service_proto") {
+ sources = [ "runtime/runtime_service.proto" ]
+ deps = [
+ ":application_config_proto",
+ ":service_info_proto",
+ ":url_rewrite_proto",
+ ]
+}
+
+cast_core_proto_library("cast_message_proto") {
+ sources = [ "v2/cast_message.proto" ]
+}
+
+cast_core_grpc_library("core_application_service_proto") {
+ sources = [ "v2/core_application_service.proto" ]
+ deps = [
+ ":api_bindings_proto",
+ ":application_config_proto",
+ ":cast_message_proto",
+ ":message_channel_proto",
+ ":service_info_proto",
+ ":url_rewrite_proto",
+ ]
+}
+
+cast_core_grpc_library("runtime_application_service_proto") {
+ sources = [ "v2/runtime_application_service.proto" ]
+ deps = [
+ ":cast_message_proto",
+ ":message_channel_proto",
+ ":url_rewrite_proto",
+ ]
+}
+
+cast_core_grpc_library("runtime_message_port_application_service_proto") {
+ sources = [ "v2/runtime_message_port_application_service.proto" ]
+ deps = [ ":message_channel_proto" ]
+}
+
+cast_core_proto_library("url_rewrite_proto") {
+ sources = [ "v2/url_rewrite.proto" ]
+}
+
+cast_core_proto_library("message_channel_proto") {
+ sources = [ "web/message_channel.proto" ]
+}
+
+cast_core_grpc_library("metrics_recorder_proto") {
+ sources = [ "metrics/metrics_recorder.proto" ]
+}
diff --git a/cast/cast_core/api/bindings/api_bindings.proto b/cast/cast_core/api/bindings/api_bindings.proto
index 0fc9c43d..f275e122 100644
--- a/cast/cast_core/api/bindings/api_bindings.proto
+++ b/cast/cast_core/api/bindings/api_bindings.proto
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.bindings;
@@ -16,6 +16,8 @@ message ApiBinding {
string before_load_script = 1;
}
+message GetAllRequest {}
+
message GetAllResponse {
repeated ApiBinding bindings = 1;
}
@@ -24,3 +26,5 @@ message ConnectRequest {
string port_name = 1;
cast.web.MessagePortDescriptor port = 2;
}
+
+message ConnectResponse {}
diff --git a/cast/cast_core/api/common/application_config.proto b/cast/cast_core/api/common/application_config.proto
index cb426824..d49d077e 100644
--- a/cast/cast_core/api/common/application_config.proto
+++ b/cast/cast_core/api/common/application_config.proto
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.common;
diff --git a/cast/cast_core/api/common/runtime_metadata.proto b/cast/cast_core/api/common/runtime_metadata.proto
index b8cc0919..734ad36f 100644
--- a/cast/cast_core/api/common/runtime_metadata.proto
+++ b/cast/cast_core/api/common/runtime_metadata.proto
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.common;
@@ -56,9 +56,6 @@ message RuntimeCapabilities {
ApplicationCapabilities native_application_capabilities = 2;
}
- // Flags if heartbeat is supported.
- bool heartbeat_supported = 3;
-
// Flags if metrics recording is supported.
bool metrics_recorder_supported = 4;
}
diff --git a/cast/cast_core/api/common/service_info.proto b/cast/cast_core/api/common/service_info.proto
index e8dc7dd1..2d3539b9 100644
--- a/cast/cast_core/api/common/service_info.proto
+++ b/cast/cast_core/api/common/service_info.proto
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.common;
diff --git a/cast/cast_core/api/core/cast_core_service.proto b/cast/cast_core/api/core/cast_core_service.proto
index af8c0ad8..28ec7e05 100644
--- a/cast/cast_core/api/core/cast_core_service.proto
+++ b/cast/cast_core/api/core/cast_core_service.proto
@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.core;
-import "google/protobuf/empty.proto";
import "cast/cast_core/api/common/runtime_metadata.proto";
-import "cast/cast_core/api/common/service_info.proto";
option optimize_for = LITE_RUNTIME;
@@ -21,42 +19,24 @@ service CastCoreService {
// Unregisters a Cast Runtime. Usually called by platform.
rpc UnregisterRuntime(UnregisterRuntimeRequest)
returns (UnregisterRuntimeResponse);
-
- // Called by the Runtime when it starts up.
- rpc RuntimeStarted(RuntimeStartedNotification)
- returns (google.protobuf.Empty);
-
- // Called when the runtime is shutdown. May be called for an active Cast
- // session.
- rpc RuntimeStopped(RuntimeStoppedNotification)
- returns (google.protobuf.Empty);
}
message RegisterRuntimeRequest {
- // Platform-generated runtime ID associated with this runtime. Uniqueness is
- // guaranteed by the CastCore service.
- string runtime_id = 1;
+ // DEPRECATED.
+ string runtime_id = 1 [deprecated = true];
// Metadata about the runtime.
cast.common.RuntimeMetadata runtime_metadata = 2;
}
-message RegisterRuntimeResponse {}
-
-message UnregisterRuntimeRequest {
- // Runtime ID.
+message RegisterRuntimeResponse {
+ // A randomly generated runtime ID. Cast Core will use this ID to reference a
+ // particular Runtime.
string runtime_id = 1;
}
-message UnregisterRuntimeResponse {}
-
-message RuntimeStartedNotification {
+message UnregisterRuntimeRequest {
// Runtime ID.
string runtime_id = 1;
- // Runtime service info.
- cast.common.ServiceInfo runtime_service_info = 2;
}
-message RuntimeStoppedNotification {
- // Runtime ID.
- string runtime_id = 1;
-}
+message UnregisterRuntimeResponse {}
diff --git a/cast/cast_core/api/metrics/metrics_recorder.proto b/cast/cast_core/api/metrics/metrics_recorder.proto
index d7a04950..16c2ee04 100644
--- a/cast/cast_core/api/metrics/metrics_recorder.proto
+++ b/cast/cast_core/api/metrics/metrics_recorder.proto
@@ -2,24 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.metrics;
-import "google/protobuf/empty.proto";
-
option optimize_for = LITE_RUNTIME;
service MetricsRecorderService {
// Record a set of|Event|
- rpc Record(RecordRequest) returns (google.protobuf.Empty);
+ rpc Record(RecordRequest) returns (RecordResponse);
}
message RecordRequest {
repeated Event event = 1;
}
+message RecordResponse {}
+
// This repliciates the Fuchsia approach to Cast metrics; for documentation on
// event structure, refer to
// fuchsia.googlesource.com/fuchsia/+/master/sdk/fidl/fuchsia.legacymetrics/event.fidl
@@ -33,7 +33,7 @@ message Event {
message UserActionEvent {
string name = 1;
- optional int64 time = 2;
+ int64 time = 2;
}
message Histogram {
@@ -50,5 +50,5 @@ message HistogramBucket {
message ImplementationDefinedEvent {
bytes data = 1;
- optional string name = 2;
+ string name = 2;
}
diff --git a/cast/cast_core/api/platform/platform_service.proto b/cast/cast_core/api/platform/platform_service.proto
index 7e2ad5f5..6ecb7d49 100644
--- a/cast/cast_core/api/platform/platform_service.proto
+++ b/cast/cast_core/api/platform/platform_service.proto
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.platform;
+import "cast/cast_core/api/common/service_info.proto";
+
option optimize_for = LITE_RUNTIME;
// Platform service. Implemented and hosted by Platform.
@@ -23,7 +25,10 @@ service PlatformService {
}
message StartRuntimeRequest {
+ // Cast Runtime ID assigned in CastCoreService.RegisterRuntime.
string runtime_id = 1;
+ // gRPC endpoint Cast Runtime must run on.
+ cast.common.ServiceInfo runtime_service_info = 2;
}
message StartRuntimeResponse {}
diff --git a/cast/cast_core/api/runtime/cast_audio_decoder_service.proto b/cast/cast_core/api/runtime/cast_audio_channel_service.proto
index f6916cb4..61c9c658 100644
--- a/cast/cast_core/api/runtime/cast_audio_decoder_service.proto
+++ b/cast/cast_core/api/runtime/cast_audio_channel_service.proto
@@ -2,16 +2,182 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.media;
import "google/protobuf/duration.proto";
-import "google/protobuf/empty.proto";
option optimize_for = LITE_RUNTIME;
+// Cast audio service hosted by Cast Core.
+//
+// It defines a state machine with the following states:
+// - Uninitialized
+// - Playing
+// - Stopped
+// - Paused
+//
+// Note that the received ordering between different RPC calls is not
+// guaranteed to match the sent order.
+service CastAudioChannelService {
+ // Initializes the service and places the pipeline into the 'Stopped' state.
+ // This must be the first call received by the server, and no other calls
+ // may be sent prior to receiving this call's response.
+ rpc Initialize(InitializeRequest) returns (InitializeResponse);
+
+ // Returns the minimum buffering delay (min_delay) required by Cast. This is
+ // a constant value and only needs to be queried once for each service.
+ // During a StartRequest or ResumeRequest, the system timestamp must be
+ // greater than this delay and the current time in order for the buffer to be
+ // successfully rendered on remote devices.
+ rpc GetMinimumBufferDelay(GetMinimumBufferDelayRequest)
+ returns (GetMinimumBufferDelayResponse);
+
+ // Update the pipeline state.
+ //
+ // StartRequest:
+ // Places pipeline into 'Playing' state. Playback will start at the
+ // specified buffer and system timestamp.
+ //
+ // May only be called in the 'Stopped' state, and following this call the
+ // state machine will be in the 'Playing' state.
+ //
+ // StopRequest
+ // Stops media playback and drops all pushed buffers which have not yet been
+ // played.
+ //
+ // May only be called in the 'Playing' or 'Paused' states, and following
+ // this call the state machine will be in the 'Stopped' state.
+ //
+ // PauseRequest
+ // Pauses media playback.
+ //
+ // May only be called in the 'Playing' state, and following this call the
+ // state machine will be in the 'Paused' state.
+ //
+ // ResumeRequest
+ // Resumes media playback at the specified buffer and system timestamp.
+ //
+ // May only be called in the 'Paused' state, and following this call the
+ // state machine will be in the 'Playing'' state.
+ //
+ // TimestampUpdateRequest
+ // Sends a timestamp update for a specified buffer for audio
+ // synchronization. This should be called when operating in
+ // CAST_AUDIO_DECODER_MODE_MULTIROOM_ONLY when the runtime has detected a
+ // discrepancy in the system clock or pipeline delay from the original
+ // playback schedule. See example below:
+ //
+ // Assume all buffers have duration of 100us.
+ //
+ // StartRequest(id=1, system_timestamp=0);
+ // -> Cast expects id=1 to play at 0, id=2 at 100us, id=3 at 200 us...
+ //
+ // TimestampUpdateRequest(id=4, system_timestamp=405us);
+ // -> Cast expects id=4 to play at 405, id=5 at 505us, id=6 at 605 us...
+ //
+ // May be called from any state.
+ //
+ // A state transition may only occur after a successful PushBuffer()
+ // call has been made with a valid configuration.
+ rpc StateChange(StateChangeRequest) returns (StateChangeResponse);
+
+ // Sets the volume multiplier for this audio stream.
+ // The multiplier is in the range [0.0, 1.0]. If not called, a default
+ // multiplier of 1.0 is assumed.
+ //
+ // May be called in any state, and following this call the state machine
+ // will be in the same state.
+ rpc SetVolume(SetVolumeRequest) returns (SetVolumeResponse);
+
+ // Sets the playback rate for this audio stream.
+ //
+ // May be called in any state, and following this call the state machine
+ // will be in the same state.
+ rpc SetPlaybackRate(SetPlaybackRateRequest) returns (SetPlaybackRateResponse);
+
+ // Sends decoded bits and responses to the audio service. The client must
+ // wait for a response from the server before sending another
+ // PushBufferRequest.
+ //
+ // May only be called in the 'Playing' or 'Paused' states, and following
+ // this call the state machine will remain the same state.
+ //
+ rpc PushBuffer(PushBufferRequest) returns (PushBufferResponse);
+
+ // Returns the current media time that has been rendered.
+ rpc GetMediaTime(GetMediaTimeRequest) returns (GetMediaTimeResponse);
+}
+
+message InitializeRequest {
+ // Cast session ID.
+ string cast_session_id = 1;
+
+ // Configures how the server should operate.
+ CastAudioDecoderMode mode = 2;
+}
+
+message InitializeResponse {}
+
+message GetMinimumBufferDelayRequest {}
+
+message GetMinimumBufferDelayResponse {
+ // The minimum buffering delay in microseconds.
+ int64 delay_micros = 1;
+}
+
+message StateChangeRequest {
+ oneof request {
+ StartRequest start = 1;
+ StopRequest stop = 2;
+ PauseRequest pause = 3;
+ ResumeRequest resume = 4;
+ TimestampUpdateRequest timestamp_update = 5;
+ }
+}
+
+message StateChangeResponse {
+ // Pipeline state after state change.
+ PipelineState state = 1;
+}
+
+message SetVolumeRequest {
+ // The multiplier is in the range [0.0, 1.0].
+ float multiplier = 1;
+}
+
+message SetVolumeResponse {}
+
+message SetPlaybackRateRequest {
+ // Playback rate greater than 0.
+ double rate = 1;
+}
+
+message SetPlaybackRateResponse {}
+
+message PushBufferRequest {
+ AudioDecoderBuffer buffer = 1;
+
+ // Audio configuration for this buffer and all subsequent buffers. This
+ // field must be populated for the first request or if there is an audio
+ // configuration change.
+ AudioConfiguration audio_config = 2;
+}
+
+message PushBufferResponse {
+ // The total number of decoded bytes.
+ int64 decoded_bytes = 1;
+}
+
+message GetMediaTimeRequest {}
+
+message GetMediaTimeResponse {
+ // The current media time that has been rendered.
+ MediaTime media_time = 1;
+}
+
enum PipelineState {
PIPELINE_STATE_UNINITIALIZED = 0;
PIPELINE_STATE_STOPPED = 1;
@@ -142,19 +308,6 @@ message TimestampInfo {
int64 buffer_id = 2;
}
-message InitializeRequest {
- // Cast session ID.
- string cast_session_id = 1;
-
- // Configures how the server should operate.
- CastAudioDecoderMode mode = 2;
-}
-
-message GetMinimumBufferingDelayResponse {
- // The minimum buffering delay in microseconds.
- int64 delay_micros = 1;
-}
-
message StartRequest {
// The start presentation timestamp in microseconds.
int64 pts_micros = 1;
@@ -179,148 +332,3 @@ message ResumeRequest {
message TimestampUpdateRequest {
TimestampInfo timestamp_info = 1;
}
-
-message StateChangeRequest {
- oneof request {
- StartRequest start = 1;
- StopRequest stop = 2;
- PauseRequest pause = 3;
- ResumeRequest resume = 4;
- TimestampUpdateRequest timestamp_update = 5;
- }
-}
-
-message StateChangeResponse {
- // Pipeline state after state change.
- PipelineState state = 1;
-}
-
-message PushBufferRequest {
- AudioDecoderBuffer buffer = 1;
-
- // Audio configuration for this buffer and all subsequent buffers. This
- // field must be populated for the first request or if there is an audio
- // configuration change.
- AudioConfiguration audio_config = 2;
-}
-
-message PushBufferResponse {
- // The total number of decoded bytes.
- int64 decoded_bytes = 1;
-}
-
-message SetVolumeRequest {
- // The multiplier is in the range [0.0, 1.0].
- float multiplier = 1;
-}
-message SetPlaybackRateRequest {
- // Playback rate greater than 0.
- double rate = 1;
-}
-
-message GetMediaTimeResponse {
- // The current media time that has been rendered.
- MediaTime media_time = 1;
-}
-
-// Cast audio service hosted by Cast Core.
-//
-// It defines a state machine with the following states:
-// - Uninitialized
-// - Playing
-// - Stopped
-// - Paused
-//
-// Note that the received ordering between different RPC calls is not
-// guaranteed to match the sent order.
-service CastRuntimeAudioChannel {
- // Initializes the service and places the pipeline into the 'Stopped' state.
- // This must be the first call received by the server, and no other calls
- // may be sent prior to receiving this call's response.
- rpc Initialize(InitializeRequest) returns (google.protobuf.Empty);
-
- // Returns the minimum buffering delay (min_delay) required by Cast. This is
- // a constant value and only needs to be queried once for each service.
- // During a StartRequest or ResumeRequest, the system timestamp must be
- // greater than this delay and the current time in order for the buffer to be
- // successfully rendered on remote devices.
- rpc GetMinimumBufferDelay(google.protobuf.Empty)
- returns (GetMinimumBufferingDelayResponse);
-
- // Update the pipeline state.
- //
- // StartRequest:
- // Places pipeline into 'Playing' state. Playback will start at the
- // specified buffer and system timestamp.
- //
- // May only be called in the 'Stopped' state, and following this call the
- // state machine will be in the 'Playing' state.
- //
- // StopRequest
- // Stops media playback and drops all pushed buffers which have not yet been
- // played.
- //
- // May only be called in the 'Playing' or 'Paused' states, and following
- // this call the state machine will be in the 'Stopped' state.
- //
- // PauseRequest
- // Pauses media playback.
- //
- // May only be called in the 'Playing' state, and following this call the
- // state machine will be in the 'Paused' state.
- //
- // ResumeRequest
- // Resumes media playback at the specified buffer and system timestamp.
- //
- // May only be called in the 'Paused' state, and following this call the
- // state machine will be in the 'Playing'' state.
- //
- // TimestampUpdateRequest
- // Sends a timestamp update for a specified buffer for audio
- // synchronization. This should be called when operating in
- // CAST_AUDIO_DECODER_MODE_MULTIROOM_ONLY when the runtime has detected a
- // discrepancy in the system clock or pipeline delay from the original
- // playback schedule. See example below:
- //
- // Assume all buffers have duration of 100us.
- //
- // StartRequest(id=1, system_timestamp=0);
- // -> Cast expects id=1 to play at 0, id=2 at 100us, id=3 at 200 us...
- //
- // TimestampUpdateRequest(id=4, system_timestamp=405us);
- // -> Cast expects id=4 to play at 405, id=5 at 505us, id=6 at 605 us...
- //
- // May be called from any state.
- //
- // A state transition may only occur after a successful PushBuffer()
- // call has been made with a valid configuration.
- rpc StateChange(StateChangeRequest) returns (StateChangeResponse);
-
- // Sets the volume multiplier for this audio stream.
- // The multiplier is in the range [0.0, 1.0]. If not called, a default
- // multiplier of 1.0 is assumed.
- //
- // May be called in any state, and following this call the state machine
- // will be in the same state.
- rpc SetVolume(SetVolumeRequest) returns (google.protobuf.Empty);
-
- // Sets the playback rate for this audio stream.
- //
- // May be called in any state, and following this call the state machine
- // will be in the same state.
- rpc SetPlayback(SetPlaybackRateRequest) returns (google.protobuf.Empty);
-
- // Sends decoded bits and responses to the audio service. The client must
- // wait for a response from the server before sending another
- // PushBufferRequest.
- //
- // May only be called in the 'Playing' or 'Paused' states, and following
- // this call the state machine will remain the same state.
- //
- // TODO(b/178523159): validate that this isn't a performance bottleneck as a
- // non-streaming API. If it is, we should make this a bidirectional stream.
- rpc PushBuffer(PushBufferRequest) returns (PushBufferResponse);
-
- // Returns the current media time that has been rendered.
- rpc GetMediaTime(google.protobuf.Empty) returns (GetMediaTimeResponse);
-}
diff --git a/cast/cast_core/api/runtime/runtime_service.proto b/cast/cast_core/api/runtime/runtime_service.proto
index 084852eb..0ea47daa 100644
--- a/cast/cast_core/api/runtime/runtime_service.proto
+++ b/cast/cast_core/api/runtime/runtime_service.proto
@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.runtime;
import "google/protobuf/duration.proto";
-import "google/protobuf/empty.proto";
+import "cast/cast_core/api/common/application_config.proto";
import "cast/cast_core/api/common/service_info.proto";
+import "cast/cast_core/api/v2/url_rewrite.proto";
option optimize_for = LITE_RUNTIME;
@@ -17,9 +18,12 @@ option optimize_for = LITE_RUNTIME;
//
// This service is called by CastCore after Runtime starts up.
service RuntimeService {
+ // Loads a Cast application. The runtime must start its
+ // RuntimeApplicationService on runtime_application_service_info.
+ rpc LoadApplication(LoadApplicationRequest) returns (LoadApplicationResponse);
+
// Launches a Cast application. The application must connect to the
- // CoreApplicationService based on cast_protocol and
- // core_application_endpoint, and provide its endpoint.
+ // CoreApplicationService via core_application_service_info.
rpc LaunchApplication(LaunchApplicationRequest)
returns (LaunchApplicationResponse);
@@ -38,24 +42,57 @@ service RuntimeService {
// Provides information need by the runtime to start recording metrics via
// the core.
rpc StartMetricsRecorder(StartMetricsRecorderRequest)
- returns (google.protobuf.Empty);
+ returns (StartMetricsRecorderResponse);
// Stops the metrics recorder, which may also attempt to flush.
- rpc StopMetricsRecorder(google.protobuf.Empty)
- returns (google.protobuf.Empty);
+ rpc StopMetricsRecorder(StopMetricsRecorderRequest)
+ returns (StopMetricsRecorderResponse);
}
-message StartMetricsRecorderRequest {
- // Metrics service info.
- cast.common.ServiceInfo metrics_recorder_service_info = 1;
+message LoadApplicationRequest {
+ // Cast application config.
+ cast.common.ApplicationConfig application_config = 1;
+ // Initial rules to rewrite URLs and headers.
+ cast.v2.UrlRequestRewriteRules url_rewrite_rules = 2;
+ // Cast session id used to setup a connection and pull the config from core
+ // application service.
+ string cast_session_id = 3;
+ // RuntimeApplication service info. The endpoint is generated by Cast Core and
+ // must be used by the Runtime to bind the RuntimeApplication service.
+ cast.common.ServiceInfo runtime_application_service_info = 4;
+}
+
+// Info relevant to a V2 channel between the runtime and cast core.
+message V2ChannelInfo {
+ // If set, only messages within these namespaces will be sent to the runtime.
+ // If empty, all V2 messages will be sent to the runtime regardless of
+ // namespace.
+ repeated string requested_namespaces = 1;
+}
+
+// Info relevant to a MessagePort channel between the runtime and cast core.
+message MessagePortInfo {}
+
+message LoadApplicationResponse {
+ // One of these fields must be set. This specifies what type of communication
+ // channel should be used to communicate between the runtime and cast core for
+ // the given application.
+ oneof channel_type {
+ V2ChannelInfo v2_info = 1;
+ MessagePortInfo message_port_info = 2;
+ }
}
message LaunchApplicationRequest {
// CoreApplication service info.
cast.common.ServiceInfo core_application_service_info = 1;
- // Cast session id used to setup a connection and pull the config from core
- // application service.
- string cast_session_id = 2;
+ // DEPRECATED
+ string cast_session_id = 2 [deprecated = true];
+ // DEPRECATED
+ cast.common.ServiceInfo runtime_application_service_info = 3
+ [deprecated = true];
+ // CastMedia service info for this application in CastCore.
+ cast.common.ServiceInfo cast_media_service_info = 4;
}
// Returned by the runtime in response to a launch application request.
@@ -82,3 +119,14 @@ message HeartbeatRequest {
}
message HeartbeatResponse {}
+
+message StartMetricsRecorderRequest {
+ // Metrics service info.
+ cast.common.ServiceInfo metrics_recorder_service_info = 1;
+}
+
+message StartMetricsRecorderResponse {}
+
+message StopMetricsRecorderRequest {}
+
+message StopMetricsRecorderResponse {}
diff --git a/cast/cast_core/api/v2/cast_message.proto b/cast/cast_core/api/v2/cast_message.proto
index 72575264..639c3aaf 100644
--- a/cast/cast_core/api/v2/cast_message.proto
+++ b/cast/cast_core/api/v2/cast_message.proto
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.v2;
@@ -10,7 +10,7 @@ package cast.v2;
option optimize_for = LITE_RUNTIME;
// Cast V2 request definition.
-message CastMessage {
+message CastMessageRequest {
// Cast sender ID; distinct from virtual connection source ID.
string sender_id = 1;
// Cast namespace.
diff --git a/cast/cast_core/api/v2/core_application_service.proto b/cast/cast_core/api/v2/core_application_service.proto
index 7933393b..3a31f7b2 100644
--- a/cast/cast_core/api/v2/core_application_service.proto
+++ b/cast/cast_core/api/v2/core_application_service.proto
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.v2;
-import "google/protobuf/empty.proto";
import "cast/cast_core/api/bindings/api_bindings.proto";
import "cast/cast_core/api/common/application_config.proto";
import "cast/cast_core/api/common/service_info.proto";
@@ -25,32 +24,41 @@ service CoreApplicationService {
// the gRPC status code.
rpc GetConfig(GetConfigRequest) returns (GetConfigResponse);
+ // DEPRECATED
// Send a Cast V2 message to core application.
- rpc SendCastMessage(CastMessage) returns (CastMessageResponse);
+ rpc SendCastMessage(CastMessageRequest) returns (CastMessageResponse);
// Notifies Cast Core on the application state changes. The callback must be
// called by the Runtime whenever the internal state of the application
// changes. Cast Core may discard any resources associated with the
// application upon failures.
- rpc OnApplicationStatus(ApplicationStatus) returns (google.protobuf.Empty);
+ rpc SetApplicationStatus(ApplicationStatusRequest)
+ returns (ApplicationStatusResponse);
+ // DEPRECATED
// Posts messages between MessagePorts. MessagePorts are connected using other
// services (e.g. ApiBindings), then registered with the
// MessageConnectorService to communicate over IPC.
rpc PostMessage(cast.web.Message) returns (cast.web.MessagePortStatus);
+ // DEPRECATED
// Gets the list of bindings to early-inject into javascript at page load.
- rpc GetAll(google.protobuf.Empty) returns (cast.bindings.GetAllResponse);
+ rpc GetAll(cast.bindings.GetAllRequest)
+ returns (cast.bindings.GetAllResponse);
+ // DEPRECATED
// Connects to a binding returned by GetAll.
- rpc Connect(cast.bindings.ConnectRequest) returns (google.protobuf.Empty);
+ rpc Connect(cast.bindings.ConnectRequest)
+ returns (cast.bindings.ConnectResponse);
+
+ // GetWebUIResource request
+ rpc GetWebUIResource(GetWebUIResourceRequest)
+ returns (GetWebUIResourceResponse);
}
message GetConfigRequest {
// Cast session ID.
string cast_session_id = 1;
- // RuntimeApplication service info.
- cast.common.ServiceInfo runtime_application_service_info = 2;
}
message GetConfigResponse {
@@ -63,7 +71,7 @@ message GetConfigResponse {
}
// Contains information about an application status in the runtime.
-message ApplicationStatus {
+message ApplicationStatusRequest {
// The Cast session ID whose application status changed.
string cast_session_id = 1;
@@ -94,3 +102,15 @@ message ApplicationStatus {
// |stop_reason| is HTTP_ERROR.
int32 http_response_code = 4;
}
+
+message ApplicationStatusResponse {}
+
+message GetWebUIResourceRequest {
+ // Resource identifier. It can either be name of the resource or a url.
+ string resource_id = 1;
+}
+
+message GetWebUIResourceResponse {
+ // Path to the resource file on device.
+ string resource_path = 1;
+}
diff --git a/cast/cast_core/api/v2/core_message_port_application_service.proto b/cast/cast_core/api/v2/core_message_port_application_service.proto
new file mode 100644
index 00000000..9dcd918e
--- /dev/null
+++ b/cast/cast_core/api/v2/core_message_port_application_service.proto
@@ -0,0 +1,30 @@
+// 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.
+//
+// **** DO NOT EDIT - this file was automatically generated. ****
+syntax = "proto3";
+
+package cast.v2;
+
+import "cast/cast_core/api/bindings/api_bindings.proto";
+import "cast/cast_core/api/web/message_channel.proto";
+
+option optimize_for = LITE_RUNTIME;
+
+// This service runs in Cast Core for a particular app. It uses a MessagePort to
+// communicate with the app.
+service CoreMessagePortApplicationService {
+ // Posts messages between MessagePorts. MessagePorts are connected using other
+ // services (e.g. ApiBindings), then registered with the
+ // MessageConnectorService to communicate over IPC.
+ rpc PostMessage(cast.web.Message) returns (cast.web.MessagePortStatus);
+
+ // Gets the list of bindings to early-inject into javascript at page load.
+ rpc GetAll(cast.bindings.GetAllRequest)
+ returns (cast.bindings.GetAllResponse);
+
+ // Connects to a binding returned by GetAll.
+ rpc Connect(cast.bindings.ConnectRequest)
+ returns (cast.bindings.ConnectResponse);
+}
diff --git a/cast/cast_core/api/v2/core_v2_application_service.proto b/cast/cast_core/api/v2/core_v2_application_service.proto
new file mode 100644
index 00000000..38a599bf
--- /dev/null
+++ b/cast/cast_core/api/v2/core_v2_application_service.proto
@@ -0,0 +1,19 @@
+// 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.
+//
+// **** DO NOT EDIT - this file was automatically generated. ****
+syntax = "proto3";
+
+package cast.v2;
+
+import "cast/cast_core/api/v2/cast_message.proto";
+
+option optimize_for = LITE_RUNTIME;
+
+// This service runs in Cast Core for a particular app. It uses the V2 protocol
+// to communicate with the app.
+service CoreV2ApplicationService {
+ // Send a Cast V2 message to core application.
+ rpc SendCastMessage(CastMessageRequest) returns (CastMessageResponse);
+}
diff --git a/cast/cast_core/api/v2/runtime_application_service.proto b/cast/cast_core/api/v2/runtime_application_service.proto
index d80cf61c..f105f189 100644
--- a/cast/cast_core/api/v2/runtime_application_service.proto
+++ b/cast/cast_core/api/v2/runtime_application_service.proto
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.v2;
-import "google/protobuf/empty.proto";
import "cast/cast_core/api/v2/cast_message.proto";
import "cast/cast_core/api/v2/url_rewrite.proto";
import "cast/cast_core/api/web/message_channel.proto";
@@ -19,16 +18,9 @@ option optimize_for = LITE_RUNTIME;
// This service is implemented by the Runtime and represents services
// specific to a Cast application.
service RuntimeApplicationService {
- // Notifies the runtime that a new Cast V2 virtual connection has been opened.
- rpc OnVirtualConnectionOpen(VirtualConnectionInfo)
- returns (google.protobuf.Empty);
-
- // Notifies the runtime that a Cast V2 virtual connection has been closed.
- rpc OnVirtualConnectionClosed(VirtualConnectionInfo)
- returns (google.protobuf.Empty);
-
+ // DEPRECATED
// Sends a Cast message to the runtime.
- rpc SendCastMessage(CastMessage) returns (CastMessageResponse);
+ rpc SendCastMessage(CastMessageRequest) returns (CastMessageResponse);
// Set the URL rewrite rules that the Runtime will use to contact the MSP
// This is called when the rewrite rules are changed
@@ -36,6 +28,7 @@ service RuntimeApplicationService {
rpc SetUrlRewriteRules(SetUrlRewriteRulesRequest)
returns (SetUrlRewriteRulesResponse);
+ // DEPRECATED
// "MessageConnectorService" provides the transport for MessagePorts.
// MessagePorts are connected using other services (e.g. ApiBindings), then
// registered with the MessageConnectorService to communicate over IPC
@@ -49,16 +42,3 @@ message SetUrlRewriteRulesRequest {
}
message SetUrlRewriteRulesResponse {}
-
-// Request by the sender to open or close a virtual connection to the Cast
-// runtime.
-message VirtualConnectionInfo {
- // The source of the virtual connection request. Connections from the
- // sender platform use an id of 'sender-0' and connections from applications
- // use a unique ID.
- string source_id = 1;
- // The destination of the connection request. Connections to the Cast
- // receiver platform use an id of 'receiver-0' and connections to applications
- // use the Cast session id.
- string destination_id = 2;
-}
diff --git a/cast/cast_core/api/v2/runtime_message_port_application_service.proto b/cast/cast_core/api/v2/runtime_message_port_application_service.proto
new file mode 100644
index 00000000..9687fe50
--- /dev/null
+++ b/cast/cast_core/api/v2/runtime_message_port_application_service.proto
@@ -0,0 +1,21 @@
+// 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.
+//
+// **** DO NOT EDIT - this file was automatically generated. ****
+syntax = "proto3";
+
+package cast.v2;
+
+import "cast/cast_core/api/web/message_channel.proto";
+
+option optimize_for = LITE_RUNTIME;
+
+// This service runs in the runtime for a particular app. It uses a MessagePort
+// to communicate with Cast Core.
+service RuntimeMessagePortApplicationService {
+ // "MessageConnectorService" provides the transport for MessagePorts.
+ // MessagePorts are connected using other services (e.g. ApiBindings), then
+ // registered with the MessageConnectorService to communicate over IPC
+ rpc PostMessage(cast.web.Message) returns (cast.web.MessagePortStatus);
+}
diff --git a/cast/cast_core/api/v2/runtime_v2_application_service.proto b/cast/cast_core/api/v2/runtime_v2_application_service.proto
new file mode 100644
index 00000000..b5050a71
--- /dev/null
+++ b/cast/cast_core/api/v2/runtime_v2_application_service.proto
@@ -0,0 +1,19 @@
+// 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.
+//
+// **** DO NOT EDIT - this file was automatically generated. ****
+syntax = "proto3";
+
+package cast.v2;
+
+import "cast/cast_core/api/v2/cast_message.proto";
+
+option optimize_for = LITE_RUNTIME;
+
+// This service runs in the runtime for a particular app. It uses the V2
+// protocol to communicate with Cast Core.
+service RuntimeV2ApplicationService {
+ // Sends a Cast V2 message to the runtime.
+ rpc SendCastMessage(CastMessageRequest) returns (CastMessageResponse);
+}
diff --git a/cast/cast_core/api/v2/url_rewrite.proto b/cast/cast_core/api/v2/url_rewrite.proto
index 6f637c8d..e9987007 100644
--- a/cast/cast_core/api/v2/url_rewrite.proto
+++ b/cast/cast_core/api/v2/url_rewrite.proto
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.v2;
diff --git a/cast/cast_core/api/web/message_channel.proto b/cast/cast_core/api/web/message_channel.proto
index 4e3f1ded..dc59b13b 100644
--- a/cast/cast_core/api/web/message_channel.proto
+++ b/cast/cast_core/api/web/message_channel.proto
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// **** DO NOT EDIT - this .proto was automatically generated. ****
+// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";
package cast.web;