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

Side by Side Diff: content/browser/renderer_host/media/video_capture_device_impl.h

Issue 83793004: Implement IPCs and VideoCapture::Client interfaces for texture capture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 5744a8bbb Nits. Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "content/browser/renderer_host/media/video_capture_oracle.h" 14 #include "content/browser/renderer_host/media/video_capture_oracle.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "media/video/capture/video_capture_device.h" 16 #include "media/video/capture/video_capture_device.h"
17 17
18 namespace media {
19
20 class VideoFrame;
21
22 } // namespace media
23
18 namespace content { 24 namespace content {
19 25
20 const int kMinFrameWidth = 2; 26 const int kMinFrameWidth = 2;
21 const int kMinFrameHeight = 2; 27 const int kMinFrameHeight = 2;
22 28
23 // Returns the nearest even integer closer to zero. 29 // Returns the nearest even integer closer to zero.
24 template<typename IntType> 30 template<typename IntType>
25 IntType MakeEven(IntType x) { 31 IntType MakeEven(IntType x) {
26 return x & static_cast<IntType>(-2); 32 return x & static_cast<IntType>(-2);
27 } 33 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 78
73 // Signal an error to the client. 79 // Signal an error to the client.
74 void ReportError(); 80 void ReportError();
75 81
76 private: 82 private:
77 friend class base::RefCountedThreadSafe<ThreadSafeCaptureOracle>; 83 friend class base::RefCountedThreadSafe<ThreadSafeCaptureOracle>;
78 virtual ~ThreadSafeCaptureOracle(); 84 virtual ~ThreadSafeCaptureOracle();
79 85
80 // Callback invoked on completion of all captures. 86 // Callback invoked on completion of all captures.
81 void DidCaptureFrame( 87 void DidCaptureFrame(
82 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer, 88 const scoped_refptr<media::VideoCaptureDevice::Client::Buffer>& buffer,
89 const scoped_refptr<media::VideoFrame>& frame,
83 int frame_number, 90 int frame_number,
84 base::TimeTicks timestamp, 91 base::TimeTicks timestamp,
85 bool success); 92 bool success);
86 // Protects everything below it. 93 // Protects everything below it.
87 base::Lock lock_; 94 base::Lock lock_;
88 95
89 // Recipient of our capture activity. 96 // Recipient of our capture activity.
90 scoped_ptr<media::VideoCaptureDevice::Client> client_; 97 scoped_ptr<media::VideoCaptureDevice::Client> client_;
91 98
92 // Makes the decision to capture a frame. 99 // Makes the decision to capture a frame.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // The "meat" of the video capture implementation. 138 // The "meat" of the video capture implementation.
132 // 139 //
133 // Separating this from the "shell classes" WebContentsVideoCaptureDevice and 140 // Separating this from the "shell classes" WebContentsVideoCaptureDevice and
134 // BrowserCompositorCaptureDevice allows safe destruction without needing to 141 // BrowserCompositorCaptureDevice allows safe destruction without needing to
135 // block any threads (e.g., the IO BrowserThread), as well as code sharing. 142 // block any threads (e.g., the IO BrowserThread), as well as code sharing.
136 // 143 //
137 // VideoCaptureDeviceImpl manages a simple state machine and the pipeline (see 144 // VideoCaptureDeviceImpl manages a simple state machine and the pipeline (see
138 // notes at top of this file). It times the start of successive 145 // notes at top of this file). It times the start of successive
139 // captures and facilitates the processing of each through the stages of the 146 // captures and facilitates the processing of each through the stages of the
140 // pipeline. 147 // pipeline.
141 class CONTENT_EXPORT VideoCaptureDeviceImpl 148 class CONTENT_EXPORT VideoCaptureDeviceImpl
jiayl 2014/01/23 22:18:52 The naming of the class seems very confusing becau
sheu 2014/01/29 01:19:20 A little out of the scope of this change, probably
jiayl 2014/01/31 19:32:38 Then open a bug and add a TODO linked to the bug.
sheu 2014/02/07 00:37:25 It's also used for the desktop capture device in A
jiayl 2014/02/07 01:22:08 I hope we can avoid "impl", e.g. VideoCaptureDevic
142 : public base::SupportsWeakPtr<VideoCaptureDeviceImpl> { 149 : public base::SupportsWeakPtr<VideoCaptureDeviceImpl> {
143 public: 150 public:
144 VideoCaptureDeviceImpl(scoped_ptr<VideoCaptureMachine> capture_machine); 151 VideoCaptureDeviceImpl(scoped_ptr<VideoCaptureMachine> capture_machine);
145 virtual ~VideoCaptureDeviceImpl(); 152 virtual ~VideoCaptureDeviceImpl();
146 153
147 // Asynchronous requests to change VideoCaptureDeviceImpl state. 154 // Asynchronous requests to change VideoCaptureDeviceImpl state.
148 void AllocateAndStart(const media::VideoCaptureParams& params, 155 void AllocateAndStart(const media::VideoCaptureParams& params,
149 scoped_ptr<media::VideoCaptureDevice::Client> client); 156 scoped_ptr<media::VideoCaptureDevice::Client> client);
150 void StopAndDeAllocate(); 157 void StopAndDeAllocate();
151 158
(...skipping 30 matching lines...) Expand all
182 // system with direct access to |client_|. 189 // system with direct access to |client_|.
183 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; 190 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_;
184 191
185 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceImpl); 192 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceImpl);
186 }; 193 };
187 194
188 195
189 } // namespace content 196 } // namespace content
190 197
191 #endif // CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ 198 #endif // CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698