| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_ | 5 #ifndef CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_ |
| 6 #define CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_ | 6 #define CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chromecast/common/media/cma_ipc_common.h" | 14 #include "chromecast/common/media/cma_ipc_common.h" |
| 15 #include "chromecast/media/cma/backend/media_pipeline_device.h" | |
| 16 #include "chromecast/media/cma/pipeline/load_type.h" | 15 #include "chromecast/media/cma/pipeline/load_type.h" |
| 17 #include "content/public/browser/browser_message_filter.h" | 16 #include "content/public/browser/browser_message_filter.h" |
| 18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 19 #include "media/base/buffering_state.h" | 18 #include "media/base/buffering_state.h" |
| 20 #include "media/base/pipeline_status.h" | 19 #include "media/base/pipeline_status.h" |
| 21 | 20 |
| 22 namespace base { | 21 namespace base { |
| 23 class CancelableSyncSocket; | 22 class CancelableSyncSocket; |
| 24 class SingleThreadTaskRunner; | 23 class SingleThreadTaskRunner; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace gfx { | 26 namespace gfx { |
| 28 class PointF; | 27 class PointF; |
| 29 class Size; | 28 class Size; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace media { | 31 namespace media { |
| 33 class AudioDecoderConfig; | 32 class AudioDecoderConfig; |
| 34 class BrowserCdm; | 33 class BrowserCdm; |
| 35 class VideoDecoderConfig; | 34 class VideoDecoderConfig; |
| 36 } | 35 } |
| 37 | 36 |
| 38 namespace chromecast { | 37 namespace chromecast { |
| 39 namespace media { | 38 namespace media { |
| 40 | 39 |
| 40 class MediaPipelineBackend; |
| 41 struct MediaPipelineDeviceParams; |
| 41 class MediaPipelineHost; | 42 class MediaPipelineHost; |
| 42 | 43 |
| 43 class CmaMessageFilterHost | 44 class CmaMessageFilterHost |
| 44 : public content::BrowserMessageFilter { | 45 : public content::BrowserMessageFilter { |
| 45 public: | 46 public: |
| 47 // Factory method to create a MediaPipelineBackend |
| 48 typedef base::Callback<scoped_ptr<MediaPipelineBackend>( |
| 49 const MediaPipelineDeviceParams&)> CreateDeviceComponentsCB; |
| 50 |
| 46 CmaMessageFilterHost( | 51 CmaMessageFilterHost( |
| 47 int render_process_id, | 52 int render_process_id, |
| 48 const media::CreatePipelineDeviceCB& create_pipeline_device_cb); | 53 const CreateDeviceComponentsCB& create_device_components_cb); |
| 49 | 54 |
| 50 // content::BrowserMessageFilter implementation. | 55 // content::BrowserMessageFilter implementation. |
| 51 void OnChannelClosing() override; | 56 void OnChannelClosing() override; |
| 52 void OnDestruct() const override; | 57 void OnDestruct() const override; |
| 53 bool OnMessageReceived(const IPC::Message& message) override; | 58 bool OnMessageReceived(const IPC::Message& message) override; |
| 54 | 59 |
| 55 private: | 60 private: |
| 56 typedef std::map<int, MediaPipelineHost*> MediaPipelineMap; | 61 typedef std::map<int, MediaPipelineHost*> MediaPipelineMap; |
| 57 | 62 |
| 58 friend class content::BrowserThread; | 63 friend class content::BrowserThread; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 TrackId track_id, | 112 TrackId track_id, |
| 108 const ::media::PipelineStatistics& stats); | 113 const ::media::PipelineStatistics& stats); |
| 109 void OnNaturalSizeChanged(int media_id, | 114 void OnNaturalSizeChanged(int media_id, |
| 110 TrackId track_id, | 115 TrackId track_id, |
| 111 const gfx::Size& size); | 116 const gfx::Size& size); |
| 112 | 117 |
| 113 // Render process ID correponding to this message filter. | 118 // Render process ID correponding to this message filter. |
| 114 const int process_id_; | 119 const int process_id_; |
| 115 | 120 |
| 116 // Factory function for device-specific part of media pipeline creation | 121 // Factory function for device-specific part of media pipeline creation |
| 117 media::CreatePipelineDeviceCB create_pipeline_device_cb_; | 122 CreateDeviceComponentsCB create_device_components_cb_; |
| 118 | 123 |
| 119 // List of media pipeline and message loop media pipelines are running on. | 124 // List of media pipeline and message loop media pipelines are running on. |
| 120 MediaPipelineMap media_pipelines_; | 125 MediaPipelineMap media_pipelines_; |
| 121 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 126 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 122 | 127 |
| 123 base::WeakPtr<CmaMessageFilterHost> weak_this_; | 128 base::WeakPtr<CmaMessageFilterHost> weak_this_; |
| 124 base::WeakPtrFactory<CmaMessageFilterHost> weak_factory_; | 129 base::WeakPtrFactory<CmaMessageFilterHost> weak_factory_; |
| 125 | 130 |
| 126 DISALLOW_COPY_AND_ASSIGN(CmaMessageFilterHost); | 131 DISALLOW_COPY_AND_ASSIGN(CmaMessageFilterHost); |
| 127 }; | 132 }; |
| 128 | 133 |
| 129 } // namespace media | 134 } // namespace media |
| 130 } // namespace chromecast | 135 } // namespace chromecast |
| 131 | 136 |
| 132 #endif // CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_ | 137 #endif // CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_ |
| OLD | NEW |