| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DEVICE_CLIENT_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "media/capture/video/video_capture_device.h" | 17 #include "device/capture/video/video_capture_device.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class VideoCaptureBufferPool; | 20 class VideoCaptureBufferPool; |
| 21 class VideoCaptureController; | 21 class VideoCaptureController; |
| 22 class VideoCaptureGpuJpegDecoder; | 22 class VideoCaptureGpuJpegDecoder; |
| 23 | 23 |
| 24 // Receives events from the VideoCaptureDevice and posts them to a |controller_| | 24 // Receives events from the VideoCaptureDevice and posts them to a |controller_| |
| 25 // on the IO thread. An instance of this class may safely outlive its target | 25 // on the IO thread. An instance of this class may safely outlive its target |
| 26 // VideoCaptureController. This is a shallow class meant to convert incoming | 26 // VideoCaptureController. This is a shallow class meant to convert incoming |
| 27 // frames and holds no significant state. | 27 // frames and holds no significant state. |
| 28 // | 28 // |
| 29 // Methods of this class may be called from any thread, and in practice will | 29 // Methods of this class may be called from any thread, and in practice will |
| 30 // often be called on some auxiliary thread depending on the platform and the | 30 // often be called on some auxiliary thread depending on the platform and the |
| 31 // device type; including, for example, the DirectShow thread on Windows, the | 31 // device type; including, for example, the DirectShow thread on Windows, the |
| 32 // v4l2_thread on Linux, and the UI thread for tab capture. | 32 // v4l2_thread on Linux, and the UI thread for tab capture. |
| 33 // | 33 // |
| 34 // It has an internal ref counted TextureWrapHelper class used to wrap incoming | 34 // It has an internal ref counted TextureWrapHelper class used to wrap incoming |
| 35 // GpuMemoryBuffers into Texture backed VideoFrames. This class creates and | 35 // GpuMemoryBuffers into Texture backed VideoFrames. This class creates and |
| 36 // manages the necessary entities to interact with the GPU process, notably an | 36 // manages the necessary entities to interact with the GPU process, notably an |
| 37 // offscreen Context to avoid janking the UI thread. | 37 // offscreen Context to avoid janking the UI thread. |
| 38 class CONTENT_EXPORT VideoCaptureDeviceClient | 38 class CONTENT_EXPORT VideoCaptureDeviceClient |
| 39 : public media::VideoCaptureDevice::Client, | 39 : public device::VideoCaptureDevice::Client, |
| 40 public base::SupportsWeakPtr<VideoCaptureDeviceClient> { | 40 public base::SupportsWeakPtr<VideoCaptureDeviceClient> { |
| 41 public: | 41 public: |
| 42 VideoCaptureDeviceClient( | 42 VideoCaptureDeviceClient( |
| 43 const base::WeakPtr<VideoCaptureController>& controller, | 43 const base::WeakPtr<VideoCaptureController>& controller, |
| 44 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool); | 44 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool); |
| 45 ~VideoCaptureDeviceClient() override; | 45 ~VideoCaptureDeviceClient() override; |
| 46 | 46 |
| 47 // VideoCaptureDevice::Client implementation. | 47 // VideoCaptureDevice::Client implementation. |
| 48 void OnIncomingCapturedData(const uint8_t* data, | 48 void OnIncomingCapturedData(const uint8_t* data, |
| 49 int length, | 49 int length, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 media::VideoPixelFormat last_captured_pixel_format_; | 118 media::VideoPixelFormat last_captured_pixel_format_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); | 120 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 | 123 |
| 124 } // namespace content | 124 } // namespace content |
| 125 | 125 |
| 126 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 126 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| OLD | NEW |