diff options
Diffstat (limited to 'cast/cast_core/api/runtime')
-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.proto | 74 |
2 files changed, 229 insertions, 173 deletions
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 {} |