| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_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/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/sequenced_task_runner_helpers.h" | 13 #include "base/sequenced_task_runner_helpers.h" |
| 14 #include "content/browser/renderer_host/media/video_capture_controller.h" | 14 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 15 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" | 15 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/common/video_capture.mojom.h" | 17 #include "content/common/video_capture.mojom.h" |
| 18 | 18 |
| 19 namespace service_manager { |
| 20 struct BindSourceInfo; |
| 21 } |
| 22 |
| 19 namespace content { | 23 namespace content { |
| 20 class MediaStreamManager; | 24 class MediaStreamManager; |
| 21 | 25 |
| 22 // VideoCaptureHost is the IO thread browser process communication endpoint | 26 // VideoCaptureHost is the IO thread browser process communication endpoint |
| 23 // between a renderer process (which can initiate and receive a video capture | 27 // between a renderer process (which can initiate and receive a video capture |
| 24 // stream) and a VideoCaptureController in the browser process (which provides | 28 // stream) and a VideoCaptureController in the browser process (which provides |
| 25 // the stream from a video device). Every remote client is identified via a | 29 // the stream from a video device). Every remote client is identified via a |
| 26 // unique |device_id|, and is paired with a single VideoCaptureController. | 30 // unique |device_id|, and is paired with a single VideoCaptureController. |
| 27 class CONTENT_EXPORT VideoCaptureHost | 31 class CONTENT_EXPORT VideoCaptureHost |
| 28 : public VideoCaptureControllerEventHandler, | 32 : public VideoCaptureControllerEventHandler, |
| 29 public mojom::VideoCaptureHost { | 33 public mojom::VideoCaptureHost { |
| 30 public: | 34 public: |
| 31 explicit VideoCaptureHost(MediaStreamManager* media_stream_manager); | 35 explicit VideoCaptureHost(MediaStreamManager* media_stream_manager); |
| 32 | 36 |
| 33 static void Create(MediaStreamManager* media_stream_manager, | 37 static void Create(MediaStreamManager* media_stream_manager, |
| 38 const service_manager::BindSourceInfo& source_info, |
| 34 mojom::VideoCaptureHostRequest request); | 39 mojom::VideoCaptureHostRequest request); |
| 35 | 40 |
| 36 ~VideoCaptureHost() override; | 41 ~VideoCaptureHost() override; |
| 37 | 42 |
| 38 private: | 43 private: |
| 39 friend class VideoCaptureTest; | 44 friend class VideoCaptureTest; |
| 40 | 45 |
| 41 // VideoCaptureControllerEventHandler implementation. | 46 // VideoCaptureControllerEventHandler implementation. |
| 42 void OnError(VideoCaptureControllerID id) override; | 47 void OnError(VideoCaptureControllerID id) override; |
| 43 void OnBufferCreated(VideoCaptureControllerID id, | 48 void OnBufferCreated(VideoCaptureControllerID id, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 std::map<int32_t, mojom::VideoCaptureObserverPtr> device_id_to_observer_map_; | 108 std::map<int32_t, mojom::VideoCaptureObserverPtr> device_id_to_observer_map_; |
| 104 | 109 |
| 105 base::WeakPtrFactory<VideoCaptureHost> weak_factory_; | 110 base::WeakPtrFactory<VideoCaptureHost> weak_factory_; |
| 106 | 111 |
| 107 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 112 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 } // namespace content | 115 } // namespace content |
| 111 | 116 |
| 112 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 117 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
| OLD | NEW |