OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // VideoCaptureImpl represents a capture device in renderer process. It provides | |
6 // interfaces for clients to Start/Stop capture. It also communicates to clients | |
7 // when buffer is ready, state of capture device is changed. | |
8 | |
9 // VideoCaptureImpl is also a delegate of VideoCaptureMessageFilter which relays | |
10 // operation of a capture device to the browser process and receives responses | |
11 // from browser process. | |
12 // | |
13 // VideoCaptureImpl is an IO thread only object. See the comments in | |
14 // video_capture_impl_manager.cc for the lifetime of this object. | |
15 // All methods must be called on the IO thread. | |
16 // | |
17 // This is an internal class used by VideoCaptureImplManager only. Do not access | |
18 // this directly. | |
19 | |
20 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
21 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
22 | 7 |
23 #include <list> | 8 #include <list> |
24 #include <map> | 9 #include <map> |
25 | 10 |
26 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
27 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
28 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
29 #include "content/common/media/video_capture.h" | 14 #include "content/common/media/video_capture.h" |
30 #include "content/public/renderer/media_stream_video_sink.h" | 15 #include "content/public/renderer/media_stream_video_sink.h" |
31 #include "content/renderer/media/video_capture_message_filter.h" | 16 #include "content/renderer/media/video_capture_message_filter.h" |
32 #include "media/base/video_capture_types.h" | 17 #include "media/base/video_capture_types.h" |
33 | 18 |
34 namespace base { | 19 namespace base { |
35 class MessageLoopProxy; | 20 class MessageLoopProxy; |
36 } // namespace base | 21 } // namespace base |
37 | 22 |
38 namespace gpu { | 23 namespace gpu { |
39 struct MailboxHolder; | 24 struct MailboxHolder; |
40 } // namespace gpu | 25 } // namespace gpu |
41 | 26 |
42 namespace media { | 27 namespace media { |
43 class VideoFrame; | 28 class VideoFrame; |
44 } // namespace media | 29 } // namespace media |
45 | 30 |
46 namespace content { | 31 namespace content { |
47 | 32 |
33 // VideoCaptureImpl represents a capture device in renderer process. It provides | |
34 // interfaces for clients to Start/Stop capture. It also communicates to clients | |
35 // when buffer is ready, state of capture device is changed. | |
36 | |
37 // VideoCaptureImpl is also a delegate of VideoCaptureMessageFilter which relays | |
38 // operation of a capture device to the browser process and receives responses | |
39 // from browser process. | |
40 // | |
41 // VideoCaptureImpl is an IO thread only object. See the comments in | |
42 // video_capture_impl_manager.cc for the lifetime of this object. | |
43 // All methods must be called on the IO thread. | |
44 // | |
45 // This is an internal class used by VideoCaptureImplManager only. Do not access | |
46 // this directly. | |
48 class CONTENT_EXPORT VideoCaptureImpl | 47 class CONTENT_EXPORT VideoCaptureImpl |
49 : public VideoCaptureMessageFilter::Delegate { | 48 : public VideoCaptureMessageFilter::Delegate { |
50 public: | 49 public: |
51 ~VideoCaptureImpl() override; | 50 ~VideoCaptureImpl() override; |
52 | 51 |
53 VideoCaptureImpl(media::VideoCaptureSessionId session_id, | 52 VideoCaptureImpl(media::VideoCaptureSessionId session_id, |
54 VideoCaptureMessageFilter* filter); | 53 VideoCaptureMessageFilter* filter); |
55 | 54 |
56 // Start listening to IPC messages. | 55 // Start listening to IPC messages. |
57 void Init(); | 56 void Init(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 // Member params_ represents the video format requested by the | 162 // Member params_ represents the video format requested by the |
164 // client to this class via StartCapture(). | 163 // client to this class via StartCapture(). |
165 media::VideoCaptureParams params_; | 164 media::VideoCaptureParams params_; |
166 | 165 |
167 // The device's first captured frame timestamp sent from browser process side. | 166 // The device's first captured frame timestamp sent from browser process side. |
168 base::TimeTicks first_frame_timestamp_; | 167 base::TimeTicks first_frame_timestamp_; |
169 | 168 |
170 bool suspended_; | 169 bool suspended_; |
171 VideoCaptureState state_; | 170 VideoCaptureState state_; |
172 | 171 |
173 // |weak_factory_| and |thread_checker_| are bound to the IO thread. | 172 // Hold a pointer to the IO message loop to check we operate on the right |
174 base::ThreadChecker render_io_thread_checker_; | 173 // thread. |
mcasas
2015/03/16 20:34:06
This reads strange. Suggestion:
"IO message loop
emircan
2015/03/19 00:40:44
Done.
| |
174 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | |
175 | 175 |
176 // WeakPtrFactory pointing back to |this| object, for use with | 176 // WeakPtrFactory pointing back to |this| object, for use with |
177 // media::VideoFrames constructed in OnBufferReceived() from buffers cached | 177 // media::VideoFrames constructed in OnBufferReceived() from buffers cached |
178 // in |client_buffers_|. | 178 // in |client_buffers_|. |
179 // NOTE: Weak pointers must be invalidated before all other member variables. | 179 // NOTE: Weak pointers must be invalidated before all other member variables. |
180 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; | 180 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; |
181 | 181 |
182 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 182 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
183 }; | 183 }; |
184 | 184 |
185 } // namespace content | 185 } // namespace content |
186 | 186 |
187 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 187 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |