| Index: media/capture/video/fake_video_capture_device.h
|
| diff --git a/media/capture/video/fake_video_capture_device.h b/media/capture/video/fake_video_capture_device.h
|
| index 3fc05d070de8a0d95ff1ea7575c470fbab6ec958..c853b4dfde712d2cd5752ea597de844305f6695b 100644
|
| --- a/media/capture/video/fake_video_capture_device.h
|
| +++ b/media/capture/video/fake_video_capture_device.h
|
| @@ -2,9 +2,6 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// Implementation of a fake VideoCaptureDevice class. Used for testing other
|
| -// video capture classes when no real hardware is available.
|
| -
|
| #ifndef MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_H_
|
| #define MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_H_
|
|
|
| @@ -13,71 +10,25 @@
|
| #include <memory>
|
| #include <string>
|
|
|
| -#include "base/atomicops.h"
|
| -#include "base/macros.h"
|
| -#include "base/memory/weak_ptr.h"
|
| -#include "base/threading/thread_checker.h"
|
| -#include "base/time/time.h"
|
| #include "media/capture/video/video_capture_device.h"
|
|
|
| namespace media {
|
|
|
| -class CAPTURE_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice {
|
| +// Encapsulates factory logic to make a working FakeVideoCaptureDevice based
|
| +// on a given target OutputMode and frame rate.
|
| +class CAPTURE_EXPORT FakeVideoCaptureDeviceMaker {
|
| public:
|
| - enum class BufferOwnership {
|
| - OWN_BUFFERS,
|
| - CLIENT_BUFFERS,
|
| + enum class DeliveryMode {
|
| + USE_DEVICE_INTERNAL_BUFFERS,
|
| + USE_CLIENT_PROVIDED_BUFFERS
|
| };
|
|
|
| - FakeVideoCaptureDevice(BufferOwnership buffer_ownership,
|
| - float fake_capture_rate,
|
| - VideoPixelFormat pixel_format = PIXEL_FORMAT_I420);
|
| - ~FakeVideoCaptureDevice() override;
|
| -
|
| - // VideoCaptureDevice implementation.
|
| - void AllocateAndStart(const VideoCaptureParams& params,
|
| - std::unique_ptr<Client> client) override;
|
| - void StopAndDeAllocate() override;
|
| - void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override;
|
| - void SetPhotoOptions(mojom::PhotoSettingsPtr settings,
|
| - SetPhotoOptionsCallback callback) override;
|
| - void TakePhoto(TakePhotoCallback callback) override;
|
| -
|
| - private:
|
| - void CaptureUsingOwnBuffers(base::TimeTicks expected_execution_time);
|
| - void CaptureUsingClientBuffers(base::TimeTicks expected_execution_time);
|
| - void BeepAndScheduleNextCapture(
|
| - base::TimeTicks expected_execution_time,
|
| - const base::Callback<void(base::TimeTicks)>& next_capture);
|
| -
|
| - // |thread_checker_| is used to check that all methods are called in the
|
| - // correct thread that owns the object.
|
| - base::ThreadChecker thread_checker_;
|
| -
|
| - const BufferOwnership buffer_ownership_;
|
| - // Frame rate of the fake video device.
|
| - const float fake_capture_rate_;
|
| - // Pixel format of all device streams.
|
| - const VideoPixelFormat pixel_format_;
|
| -
|
| - std::unique_ptr<VideoCaptureDevice::Client> client_;
|
| - // |fake_frame_| is used for capturing on Own Buffers.
|
| - std::unique_ptr<uint8_t[]> fake_frame_;
|
| - // Time when the next beep occurs.
|
| - base::TimeDelta beep_time_;
|
| - // Time since the fake video started rendering frames.
|
| - base::TimeDelta elapsed_time_;
|
| - VideoCaptureFormat capture_format_;
|
| -
|
| - double current_zoom_;
|
| -
|
| - // The system time when we receive the first frame.
|
| - base::TimeTicks first_ref_time_;
|
| - // FakeVideoCaptureDevice post tasks to itself for frame construction and
|
| - // needs to deal with asynchronous StopAndDeallocate().
|
| - base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_;
|
| + static void GetSupportedSizes(std::vector<gfx::Size>* supported_sizes);
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice);
|
| + static std::unique_ptr<VideoCaptureDevice> MakeInstance(
|
| + VideoPixelFormat pixel_format,
|
| + DeliveryMode delivery_mode,
|
| + float frame_rate);
|
| };
|
|
|
| } // namespace media
|
|
|