Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Unified Diff: media/capture/content/screen_capture_device_core.h

Issue 2143903003: [WIP] Move media/capture to device/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/capture/content/screen_capture_device_core.h
diff --git a/media/capture/content/screen_capture_device_core.h b/media/capture/content/screen_capture_device_core.h
deleted file mode 100644
index 3f8884b3c857c8fd9f87fbe21d94a0eb7f1b7ffa..0000000000000000000000000000000000000000
--- a/media/capture/content/screen_capture_device_core.h
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_
-#define MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_
-
-#include <memory>
-#include <string>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/thread_checker.h"
-#include "media/capture/capture_export.h"
-#include "media/capture/content/thread_safe_capture_oracle.h"
-#include "media/capture/video/video_capture_device.h"
-
-namespace tracked_objects {
-class Location;
-} // namespace tracked_objects
-
-namespace media {
-
-struct VideoCaptureParams;
-
-class ThreadSafeCaptureOracle;
-
-// Keeps track of the video capture source frames and executes copying.
-class CAPTURE_EXPORT VideoCaptureMachine {
- public:
- VideoCaptureMachine();
- virtual ~VideoCaptureMachine();
-
- // Starts capturing.
- // |callback| is invoked with true if succeeded. Otherwise, with false.
- virtual void Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy,
- const VideoCaptureParams& params,
- const base::Callback<void(bool)> callback) = 0;
-
- // Stops capturing.
- // |callback| is invoked after the capturing has stopped.
- virtual void Stop(const base::Closure& callback) = 0;
-
- // Returns true if the video capture is configured to monitor end-to-end
- // system utilization, and alter frame sizes and/or frame rates to mitigate
- // overloading or under-utilization.
- virtual bool IsAutoThrottlingEnabled() const;
-
- // Called by ScreenCaptureDeviceCore when it failed to satisfy a "refresh
- // frame" request by attempting to resurrect the last video frame from the
- // buffer pool (this is referred to as the "passive" refresh approach). The
- // failure can happen for a number of reasons (e.g., the oracle decided to
- // change resolution, or consumers of the last video frame are not yet
- // finished with it).
- //
- // The implementation of this method should consult the oracle, using the
- // kActiveRefreshRequest event type, to decide whether to initiate a new frame
- // capture, and then do so if the oracle agrees.
- virtual void MaybeCaptureForRefresh() = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(VideoCaptureMachine);
-};
-
-// The "meat" of a content video capturer.
-//
-// Separating this from the "shell classes" WebContentsVideoCaptureDevice and
-// DesktopCaptureDeviceAura allows safe destruction without needing to block any
-// threads, as well as code sharing.
-//
-// ScreenCaptureDeviceCore manages a simple state machine and the pipeline
-// (see notes at top of this file). It times the start of successive captures
-// and facilitates the processing of each through the stages of the
-// pipeline.
-class CAPTURE_EXPORT ScreenCaptureDeviceCore
- : public base::SupportsWeakPtr<ScreenCaptureDeviceCore> {
- public:
- ScreenCaptureDeviceCore(std::unique_ptr<VideoCaptureMachine> capture_machine);
- virtual ~ScreenCaptureDeviceCore();
-
- // Asynchronous requests to change ScreenCaptureDeviceCore state.
- void AllocateAndStart(const VideoCaptureParams& params,
- std::unique_ptr<VideoCaptureDevice::Client> client);
- void RequestRefreshFrame();
- void StopAndDeAllocate();
-
- private:
- // Flag indicating current state.
- enum State { kIdle, kCapturing, kError, kLastCaptureState };
-
- void TransitionStateTo(State next_state);
-
- // Called back in response to StartCaptureMachine(). |success| is true if
- // capture machine succeeded to start.
- void CaptureStarted(bool success);
-
- // Stops capturing and notifies client_ of an error state.
- void Error(const tracked_objects::Location& from_here,
- const std::string& reason);
-
- // Tracks that all activity occurs on the media stream manager's thread.
- base::ThreadChecker thread_checker_;
-
- // Current lifecycle state.
- State state_;
-
- // Tracks the CaptureMachine that's doing work on our behalf
- // on the device thread or UI thread.
- // This value should never be dereferenced by this class.
- std::unique_ptr<VideoCaptureMachine> capture_machine_;
-
- // Our thread-safe capture oracle which serves as the gateway to the video
- // capture pipeline. Besides the VideoCaptureDevice itself, it is the only
- // component of the system with direct access to |client_|.
- scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(ScreenCaptureDeviceCore);
-};
-
-} // namespace media
-
-#endif // MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_
« no previous file with comments | « media/capture/content/feedback_signal_accumulator_unittest.cc ('k') | media/capture/content/screen_capture_device_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698