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

Unified Diff: media/remoting/remote_receiver.h

Issue 2692593002: Media Remoting: End to end integration tests. (Closed)
Patch Set: Created 3 years, 10 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
Index: media/remoting/remote_receiver.h
diff --git a/media/remoting/remote_receiver.h b/media/remoting/remote_receiver.h
new file mode 100644
index 0000000000000000000000000000000000000000..bb18f0bc6ba08a85002031757ef9a916967b5ff4
--- /dev/null
+++ b/media/remoting/remote_receiver.h
@@ -0,0 +1,89 @@
+// 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_REMOTE_RECEIVER_H_
+#define MEDIA_REMOTING_REMOTE_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 RemoteStreamProvider;
+
+// Simulate a media remoting receiver. Use a media::Renderer to render media
miu 2017/03/29 01:39:14 Let's take out all code comments that talk about "
xjz 2017/03/30 23:21:30 Done.
+// streams.
+class RemoteReceiver final : public RendererClient {
miu 2017/03/29 01:39:14 naming: Just "Receiver" (since we're already in th
xjz 2017/03/30 23:21:31 Done. Will rename the file name to "receiver.*" la
+ public:
+ RemoteReceiver(std::unique_ptr<Renderer> renderer, RpcBroker* rpc_broker);
+ ~RemoteReceiver();
+
+ // 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 UpdateMediaTime();
miu 2017/03/29 01:39:14 naming: SendMediaTimeUpdate()
xjz 2017/03/30 23:21:30 Done.
+
+ std::unique_ptr<Renderer> renderer_;
miu 2017/03/29 01:39:14 const
xjz 2017/03/30 23:21:30 Done.
+ RpcBroker* rpc_broker_; // Outlives this class.
miu 2017/03/29 01:39:14 const
xjz 2017/03/30 23:21:30 Done.
+
+ // The CourierRenderer handle on sender side. Set when AcauireRenderer() is
+ // called.
+ int remote_handle_ = RpcBroker::kInvalidHandle;
+
+ int rpc_handle_ = RpcBroker::kInvalidHandle;
+
+ std::unique_ptr<RemoteStreamProvider> stream_provider_;
+
+ // The timer to periodically update the media time.
+ base::RepeatingTimer time_update_timer_;
+
+ // Set by calling SetPlaybackRate().
+ double playback_rate_ = 0;
miu 2017/03/29 01:39:14 You can remove this. Code only checks whether this
xjz 2017/03/30 23:21:30 Done.
+
+ base::WeakPtrFactory<RemoteReceiver> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(RemoteReceiver);
+};
+
+} // namespace remoting
+} // namespace media
+#endif

Powered by Google App Engine
This is Rietveld 408576698