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

Side by Side Diff: content/renderer/media/video_capture_impl.h

Issue 2377163002: VideoCaptureImpl cleanup: merge ctor+Init() and DeInit()+dtor. (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 30 matching lines...) Expand all
41 // video_capture_impl_manager.cc for the lifetime of this object. 41 // video_capture_impl_manager.cc for the lifetime of this object.
42 // All methods must be called on the IO thread. 42 // All methods must be called on the IO thread.
43 // 43 //
44 // This is an internal class used by VideoCaptureImplManager only. Do not access 44 // This is an internal class used by VideoCaptureImplManager only. Do not access
45 // this directly. 45 // this directly.
46 class CONTENT_EXPORT VideoCaptureImpl 46 class CONTENT_EXPORT VideoCaptureImpl
47 : public VideoCaptureMessageFilter::Delegate { 47 : public VideoCaptureMessageFilter::Delegate {
48 public: 48 public:
49 ~VideoCaptureImpl() override; 49 ~VideoCaptureImpl() override;
50 50
51 VideoCaptureImpl(media::VideoCaptureSessionId session_id, 51 VideoCaptureImpl(
52 VideoCaptureMessageFilter* filter); 52 media::VideoCaptureSessionId session_id,
53 53 VideoCaptureMessageFilter* filter,
54 // Start listening to IPC messages. 54 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
55 void Init();
56
57 // Stop listening to IPC messages.
58 void DeInit();
59 55
60 // Stop/resume delivering video frames to clients, based on flag |suspend|. 56 // Stop/resume delivering video frames to clients, based on flag |suspend|.
61 void SuspendCapture(bool suspend); 57 void SuspendCapture(bool suspend);
62 58
63 // Start capturing using the provided parameters. 59 // Start capturing using the provided parameters.
64 // |client_id| must be unique to this object in the render process. It is 60 // |client_id| must be unique to this object in the render process. It is
65 // used later to stop receiving video frames. 61 // used later to stop receiving video frames.
66 // |state_update_cb| will be called when state changes. 62 // |state_update_cb| will be called when state changes.
67 // |deliver_frame_cb| will be called when a frame is ready. 63 // |deliver_frame_cb| will be called when a frame is ready.
68 void StartCapture(int client_id, 64 void StartCapture(int client_id,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 media::VideoCaptureParams params_; 185 media::VideoCaptureParams params_;
190 186
191 // The device's first captured frame referecne time sent from browser process 187 // The device's first captured frame referecne time sent from browser process
192 // side. 188 // side.
193 base::TimeTicks first_frame_ref_time_; 189 base::TimeTicks first_frame_ref_time_;
194 190
195 bool suspended_; 191 bool suspended_;
196 VideoCaptureState state_; 192 VideoCaptureState state_;
197 193
198 // IO message loop reference for checking correct class operation. 194 // IO message loop reference for checking correct class operation.
199 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 195 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
200 196
201 // WeakPtrFactory pointing back to |this| object, for use with 197 // WeakPtrFactory pointing back to |this| object, for use with
202 // media::VideoFrames constructed in OnBufferReceived() from buffers cached 198 // media::VideoFrames constructed in OnBufferReceived() from buffers cached
203 // in |client_buffers_|. 199 // in |client_buffers_|.
204 // NOTE: Weak pointers must be invalidated before all other member variables. 200 // NOTE: Weak pointers must be invalidated before all other member variables.
205 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; 201 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_;
206 202
207 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); 203 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl);
208 }; 204 };
209 205
210 } // namespace content 206 } // namespace content
211 207
212 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 208 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/video_capture_impl.cc » ('j') | content/renderer/media/video_capture_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698