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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « media/remoting/integration_test.cc ('k') | media/remoting/receiver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_RECEIVER_H_
6 #define MEDIA_REMOTING_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 StreamProvider;
25
26 // Media remoting receiver. Media streams are rendered by |renderer|.
27 // |rpc_broker| outlives this class.
28 class Receiver final : public RendererClient {
29 public:
30 Receiver(std::unique_ptr<Renderer> renderer, RpcBroker* rpc_broker);
31 ~Receiver();
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 ScheduleMediaTimeUpdates();
64 void SendMediaTimeUpdate();
65
66 const std::unique_ptr<Renderer> renderer_;
67 RpcBroker* const rpc_broker_; // Outlives this class.
68
69 // The CourierRenderer handle on sender side. Set when AcauireRenderer() is
70 // called.
71 int remote_handle_ = RpcBroker::kInvalidHandle;
72
73 int rpc_handle_ = RpcBroker::kInvalidHandle;
74
75 std::unique_ptr<StreamProvider> stream_provider_;
76
77 // The timer to periodically update the media time.
78 base::RepeatingTimer time_update_timer_;
79
80 base::WeakPtrFactory<Receiver> weak_factory_;
81
82 DISALLOW_COPY_AND_ASSIGN(Receiver);
83 };
84
85 } // namespace remoting
86 } // namespace media
87
88 #endif // MEDIA_REMOTING_RECEIVER_H_
OLDNEW
« 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