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

Unified Diff: media/video/capture/video_capture_proxy.h

Issue 242013002: Refactor video capturing code in the render process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge again :( Created 6 years, 8 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
« no previous file with comments | « media/video/capture/video_capture.h ('k') | media/video/capture/video_capture_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/video_capture_proxy.h
diff --git a/media/video/capture/video_capture_proxy.h b/media/video/capture/video_capture_proxy.h
deleted file mode 100644
index 80f019dd7d5dd1a3beaa7597c3cb0a567dc425e2..0000000000000000000000000000000000000000
--- a/media/video/capture/video_capture_proxy.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2012 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_VIDEO_CAPTURE_VIDEO_CAPTURE_PROXY_H_
-#define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_PROXY_H_
-
-#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
-#include "media/video/capture/video_capture.h"
-
-namespace base {
-class SingleThreadTaskRunner;
-}
-
-namespace media {
-
-// This is a helper class to proxy a VideoCapture::EventHandler. In the renderer
-// process, the VideoCaptureImpl calls its handler on a "Video Capture" thread,
-// this class allows seamless proxying to another thread ("main thread"), which
-// would be the thread where the instance of this class is created. The
-// "proxied" handler is then called on that thread.
-// Since the VideoCapture is living on the "Video Capture" thread, querying its
-// state from the "main thread" is fundamentally racy. Instead this class keeps
-// track of the state every time it is called by the VideoCapture (on the VC
-// thread), and forwards that information to the main thread.
-class MEDIA_EXPORT VideoCaptureHandlerProxy
- : public VideoCapture::EventHandler {
- public:
- struct VideoCaptureState {
- VideoCaptureState() : started(false), frame_rate(0) {}
- bool started;
- int frame_rate;
- };
-
- // Called on main thread.
- VideoCaptureHandlerProxy(
- VideoCapture::EventHandler* proxied,
- const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner);
- virtual ~VideoCaptureHandlerProxy();
-
- // Retrieves the state of the VideoCapture. Must be called on main thread.
- const VideoCaptureState& state() const { return state_; }
-
- // VideoCapture::EventHandler implementation, called on VC thread.
- virtual void OnStarted(VideoCapture* capture) OVERRIDE;
- virtual void OnStopped(VideoCapture* capture) OVERRIDE;
- virtual void OnPaused(VideoCapture* capture) OVERRIDE;
- virtual void OnError(VideoCapture* capture, int error_code) OVERRIDE;
- virtual void OnRemoved(VideoCapture* capture) OVERRIDE;
- virtual void OnFrameReady(VideoCapture* capture,
- const scoped_refptr<VideoFrame>& frame) OVERRIDE;
-
- private:
- // Called on main thread.
- void OnStartedOnMainThread(
- VideoCapture* capture,
- const VideoCaptureState& state);
- void OnStoppedOnMainThread(
- VideoCapture* capture,
- const VideoCaptureState& state);
- void OnPausedOnMainThread(
- VideoCapture* capture,
- const VideoCaptureState& state);
- void OnErrorOnMainThread(
- VideoCapture* capture,
- const VideoCaptureState& state,
- int error_code);
- void OnRemovedOnMainThread(
- VideoCapture* capture,
- const VideoCaptureState& state);
- void OnFrameReadyOnMainThread(VideoCapture* capture,
- const VideoCaptureState& state,
- const scoped_refptr<VideoFrame>& frame);
-
- // Only accessed from main thread.
- VideoCapture::EventHandler* proxied_;
- VideoCaptureState state_;
-
- scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
-};
-
-} // namespace media
-
-#endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_PROXY_H_
« no previous file with comments | « media/video/capture/video_capture.h ('k') | media/video/capture/video_capture_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698