aboutsummaryrefslogtreecommitdiff
path: root/cast/standalone_sender/looping_file_sender.cc
diff options
context:
space:
mode:
authorJordan Bayles <jophba@chromium.org>2021-07-23 11:55:26 -0700
committerOpenscreen LUCI CQ <openscreen-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-07-27 18:52:43 +0000
commitd3d748595d324fb16043df329c9eb906f1d20bf4 (patch)
treea3cf9ff81ddda233de3c57d39340e48dffab768a /cast/standalone_sender/looping_file_sender.cc
parent7ad58ffa2b37ecb7ebe2e8b0e1b863925203fdd5 (diff)
downloadopenscreen-d3d748595d324fb16043df329c9eb906f1d20bf4.tar.gz
[Cast Standalone] Implement Play/Pause
This patch adds play/pause support to the standalone receiver and sender classes while remoting. The implementation uses SDL keyboard event bindings to pick up on spacebar presses when the SDL player window (e.g. the standalone receiver video) is in focus. This event binding results in a SetPlaybackRate message being sent over the RPCMessenger, and then the standalone sender class uses the message's double value to toggle playback on the simulated capturer implementations. While falling far short of a full media player implementation, this patch may help embedders see the basics of how RPC messenging and keeping the sender and receiver media streams in sync can behave. Change-Id: I4d2e1ed7f6d69f8a24385c9139320492c2101600 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/3034990 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast/standalone_sender/looping_file_sender.cc')
-rw-r--r--cast/standalone_sender/looping_file_sender.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/cast/standalone_sender/looping_file_sender.cc b/cast/standalone_sender/looping_file_sender.cc
index 9f6137dc..7ed5e3fe 100644
--- a/cast/standalone_sender/looping_file_sender.cc
+++ b/cast/standalone_sender/looping_file_sender.cc
@@ -44,6 +44,11 @@ LoopingFileSender::LoopingFileSender(Environment* environment,
LoopingFileSender::~LoopingFileSender() = default;
+void LoopingFileSender::SetPlaybackRate(double rate) {
+ video_capturer_->SetPlaybackRate(rate);
+ audio_capturer_->SetPlaybackRate(rate);
+}
+
void LoopingFileSender::UpdateEncoderBitrates() {
if (bandwidth_being_utilized_ >= kHighBandwidthThreshold) {
audio_encoder_.UseHighQuality();