diff options
author | Jordan Bayles <jophba@chromium.org> | 2021-07-01 15:13:23 -0700 |
---|---|---|
committer | Openscreen LUCI CQ <openscreen-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2021-07-01 22:52:43 +0000 |
commit | 2e2730fe0190f72dadd631176d2f380b4a6186a8 (patch) | |
tree | 16948b153573e25eafe4dfc986de016013faeed3 /cast/streaming/sender_session.h | |
parent | f2d9d267c1363c42d6eef6f9190033af98fb236b (diff) | |
download | openscreen-2e2730fe0190f72dadd631176d2f380b4a6186a8.tar.gz |
[Cast Streaming] Add codec negotiation over RPC
This patch adds support for negotiating codec information over the RPC
messenger class for both the standalone sender and receiver.
Although a full remoting implementation in the standalone
implementations is not a goal and not particularly practical, it is
important that we exercise the public remoting APIs and get basic usage
and flows handled in our library.
To that end, this patch specifically adds support for sending
RPC_DS_INITIALIZE and RPC_DS_INITIALIZE_CALLBACK messages, simulating
the process of setting up a remoting media stream and demuxer in Chrome.
NOTE: this does not enable "true" remoting--the standalone sender is
still decoding and reencoding the video. For "true" remoting support we
need the ability to unpack raw frames (probably exclusively from a WebM
container that holds VP8 frames) and pass them directly.
In future patches, we can also consider adding additional features to
the standalone implementation, such as play/pause and volume control
methods.
Bug: b/190078859
Change-Id: I49c2acb537aa3c647b8c3a53c9545f5eb3893982
Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2973373
Commit-Queue: Jordan Bayles <jophba@chromium.org>
Reviewed-by: mark a. foltz <mfoltz@chromium.org>
Diffstat (limited to 'cast/streaming/sender_session.h')
-rw-r--r-- | cast/streaming/sender_session.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/cast/streaming/sender_session.h b/cast/streaming/sender_session.h index 7995181f..f7fbb97a 100644 --- a/cast/streaming/sender_session.h +++ b/cast/streaming/sender_session.h @@ -58,9 +58,6 @@ class SenderSession final { // about legacy devices, such as pre-1.27 Earth receivers should do // a version check when using these capabilities to offer remoting. RemotingCapabilities capabilities; - - // The RPC messenger to be used for subscribing to remoting proto messages. - RpcMessenger* messenger; }; // The embedder should provide a client for handling negotiation events. @@ -158,6 +155,11 @@ class SenderSession final { // feedback. Embedders may use this information to throttle capture devices. int GetEstimatedNetworkBandwidth() const; + // The RPC messenger for this session. NOTE: RPC messages may come at + // any time from the receiver, so subscriptions to RPC remoting messages + // should be done before calling |NegotiateRemoting|. + RpcMessenger* rpc_messenger() { return &rpc_messenger_; } + private: // We store the current negotiation, so that when we get an answer from the // receiver we can line up the selected streams with the original @@ -183,7 +185,7 @@ class SenderSession final { kIdle, // Currently mirroring content to a receiver. - kMirroring, + kStreaming, // Currently remoting content to a receiver. kRemoting @@ -225,6 +227,9 @@ class SenderSession final { // Spawn a set of configured senders from the currently stored negotiation. ConfiguredSenders SpawnSenders(const Answer& answer); + // Used by the RPC messenger to send outbound messages. + void SendRpcMessage(std::vector<uint8_t> message_body); + // This session's configuration. Configuration config_; @@ -233,6 +238,10 @@ class SenderSession final { // cast/protocol/castv2/streaming_schema.json. SenderSessionMessenger messenger_; + // The RPC messenger, which uses the session messager for sending RPC messages + // and handles subscriptions to RPC messages. + RpcMessenger rpc_messenger_; + // The packet router used for RTP/RTCP messaging across all senders. SenderPacketRouter packet_router_; @@ -246,7 +255,7 @@ class SenderSession final { std::unique_ptr<InProcessNegotiation> current_negotiation_; // The current state of the session. Note that the state is intentionally - // limited. |kMirroring| or |kRemoting| means that we are either starting + // limited. |kStreaming| or |kRemoting| means that we are either starting // a negotiation or actively sending to a receiver. State state_ = State::kIdle; @@ -254,11 +263,6 @@ class SenderSession final { // senders used for this session. Either or both may be nullptr. std::unique_ptr<Sender> current_audio_sender_; std::unique_ptr<Sender> current_video_sender_; - - // If remoting, we store the RpcMessenger used by the embedder to send RPC - // messages from the remoting protobuf specification. For more information, - // see //cast/streaming/remoting.proto. - std::unique_ptr<RpcMessenger> rpc_messenger_; }; // namespace cast } // namespace cast |