aboutsummaryrefslogtreecommitdiff
path: root/cast/standalone_sender/looping_file_sender.h
diff options
context:
space:
mode:
authorJordan Bayles <jophba@chromium.org>2021-06-28 16:46:18 -0700
committerOpenscreen LUCI CQ <openscreen-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-06-29 00:07:41 +0000
commit8ac28e195414974bf38a249270e4e842790c82f7 (patch)
treebf860be47c013cd8cba8ba8a43f65c680184ed39 /cast/standalone_sender/looping_file_sender.h
parent43bb3ea9ad8731ac539b299b77b71ba98b0a2767 (diff)
downloadopenscreen-8ac28e195414974bf38a249270e4e842790c82f7.tar.gz
[Cast Streaming] Allow playing file only once
Currently, the looping file sender plays the video over and over again. In some cases, like testing, we want to only play the video once. This patch adds a new command line argument that stops the sender after the video finishes playing. Bug: b/191492654 Change-Id: I97a2f1e211037abd09ac21ee482c9f95502ba821 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2986060 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
Diffstat (limited to 'cast/standalone_sender/looping_file_sender.h')
-rw-r--r--cast/standalone_sender/looping_file_sender.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/cast/standalone_sender/looping_file_sender.h b/cast/standalone_sender/looping_file_sender.h
index e55a4a7e..ef283dc3 100644
--- a/cast/standalone_sender/looping_file_sender.h
+++ b/cast/standalone_sender/looping_file_sender.h
@@ -8,6 +8,7 @@
#include <algorithm>
#include <string>
+#include "cast/standalone_sender/connection_settings.h"
#include "cast/standalone_sender/constants.h"
#include "cast/standalone_sender/simulated_capturer.h"
#include "cast/standalone_sender/streaming_opus_encoder.h"
@@ -22,11 +23,13 @@ namespace cast {
class LoopingFileSender final : public SimulatedAudioCapturer::Client,
public SimulatedVideoCapturer::Client {
public:
+ using ShutdownCallback = std::function<void()>;
+
LoopingFileSender(Environment* environment,
- const char* path,
+ ConnectionSettings settings,
const SenderSession* session,
SenderSession::ConfiguredSenders senders,
- int max_bitrate);
+ ShutdownCallback shutdown_callback);
~LoopingFileSender() final;
@@ -57,14 +60,14 @@ class LoopingFileSender final : public SimulatedAudioCapturer::Client,
// the remote's Receivers.
Environment* const env_;
- // The path to the media file to stream over and over.
- const char* const path_;
+ // The connection settings used for this session.
+ const ConnectionSettings settings_;
// Session to query for bandwidth information.
const SenderSession* session_;
- // User provided maximum bitrate (from command line argument).
- const int max_bitrate_;
+ // Callback for tearing down the sender process.
+ ShutdownCallback shutdown_callback_;
int bandwidth_estimate_ = 0;
int bandwidth_being_utilized_;