| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDIA_MA
NAGER_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDIA_M
ANAGER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDIA_MA
NAGER_H_ | 6 #define EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDIA_M
ANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <utility> | 10 #include <utility> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/macros.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "third_party/WebKit/public/web/WebDOMMediaStreamTrack.h" | 15 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media
_packetizer.h" |
| 16 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_video
_encoder.h" |
| 17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 15 #include "third_party/wds/src/libwds/public/media_manager.h" | 18 #include "third_party/wds/src/libwds/public/media_manager.h" |
| 16 | 19 |
| 17 namespace extensions { | 20 namespace extensions { |
| 21 class WiFiDisplayVideoSink; |
| 22 class WiFiDisplayMediaPipeline; |
| 23 class WiFiDisplaySessionService; |
| 18 | 24 |
| 19 class WiFiDisplayMediaManager : public wds::SourceMediaManager { | 25 class WiFiDisplayMediaManager : public wds::SourceMediaManager { |
| 20 public: | 26 public: |
| 21 using ErrorCallback = base::Callback<void(const std::string&)>; | 27 using ErrorCallback = base::Callback<void(const std::string&)>; |
| 22 | 28 |
| 23 WiFiDisplayMediaManager( | 29 WiFiDisplayMediaManager( |
| 24 const blink::WebMediaStreamTrack& video_track, | 30 const blink::WebMediaStreamTrack& video_track, |
| 25 const blink::WebMediaStreamTrack& audio_track, | 31 const blink::WebMediaStreamTrack& audio_track, |
| 26 const ErrorCallback& error_callback); | 32 const ErrorCallback& error_callback); |
| 27 | 33 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 45 wds::H264VideoFormat GetOptimalVideoFormat() const override; | 51 wds::H264VideoFormat GetOptimalVideoFormat() const override; |
| 46 bool InitOptimalAudioFormat( | 52 bool InitOptimalAudioFormat( |
| 47 const std::vector<wds::AudioCodec>& sink_supported_codecs) override; | 53 const std::vector<wds::AudioCodec>& sink_supported_codecs) override; |
| 48 wds::AudioCodec GetOptimalAudioFormat() const override; | 54 wds::AudioCodec GetOptimalAudioFormat() const override; |
| 49 | 55 |
| 50 void SendIDRPicture() override; | 56 void SendIDRPicture() override; |
| 51 | 57 |
| 52 std::string GetSessionId() const override; | 58 std::string GetSessionId() const override; |
| 53 | 59 |
| 54 private: | 60 private: |
| 61 void OnPlayerCreated(std::unique_ptr<WiFiDisplayMediaPipeline> player); |
| 62 void OnMediaPipelineInitialized(bool success); |
| 63 |
| 55 blink::WebMediaStreamTrack video_track_; | 64 blink::WebMediaStreamTrack video_track_; |
| 56 blink::WebMediaStreamTrack audio_track_; | 65 blink::WebMediaStreamTrack audio_track_; |
| 57 | 66 |
| 67 std::unique_ptr<WiFiDisplayVideoSink> video_sink_; |
| 68 |
| 58 std::pair<int, int> sink_rtp_ports_; | 69 std::pair<int, int> sink_rtp_ports_; |
| 59 wds::H264VideoFormat optimal_video_format_; | 70 wds::H264VideoFormat optimal_video_format_; |
| 60 wds::AudioCodec optimal_audio_codec_; | 71 wds::AudioCodec optimal_audio_codec_; |
| 61 | 72 |
| 73 WiFiDisplayVideoEncoder::InitParameters video_encoder_parameters_; |
| 74 WiFiDisplayMediaPipeline* player_; // Owned on IO thread. |
| 75 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 62 ErrorCallback error_callback_; | 76 ErrorCallback error_callback_; |
| 77 bool is_playing_; |
| 78 bool is_initialized_; |
| 79 mutable std::string session_id_; // Lazily initialized. |
| 80 |
| 81 base::WeakPtrFactory<WiFiDisplayMediaManager> weak_factory_; |
| 63 | 82 |
| 64 DISALLOW_COPY_AND_ASSIGN(WiFiDisplayMediaManager); | 83 DISALLOW_COPY_AND_ASSIGN(WiFiDisplayMediaManager); |
| 65 }; | 84 }; |
| 66 | 85 |
| 67 } // namespace extensions | 86 } // namespace extensions |
| 68 | 87 |
| 69 #endif // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDIA
_MANAGER_H_ | 88 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDI
A_MANAGER_H_ |
| OLD | NEW |