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 // VideoCaptureController is the glue between a VideoCaptureDevice and all | 5 // VideoCaptureController is the glue between a VideoCaptureDevice and all |
6 // VideoCaptureHosts that have connected to it. A controller exists on behalf of | 6 // VideoCaptureHosts that have connected to it. A controller exists on behalf of |
7 // one (and only one) VideoCaptureDevice; both are owned by the | 7 // one (and only one) VideoCaptureDevice; both are owned by the |
8 // VideoCaptureManager. | 8 // VideoCaptureManager. |
9 // | 9 // |
10 // The VideoCaptureController is responsible for: | 10 // The VideoCaptureController is responsible for: |
(...skipping 30 matching lines...) Expand all Loading... |
41 // * VideoCaptureManager (which owns the VCC) interacts directly with | 41 // * VideoCaptureManager (which owns the VCC) interacts directly with |
42 // VideoCaptureController through its public methods, to add and remove | 42 // VideoCaptureController through its public methods, to add and remove |
43 // clients. | 43 // clients. |
44 // | 44 // |
45 // VideoCaptureController is not thread safe and operates on the IO thread only. | 45 // VideoCaptureController is not thread safe and operates on the IO thread only. |
46 | 46 |
47 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 47 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
48 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 48 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
49 | 49 |
50 #include <list> | 50 #include <list> |
51 #include <map> | |
52 | 51 |
53 #include "base/compiler_specific.h" | 52 #include "base/compiler_specific.h" |
54 #include "base/memory/ref_counted.h" | 53 #include "base/memory/ref_counted.h" |
55 #include "base/memory/scoped_ptr.h" | 54 #include "base/memory/scoped_ptr.h" |
56 #include "base/memory/weak_ptr.h" | 55 #include "base/memory/weak_ptr.h" |
57 #include "base/process/process.h" | 56 #include "base/process/process.h" |
58 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" | 57 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" |
59 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" | 58 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" |
60 #include "content/common/content_export.h" | 59 #include "content/common/content_export.h" |
61 #include "content/common/media/video_capture.h" | 60 #include "content/common/media/video_capture.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 VideoCaptureControllerEventHandler* event_handler, | 103 VideoCaptureControllerEventHandler* event_handler, |
105 int buffer_id); | 104 int buffer_id); |
106 | 105 |
107 private: | 106 private: |
108 class VideoCaptureDeviceClient; | 107 class VideoCaptureDeviceClient; |
109 | 108 |
110 struct ControllerClient; | 109 struct ControllerClient; |
111 typedef std::list<ControllerClient*> ControllerClients; | 110 typedef std::list<ControllerClient*> ControllerClients; |
112 | 111 |
113 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. | 112 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. |
114 void DoIncomingCapturedFrameOnIOThread( | 113 void DoIncomingCapturedI420BufferOnIOThread( |
115 const scoped_refptr<media::VideoFrame>& captured_frame, | 114 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer, |
| 115 const gfx::Size& dimensions, |
116 int frame_rate, | 116 int frame_rate, |
117 base::Time timestamp); | 117 base::Time timestamp); |
118 void DoErrorOnIOThread(); | 118 void DoErrorOnIOThread(); |
119 void DoDeviceStoppedOnIOThread(); | 119 void DoDeviceStoppedOnIOThread(); |
120 void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); | 120 void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); |
121 | 121 |
122 // Find a client of |id| and |handler| in |clients|. | 122 // Find a client of |id| and |handler| in |clients|. |
123 ControllerClient* FindClient( | 123 ControllerClient* FindClient( |
124 const VideoCaptureControllerID& id, | 124 const VideoCaptureControllerID& id, |
125 VideoCaptureControllerEventHandler* handler, | 125 VideoCaptureControllerEventHandler* handler, |
(...skipping 15 matching lines...) Expand all Loading... |
141 VideoCaptureState state_; | 141 VideoCaptureState state_; |
142 | 142 |
143 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; | 143 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; |
144 | 144 |
145 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); | 145 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); |
146 }; | 146 }; |
147 | 147 |
148 } // namespace content | 148 } // namespace content |
149 | 149 |
150 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 150 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
OLD | NEW |