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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_REMOTING_REMOTE_RECEIVER_H_
6 #define MEDIA_REMOTING_REMOTE_RECEIVER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "base/timer/timer.h"
10 #include "media/base/buffering_state.h"
11 #include "media/base/demuxer_stream.h"
12 #include "media/base/renderer_client.h"
13 #include "media/remoting/rpc_broker.h"
14
15 namespace media {
16 class Renderer;
17 class DecoderBuffer;
18 } // namespace media
19
20 namespace media {
21 namespace remoting {
22
23 class RpcBroker;
24 class RemoteStreamProvider;
25
26 // 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.
27 // streams.
28 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
29 public:
30 RemoteReceiver(std::unique_ptr<Renderer> renderer, RpcBroker* rpc_broker);
31 ~RemoteReceiver();
32
33 // RendererClient implementation.
34 void OnError(PipelineStatus status) override;
35 void OnEnded() override;
36 void OnStatisticsUpdate(const PipelineStatistics& stats) override;
37 void OnBufferingStateChange(BufferingState state) override;
38 void OnWaitingForDecryptionKey() override;
39 void OnVideoNaturalSizeChange(const gfx::Size& size) override;
40 void OnVideoOpacityChange(bool opaque) override;
41 void OnDurationChange(base::TimeDelta duration) override;
42
43 void OnReceivedRpc(std::unique_ptr<pb::RpcMessage> message);
44 void OnReceivedBuffer(DemuxerStream::Type type,
45 scoped_refptr<DecoderBuffer> buffer);
46
47 private:
48 // RPC message handlers.
49 void AcquireRenderer(std::unique_ptr<pb::RpcMessage> message);
50 void Initialize(std::unique_ptr<pb::RpcMessage> message);
51 void SetPlaybackRate(std::unique_ptr<pb::RpcMessage> message);
52 void FlushUntil(std::unique_ptr<pb::RpcMessage> message);
53 void StartPlayingFrom(std::unique_ptr<pb::RpcMessage> message);
54 void SetVolume(std::unique_ptr<pb::RpcMessage> message);
55
56 // Initialization callbacks.
57 void OnStreamInitialized();
58 void OnRendererInitialized(PipelineStatus status);
59
60 void OnFlushDone();
61
62 // Periodically send the UpdateTime RPC message to update the media time.
63 void UpdateMediaTime();
miu 2017/03/29 01:39:14 naming: SendMediaTimeUpdate()
xjz 2017/03/30 23:21:30 Done.
64
65 std::unique_ptr<Renderer> renderer_;
miu 2017/03/29 01:39:14 const
xjz 2017/03/30 23:21:30 Done.
66 RpcBroker* rpc_broker_; // Outlives this class.
miu 2017/03/29 01:39:14 const
xjz 2017/03/30 23:21:30 Done.
67
68 // The CourierRenderer handle on sender side. Set when AcauireRenderer() is
69 // called.
70 int remote_handle_ = RpcBroker::kInvalidHandle;
71
72 int rpc_handle_ = RpcBroker::kInvalidHandle;
73
74 std::unique_ptr<RemoteStreamProvider> stream_provider_;
75
76 // The timer to periodically update the media time.
77 base::RepeatingTimer time_update_timer_;
78
79 // Set by calling SetPlaybackRate().
80 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.
81
82 base::WeakPtrFactory<RemoteReceiver> weak_factory_;
83
84 DISALLOW_COPY_AND_ASSIGN(RemoteReceiver);
85 };
86
87 } // namespace remoting
88 } // namespace media
89 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698