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

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

Issue 12090109: Tab Capture: Backing store readbacks to YV12 VideoFrames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for review. Created 7 years, 10 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) 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 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 shared DIBs and filling them with I420 8 // is responsible for keeping track of shared DIBs 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.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Return a buffer previously given in 61 // Return a buffer previously given in
62 // VideoCaptureControllerEventHandler::OnBufferReady. 62 // VideoCaptureControllerEventHandler::OnBufferReady.
63 void ReturnBuffer(const VideoCaptureControllerID& id, 63 void ReturnBuffer(const VideoCaptureControllerID& id,
64 VideoCaptureControllerEventHandler* event_handler, 64 VideoCaptureControllerEventHandler* event_handler,
65 int buffer_id); 65 int buffer_id);
66 66
67 // Implement media::VideoCaptureDevice::EventHandler. 67 // Implement media::VideoCaptureDevice::EventHandler.
68 virtual void OnIncomingCapturedFrame(const uint8* data, 68 virtual void OnIncomingCapturedFrame(const uint8* data,
69 int length, 69 int length,
70 base::Time timestamp) OVERRIDE; 70 base::Time timestamp) OVERRIDE;
71 virtual void OnIncomingCapturedVideoFrame(media::VideoFrame* frame,
72 base::Time timestamp) OVERRIDE;
71 virtual void OnError() OVERRIDE; 73 virtual void OnError() OVERRIDE;
72 virtual void OnFrameInfo( 74 virtual void OnFrameInfo(
73 const media::VideoCaptureCapability& info) OVERRIDE; 75 const media::VideoCaptureCapability& info) OVERRIDE;
74 76
75 protected: 77 protected:
76 virtual ~VideoCaptureController(); 78 virtual ~VideoCaptureController();
77 79
78 private: 80 private:
79 friend class base::RefCountedThreadSafe<VideoCaptureController>; 81 friend class base::RefCountedThreadSafe<VideoCaptureController>;
80 82
(...skipping 20 matching lines...) Expand all
101 const ControllerClients& clients); 103 const ControllerClients& clients);
102 // Find a client of |session_id| in |clients|. 104 // Find a client of |session_id| in |clients|.
103 ControllerClient* FindClient( 105 ControllerClient* FindClient(
104 int session_id, 106 int session_id,
105 const ControllerClients& clients); 107 const ControllerClients& clients);
106 // Decide what to do after kStopping state. Dependent on events, controller 108 // Decide what to do after kStopping state. Dependent on events, controller
107 // can stay in kStopping state, or go to kStopped, or restart capture. 109 // can stay in kStopping state, or go to kStopped, or restart capture.
108 void PostStopping(); 110 void PostStopping();
109 // Check if any DIB is used by client. 111 // Check if any DIB is used by client.
110 bool ClientHasDIB(); 112 bool ClientHasDIB();
113 // DIB allocator. Locate a free DIB object, reserve it, and return its id
114 // as well as pointers to its color planes. Returns true if successful.
115 bool ReserveSharedMemory(
116 int* buffer_id_out, uint8** yplane, uint8** uplane, uint8** vplane);
111 117
112 // Lock to protect free_dibs_ and owned_dibs_. 118 // Lock to protect free_dibs_ and owned_dibs_.
113 base::Lock lock_; 119 base::Lock lock_;
114 120
115 struct SharedDIB; 121 struct SharedDIB;
116 typedef std::map<int /*buffer_id*/, SharedDIB*> DIBMap; 122 typedef std::map<int /*buffer_id*/, SharedDIB*> DIBMap;
117 // All DIBs created by this object. 123 // All DIBs created by this object.
118 // It's modified only on IO thread. 124 // It's modified only on IO thread.
119 DIBMap owned_dibs_; 125 DIBMap owned_dibs_;
120 126
(...skipping 21 matching lines...) Expand all
142 148
143 bool device_in_use_; 149 bool device_in_use_;
144 VideoCaptureState state_; 150 VideoCaptureState state_;
145 151
146 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); 152 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController);
147 }; 153 };
148 154
149 } // namespace content 155 } // namespace content
150 156
151 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ 157 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698