Chromium Code Reviews| 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/mediaplayer_observer.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/30 08:12:10
For #2, WMPI is not known in media/remoting code.
xjz
2016/10/01 00:28:41
Done.
| |
| 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 MediaPlayerObserver, | |
| 23 public mojom::RemotingSource { | |
| 24 public: | |
| 25 explicit RemotingController(mojom::RemoterFactory* remoter_factory); | |
|
miu
2016/09/30 08:12:10
This looks like you're injecting a RemoterFactory
xjz
2016/10/01 00:28:41
Done.
| |
| 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 // MediaPlayerObserver implementation. | |
| 37 void OnEnteredFullscreen() override; | |
| 38 void OnExitedFullscreen() override; | |
| 39 void OnSetCdm(CdmContext* cdm_context) override; | |
| 40 void OnDecoderConfigChanged(const AudioDecoderConfig& audio_config, | |
| 41 const VideoDecoderConfig& video_config) override; | |
| 42 void SetSwitchRenderCallback( | |
| 43 const MediaPlayerObserver::SwitchRendererCallback& cb) override; | |
| 44 | |
| 45 // Tells which renderer should be used. | |
| 46 bool is_remoting(); | |
|
miu
2016/09/30 08:12:10
Simple accessors should be defined inline (and con
xjz
2016/10/01 00:28:41
Done.
| |
| 47 | |
| 48 private: | |
| 49 bool isVideoConfigSupported(); | |
| 50 bool isAudioConfigSupported(); | |
| 51 | |
| 52 // Determines whether to enter or leave Remoting mode and switches if | |
| 53 // necessary. | |
| 54 void Update(); | |
| 55 | |
| 56 // Indicates if this media element or its ancestor enters full screen. | |
| 57 bool is_fullscreen_; | |
| 58 | |
| 59 // Indicates the remoting sink availablity. | |
| 60 bool is_sink_available_; | |
| 61 | |
| 62 // Indicates if remoting is started. | |
| 63 bool is_remoting_; | |
| 64 | |
| 65 // Current audio/video config. | |
| 66 VideoDecoderConfig video_decoder_config_; | |
| 67 AudioDecoderConfig audio_decoder_config_; | |
| 68 | |
| 69 // The callback to switch the media renderer. | |
| 70 MediaPlayerObserver::SwitchRendererCallback switch_renderer_cb_; | |
| 71 | |
| 72 mojo::Binding<mojom::RemotingSource> binding_; | |
| 73 mojom::RemoterPtr remoter_; | |
| 74 | |
| 75 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(RemotingController); | |
| 78 }; | |
| 79 | |
| 80 } // namespace media | |
| 81 | |
| 82 #endif // MEDIA_REMOTING_REMOTING_CONTROLLER_H_ | |
| OLD | NEW |