OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_REMOTING_CONTROLLER_H_ | |
6 #define MEDIA_REMOTING_REMOTING_CONTROLLER_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "media/base/renderer_controller.h" | |
11 #include "media/mojo/interfaces/remoting.mojom.h" | |
12 #include "mojo/public/cpp/bindings/binding.h" | |
13 | |
14 // This class does the following: | |
15 // 1) Sends/Receives messages from/to Remoter; | |
16 // 2) Gets info from media::WebMediaPlayerImpl; | |
miu
2016/09/28 01:33:32
s/media::WebMediaPlayerImpl/media::MediaPlayer/
xjz
2016/09/29 22:54:22
Not applicable.
| |
17 // 3) May trigger the switch of the media renderer between local playback | |
18 // and remoting. | |
19 // | |
20 namespace media { | |
21 | |
22 class MEDIA_EXPORT RemotingController final : public RendererController, | |
23 public mojom::RemotingSource { | |
24 public: | |
25 explicit RemotingController(mojom::RemoterFactory* remoter_factory); | |
26 ~RemotingController() override; | |
27 | |
28 // RemotingSource implementations. | |
29 void OnSinkAvailable() override; | |
30 void OnSinkGone() override; | |
31 void OnStarted() override; | |
32 void OnStartFailed(mojom::RemotingStartFailReason reason) override; | |
33 void OnMessageFromSink(const std::vector<uint8_t>& message) override; | |
34 void OnStopped(mojom::RemotingStopReason reson) override; | |
35 | |
36 // RendererController implementation. | |
37 void OnEnteredFullscreen() override; | |
38 void OnExitedFullscreen() override; | |
39 void OnSetCdm(CdmContext* cdm_context) override; | |
40 void OnSetDecoderConfig(const AudioDecoderConfig& audio_config, | |
41 const VideoDecoderConfig& video_config) override; | |
42 void SetSwitchRenderCallback( | |
43 const RendererController::SwitchRendererCallback& cb) override; | |
44 | |
45 // Tells which renderer should be used. | |
46 bool ShouldUseRemotingRenderer(); | |
47 | |
48 private: | |
49 bool isVideoConfigSupported(); | |
50 bool isAudioConfigSupported(); | |
51 | |
52 // Re-calculates |use_remoting_renderer_|. | |
miu
2016/09/28 01:33:32
Suggestion: // Determines whether to enter or leav
xjz
2016/09/29 22:54:22
Done.
| |
53 void Update(); | |
54 | |
55 // Indicates if this media element or its ancestor enters full screen. | |
56 bool is_fullscreen_; | |
57 | |
58 // Indicates the remoting sink availablity. | |
59 bool is_sink_available_; | |
60 | |
61 // Indicates if we should use remoting renderer. | |
62 bool use_remoting_renderer_; | |
miu
2016/09/28 01:33:32
naming: Looked at everywhere this is being used. I
xjz
2016/09/29 22:54:22
Renamed "is_remoting_".
| |
63 | |
64 // Current audio/video config. | |
65 VideoDecoderConfig video_decoder_config_; | |
66 AudioDecoderConfig audio_decoder_config_; | |
67 | |
68 // The callback to switch the media renderer. | |
69 RendererController::SwitchRendererCallback switch_renderer_cb_; | |
70 | |
71 mojo::Binding<mojom::RemotingSource> binding_; | |
72 mojom::RemoterPtr remoter_; | |
73 | |
74 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(RemotingController); | |
77 }; | |
78 | |
79 } // namespace media | |
80 | |
81 #endif // MEDIA_REMOTING_REMOTING_CONTROLLER_H_ | |
OLD | NEW |