Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1027)

Unified Diff: media/remoting/receiver.h

Issue 2808583002: RELAND: Media Remoting end to end integration tests. (Closed)
Patch Set: Rebased. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/remoting/integration_test.cc ('k') | media/remoting/receiver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/remoting/receiver.h
diff --git a/media/remoting/receiver.h b/media/remoting/receiver.h
new file mode 100644
index 0000000000000000000000000000000000000000..6068ca82368de9a993fbb48b71758f20d503a620
--- /dev/null
+++ b/media/remoting/receiver.h
@@ -0,0 +1,88 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_REMOTING_RECEIVER_H_
+#define MEDIA_REMOTING_RECEIVER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/timer/timer.h"
+#include "media/base/buffering_state.h"
+#include "media/base/demuxer_stream.h"
+#include "media/base/renderer_client.h"
+#include "media/remoting/rpc_broker.h"
+
+namespace media {
+class Renderer;
+class DecoderBuffer;
+} // namespace media
+
+namespace media {
+namespace remoting {
+
+class RpcBroker;
+class StreamProvider;
+
+// Media remoting receiver. Media streams are rendered by |renderer|.
+// |rpc_broker| outlives this class.
+class Receiver final : public RendererClient {
+ public:
+ Receiver(std::unique_ptr<Renderer> renderer, RpcBroker* rpc_broker);
+ ~Receiver();
+
+ // RendererClient implementation.
+ void OnError(PipelineStatus status) override;
+ void OnEnded() override;
+ void OnStatisticsUpdate(const PipelineStatistics& stats) override;
+ void OnBufferingStateChange(BufferingState state) override;
+ void OnWaitingForDecryptionKey() override;
+ void OnVideoNaturalSizeChange(const gfx::Size& size) override;
+ void OnVideoOpacityChange(bool opaque) override;
+ void OnDurationChange(base::TimeDelta duration) override;
+
+ void OnReceivedRpc(std::unique_ptr<pb::RpcMessage> message);
+ void OnReceivedBuffer(DemuxerStream::Type type,
+ scoped_refptr<DecoderBuffer> buffer);
+
+ private:
+ // RPC message handlers.
+ void AcquireRenderer(std::unique_ptr<pb::RpcMessage> message);
+ void Initialize(std::unique_ptr<pb::RpcMessage> message);
+ void SetPlaybackRate(std::unique_ptr<pb::RpcMessage> message);
+ void FlushUntil(std::unique_ptr<pb::RpcMessage> message);
+ void StartPlayingFrom(std::unique_ptr<pb::RpcMessage> message);
+ void SetVolume(std::unique_ptr<pb::RpcMessage> message);
+
+ // Initialization callbacks.
+ void OnStreamInitialized();
+ void OnRendererInitialized(PipelineStatus status);
+
+ void OnFlushDone();
+
+ // Periodically send the UpdateTime RPC message to update the media time.
+ void ScheduleMediaTimeUpdates();
+ void SendMediaTimeUpdate();
+
+ const std::unique_ptr<Renderer> renderer_;
+ RpcBroker* const rpc_broker_; // Outlives this class.
+
+ // The CourierRenderer handle on sender side. Set when AcauireRenderer() is
+ // called.
+ int remote_handle_ = RpcBroker::kInvalidHandle;
+
+ int rpc_handle_ = RpcBroker::kInvalidHandle;
+
+ std::unique_ptr<StreamProvider> stream_provider_;
+
+ // The timer to periodically update the media time.
+ base::RepeatingTimer time_update_timer_;
+
+ base::WeakPtrFactory<Receiver> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(Receiver);
+};
+
+} // namespace remoting
+} // namespace media
+
+#endif // MEDIA_REMOTING_RECEIVER_H_
« no previous file with comments | « media/remoting/integration_test.cc ('k') | media/remoting/receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698