diff options
Diffstat (limited to 'cast/standalone_sender/looping_file_sender.h')
-rw-r--r-- | cast/standalone_sender/looping_file_sender.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/cast/standalone_sender/looping_file_sender.h b/cast/standalone_sender/looping_file_sender.h index e55a4a7e..75508e8e 100644 --- a/cast/standalone_sender/looping_file_sender.h +++ b/cast/standalone_sender/looping_file_sender.h @@ -6,12 +6,14 @@ #define CAST_STANDALONE_SENDER_LOOPING_FILE_SENDER_H_ #include <algorithm> +#include <memory> #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" -#include "cast/standalone_sender/streaming_vp8_encoder.h" +#include "cast/standalone_sender/streaming_video_encoder.h" #include "cast/streaming/sender_session.h" namespace openscreen { @@ -22,14 +24,18 @@ 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; + void SetPlaybackRate(double rate); + private: void UpdateEncoderBitrates(); void ControlForNetworkCongestion(); @@ -46,31 +52,36 @@ class LoopingFileSender final : public SimulatedAudioCapturer::Client, void UpdateStatusOnConsole(); - // SimulatedCapturer overrides. + // SimulatedCapturer::Client overrides. void OnEndOfFile(SimulatedCapturer* capturer) final; void OnError(SimulatedCapturer* capturer, std::string message) final; const char* ToTrackName(SimulatedCapturer* capturer) const; + std::unique_ptr<StreamingVideoEncoder> CreateVideoEncoder( + const StreamingVideoEncoder::Parameters& params, + TaskRunner* task_runner, + Sender* sender); + // Holds the required injected dependencies (clock, task runner) used for Cast // Streaming, and owns the UDP socket over which all communications occur with // 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_; StreamingOpusEncoder audio_encoder_; - StreamingVp8Encoder video_encoder_; + std::unique_ptr<StreamingVideoEncoder> video_encoder_; int num_capturers_running_ = 0; Clock::time_point capture_start_time_{}; |