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

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

Issue 7649016: Removing singleton property of MediaStreamManager and creating thread first when needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changing unit tests based on review by scherkus. Created 9 years, 4 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // VideoCaptureController is the glue between VideoCaptureHost, 5 // VideoCaptureController is the glue between VideoCaptureHost,
6 // VideoCaptureManager and VideoCaptureDevice. 6 // VideoCaptureManager and VideoCaptureDevice.
7 // It provides functions for VideoCaptureHost to start a VideoCaptureDevice and 7 // It provides functions for VideoCaptureHost to start a VideoCaptureDevice and
8 // is responsible for keeping track of TransportDIBs and filling them with I420 8 // is responsible for keeping track of TransportDIBs and filling them with I420
9 // video frames for IPC communication between VideoCaptureHost and 9 // video frames for IPC communication between VideoCaptureHost and
10 // VideoCaptureMessageFilter. 10 // VideoCaptureMessageFilter.
11 // It implements media::VideoCaptureDevice::EventHandler to get video frames 11 // It implements media::VideoCaptureDevice::EventHandler to get video frames
12 // from a VideoCaptureDevice object and do color conversion straight into the 12 // from a VideoCaptureDevice object and do color conversion straight into the
13 // TransportDIBs to avoid a memory copy. 13 // TransportDIBs to avoid a memory copy.
14 14
15 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ 15 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_
16 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ 16 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_
17 17
18 #include <list> 18 #include <list>
19 #include <map> 19 #include <map>
20 20
21 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
22 #include "base/process.h" 22 #include "base/process.h"
23 #include "base/synchronization/lock.h" 23 #include "base/synchronization/lock.h"
24 #include "base/task.h" 24 #include "base/task.h"
25 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" 25 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h"
26 #include "media/video/capture/video_capture_device.h" 26 #include "media/video/capture/video_capture_device.h"
27 #include "media/video/capture/video_capture_types.h" 27 #include "media/video/capture/video_capture_types.h"
28 #include "ui/gfx/surface/transport_dib.h" 28 #include "ui/gfx/surface/transport_dib.h"
29 29
30 namespace media_stream {
31 class VideoCaptureManager;
32 } // namespace media_stream
33
30 class VideoCaptureController 34 class VideoCaptureController
31 : public base::RefCountedThreadSafe<VideoCaptureController>, 35 : public base::RefCountedThreadSafe<VideoCaptureController>,
32 public media::VideoCaptureDevice::EventHandler { 36 public media::VideoCaptureDevice::EventHandler {
33 public: 37 public:
34 VideoCaptureController(const VideoCaptureControllerID& id, 38 VideoCaptureController(
35 base::ProcessHandle render_process, 39 const VideoCaptureControllerID& id,
36 VideoCaptureControllerEventHandler* event_handler); 40 base::ProcessHandle render_process,
41 VideoCaptureControllerEventHandler* event_handler,
42 media_stream::VideoCaptureManager* video_capture_manager);
37 virtual ~VideoCaptureController(); 43 virtual ~VideoCaptureController();
38 44
39 // Starts video capturing and tries to use the resolution specified in 45 // Starts video capturing and tries to use the resolution specified in
40 // params. 46 // params.
41 // When capturing has started VideoCaptureControllerEventHandler::OnFrameInfo 47 // When capturing has started VideoCaptureControllerEventHandler::OnFrameInfo
42 // is called with resolution that best matches the requested that the video 48 // is called with resolution that best matches the requested that the video
43 // capture device support. 49 // capture device support.
44 void StartCapture(const media::VideoCaptureParams& params); 50 void StartCapture(const media::VideoCaptureParams& params);
45 51
46 // Stop video capture. 52 // Stop video capture.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 DIBMap owned_dibs_; 86 DIBMap owned_dibs_;
81 VideoCaptureControllerEventHandler* event_handler_; 87 VideoCaptureControllerEventHandler* event_handler_;
82 88
83 // The parameter that was requested when starting the capture device. 89 // The parameter that was requested when starting the capture device.
84 media::VideoCaptureParams params_; 90 media::VideoCaptureParams params_;
85 91
86 // ID used for identifying this object. 92 // ID used for identifying this object.
87 VideoCaptureControllerID id_; 93 VideoCaptureControllerID id_;
88 media::VideoCaptureDevice::Capability frame_info_; 94 media::VideoCaptureDevice::Capability frame_info_;
89 95
96 media_stream::VideoCaptureManager* video_capture_manager_;
97
90 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); 98 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController);
91 }; 99 };
92 100
93 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ 101 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698