| 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 SERVICES_VIDEO_CAPTURE_DEVICE_MEDIA_TO_MOJO_ADAPTER_H_ |   5 #ifndef SERVICES_VIDEO_CAPTURE_DEVICE_MEDIA_TO_MOJO_ADAPTER_H_ | 
|   6 #define SERVICES_VIDEO_CAPTURE_DEVICE_MEDIA_TO_MOJO_ADAPTER_H_ |   6 #define SERVICES_VIDEO_CAPTURE_DEVICE_MEDIA_TO_MOJO_ADAPTER_H_ | 
|   7  |   7  | 
|   8 #include "media/capture/video/video_capture_device.h" |   8 #include "media/capture/video/video_capture_device.h" | 
|   9 #include "media/capture/video/video_capture_device_client.h" |   9 #include "media/capture/video/video_capture_device_client.h" | 
|  10 #include "media/capture/video_capture_types.h" |  10 #include "media/capture/video_capture_types.h" | 
 |  11 #include "services/service_manager/public/cpp/service_context_ref.h" | 
|  11 #include "services/video_capture/public/interfaces/device.mojom.h" |  12 #include "services/video_capture/public/interfaces/device.mojom.h" | 
|  12  |  13  | 
|  13 namespace video_capture { |  14 namespace video_capture { | 
|  14  |  15  | 
 |  16 class ReceiverMojoToMediaAdapter; | 
 |  17  | 
|  15 // Implementation of mojom::Device backed by a given instance of |  18 // Implementation of mojom::Device backed by a given instance of | 
|  16 // media::VideoCaptureDevice. |  19 // media::VideoCaptureDevice. | 
|  17 class DeviceMediaToMojoAdapter : public mojom::Device { |  20 class DeviceMediaToMojoAdapter : public mojom::Device { | 
|  18  public: |  21  public: | 
|  19   DeviceMediaToMojoAdapter(std::unique_ptr<media::VideoCaptureDevice> device, |  22   DeviceMediaToMojoAdapter( | 
|  20                            const media::VideoCaptureJpegDecoderFactoryCB& |  23       std::unique_ptr<service_manager::ServiceContextRef> service_ref, | 
|  21                                jpeg_decoder_factory_callback); |  24       std::unique_ptr<media::VideoCaptureDevice> device, | 
 |  25       const media::VideoCaptureJpegDecoderFactoryCB& | 
 |  26           jpeg_decoder_factory_callback); | 
|  22   ~DeviceMediaToMojoAdapter() override; |  27   ~DeviceMediaToMojoAdapter() override; | 
|  23  |  28  | 
|  24   // mojom::Device: |  29   // mojom::Device implementation. | 
|  25   void Start(const media::VideoCaptureParams& requested_settings, |  30   void Start(const media::VideoCaptureParams& requested_settings, | 
|  26              mojom::ReceiverPtr receiver) override; |  31              mojom::ReceiverPtr receiver) override; | 
|  27   void OnReceiverReportingUtilization(int32_t frame_feedback_id, |  32   void OnReceiverReportingUtilization(int32_t frame_feedback_id, | 
|  28                                       double utilization) override; |  33                                       double utilization) override; | 
|  29  |  34  | 
|  30   void Stop(); |  35   void Stop(); | 
|  31  |  36  | 
|  32   void OnClientConnectionErrorOrClose(); |  37   void OnClientConnectionErrorOrClose(); | 
|  33  |  38  | 
|  34   // Returns the fixed maximum number of buffers passed to the constructor |  39   // Returns the fixed maximum number of buffers passed to the constructor | 
|  35   // of VideoCaptureBufferPoolImpl. |  40   // of VideoCaptureBufferPoolImpl. | 
|  36   static int max_buffer_pool_buffer_count(); |  41   static int max_buffer_pool_buffer_count(); | 
|  37  |  42  | 
|  38  private: |  43  private: | 
 |  44   const std::unique_ptr<service_manager::ServiceContextRef> service_ref_; | 
|  39   const std::unique_ptr<media::VideoCaptureDevice> device_; |  45   const std::unique_ptr<media::VideoCaptureDevice> device_; | 
|  40   media::VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; |  46   media::VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; | 
|  41   bool device_running_; |  47   bool device_started_; | 
 |  48   ReceiverMojoToMediaAdapter* receiver_adapter_ptr_ = nullptr; | 
 |  49   base::ThreadChecker thread_checker_; | 
|  42 }; |  50 }; | 
|  43  |  51  | 
|  44 }  // namespace video_capture |  52 }  // namespace video_capture | 
|  45  |  53  | 
|  46 #endif  // SERVICES_VIDEO_CAPTURE_DEVICE_MEDIA_TO_MOJO_ADAPTER_H_ |  54 #endif  // SERVICES_VIDEO_CAPTURE_DEVICE_MEDIA_TO_MOJO_ADAPTER_H_ | 
| OLD | NEW |