aboutsummaryrefslogtreecommitdiff
path: root/cast/standalone_sender/looping_file_cast_agent.cc
diff options
context:
space:
mode:
authorJordan Bayles <jophba@chromium.org>2021-06-10 11:23:55 -0700
committerOpenscreen LUCI CQ <openscreen-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-06-10 19:10:22 +0000
commitf6e2b5ea1dfca4fceb6e1d4004494a88006e1f9f (patch)
tree1bcb7cfe38c6c8ea18f4bb42b6b01ef7fc68b022 /cast/standalone_sender/looping_file_cast_agent.cc
parent1a4e533d57c2b879704759cdffb2a00f71266346 (diff)
downloadopenscreen-f6e2b5ea1dfca4fceb6e1d4004494a88006e1f9f.tar.gz
[Cast Streaming] Improve remoting in ReceiverSession API
This patch continues the process of wrapping up remoting support, by adding some support to the standalone implementations and cleaning up the ReceiverSession API. From here, the actual media stream will have to be mocked out/a standalone implementation created so that we can properly test the entire remoting flow and set the stage for integration into chrome. Bug: b/184186390 Change-Id: Ib2a5526ce5db71cb093f228acbc64cf3060e677d Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2939634 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
Diffstat (limited to 'cast/standalone_sender/looping_file_cast_agent.cc')
-rw-r--r--cast/standalone_sender/looping_file_cast_agent.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/cast/standalone_sender/looping_file_cast_agent.cc b/cast/standalone_sender/looping_file_cast_agent.cc
index e26d4f5e..70d489de 100644
--- a/cast/standalone_sender/looping_file_cast_agent.cc
+++ b/cast/standalone_sender/looping_file_cast_agent.cc
@@ -268,8 +268,14 @@ void LoopingFileCastAgent::CreateAndStartSession() {
video_config.resolutions.emplace_back(Resolution{1920, 1080});
OSP_VLOG << "Starting session negotiation.";
- const Error negotiation_error =
- current_session_->Negotiate({audio_config}, {video_config});
+ Error negotiation_error;
+ if (connection_settings_->use_remoting) {
+ negotiation_error =
+ current_session_->NegotiateRemoting(audio_config, video_config);
+ } else {
+ negotiation_error =
+ current_session_->Negotiate({audio_config}, {video_config});
+ }
if (!negotiation_error.ok()) {
OSP_LOG_ERROR << "Failed to negotiate a session: " << negotiation_error;
}
@@ -289,6 +295,22 @@ void LoopingFileCastAgent::OnNegotiated(
std::move(senders), connection_settings_->max_bitrate);
}
+void LoopingFileCastAgent::OnRemotingNegotiated(
+ const SenderSession* session,
+ SenderSession::RemotingNegotiation negotiation) {
+ // TODO(jophba): this needs to be hashed out as part of
+ // figuring out the embedder workflow.
+ if (negotiation.senders.audio_sender == nullptr &&
+ negotiation.senders.video_sender == nullptr) {
+ OSP_LOG_ERROR << "Missing both audio and video, so exiting...";
+ return;
+ }
+
+ file_sender_ = std::make_unique<LoopingFileSender>(
+ environment_.get(), connection_settings_->path_to_file.c_str(), session,
+ std::move(negotiation.senders), connection_settings_->max_bitrate);
+}
+
void LoopingFileCastAgent::OnError(const SenderSession* session, Error error) {
OSP_LOG_ERROR << "SenderSession fatal error: " << error;
Shutdown();