| 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 MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 6 #define MEDIA_CAPTURE_VIDEO_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 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | |
| 17 #include "base/threading/thread_collision_warner.h" | 16 #include "base/threading/thread_collision_warner.h" |
| 18 #include "media/capture/capture_export.h" | 17 #include "media/capture/capture_export.h" |
| 19 #include "media/capture/video/video_capture_device.h" | 18 #include "media/capture/video/video_capture_device.h" |
| 20 | 19 |
| 21 namespace media { | 20 namespace media { |
| 22 class VideoCaptureBufferPool; | 21 class VideoCaptureBufferPool; |
| 23 class VideoFrameReceiver; | 22 class VideoFrameReceiver; |
| 24 class VideoCaptureJpegDecoder; | 23 class VideoCaptureJpegDecoder; |
| 25 | 24 |
| 26 using VideoCaptureJpegDecoderFactoryCB = | 25 using VideoCaptureJpegDecoderFactoryCB = |
| 27 base::Callback<std::unique_ptr<VideoCaptureJpegDecoder>()>; | 26 base::Callback<std::unique_ptr<VideoCaptureJpegDecoder>()>; |
| 28 | 27 |
| 29 // Implementation of media::VideoCaptureDevice::Client that uses a buffer pool | 28 // Implementation of media::VideoCaptureDevice::Client that uses a buffer pool |
| 30 // to provide buffers and converts incoming data to the I420 format for | 29 // to provide buffers and converts incoming data to the I420 format for |
| 31 // consumption by a given VideoFrameReceiver. | 30 // consumption by a given VideoFrameReceiver. |
| 32 // | 31 // |
| 33 // Methods of this class may be called from any thread, and in practice will | 32 // Methods of this class may be called from any thread, and in practice will |
| 34 // often be called on some auxiliary thread depending on the platform and the | 33 // often be called on some auxiliary thread depending on the platform and the |
| 35 // device type; including, for example, the DirectShow thread on Windows, the | 34 // device type; including, for example, the DirectShow thread on Windows, the |
| 36 // v4l2_thread on Linux, and the UI thread for tab capture. | 35 // v4l2_thread on Linux, and the UI thread for tab capture. |
| 37 // The owner is responsible for making sure that the instance outlives these | 36 // The owner is responsible for making sure that the instance outlives these |
| 38 // calls. | 37 // calls. |
| 39 class CAPTURE_EXPORT VideoCaptureDeviceClient | 38 class CAPTURE_EXPORT VideoCaptureDeviceClient |
| 40 : public media::VideoCaptureDevice::Client, | 39 : public media::VideoCaptureDevice::Client { |
| 41 public base::SupportsWeakPtr<VideoCaptureDeviceClient> { | |
| 42 public: | 40 public: |
| 43 VideoCaptureDeviceClient( | 41 VideoCaptureDeviceClient( |
| 44 std::unique_ptr<VideoFrameReceiver> receiver, | 42 std::unique_ptr<VideoFrameReceiver> receiver, |
| 45 scoped_refptr<VideoCaptureBufferPool> buffer_pool, | 43 scoped_refptr<VideoCaptureBufferPool> buffer_pool, |
| 46 const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory); | 44 const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory); |
| 47 ~VideoCaptureDeviceClient() override; | 45 ~VideoCaptureDeviceClient() override; |
| 48 | 46 |
| 49 static Buffer MakeBufferStruct( | 47 static Buffer MakeBufferStruct( |
| 50 scoped_refptr<VideoCaptureBufferPool> buffer_pool, | 48 scoped_refptr<VideoCaptureBufferPool> buffer_pool, |
| 51 int buffer_id, | 49 int buffer_id, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // concurrently. Producers are allowed to call from multiple threads, but not | 125 // concurrently. Producers are allowed to call from multiple threads, but not |
| 128 // concurrently. | 126 // concurrently. |
| 129 DFAKE_MUTEX(call_from_producer_); | 127 DFAKE_MUTEX(call_from_producer_); |
| 130 | 128 |
| 131 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); | 129 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); |
| 132 }; | 130 }; |
| 133 | 131 |
| 134 } // namespace media | 132 } // namespace media |
| 135 | 133 |
| 136 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 134 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| OLD | NEW |