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

Side by Side Diff: content/browser/renderer_host/media/web_contents_video_capture_device.cc

Issue 11413078: Tab Audio Capture: Browser-side connect/disconnect functionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor tweaks and added some useful comments. Created 8 years 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 // Implementation notes: This needs to work on a variety of hardware 5 // Implementation notes: This needs to work on a variety of hardware
6 // configurations where the speed of the CPU and GPU greatly affect overall 6 // configurations where the speed of the CPU and GPU greatly affect overall
7 // performance. Therefore, the process of capturing has been split up into a 7 // performance. Therefore, the process of capturing has been split up into a
8 // pipeline of three stages. Each stage executes on its own thread: 8 // pipeline of three stages. Each stage executes on its own thread:
9 // 9 //
10 // 1. Capture: A bitmap is snapshotted/copied from the RenderView's backing 10 // 1. Capture: A bitmap is snapshotted/copied from the RenderView's backing
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 // Make each dimension a positive, even number; if not already. 135 // Make each dimension a positive, even number; if not already.
136 fitted_width = std::max(kMinFrameWidth, MakeEven(fitted_width)); 136 fitted_width = std::max(kMinFrameWidth, MakeEven(fitted_width));
137 fitted_height = std::max(kMinFrameHeight, MakeEven(fitted_height)); 137 fitted_height = std::max(kMinFrameHeight, MakeEven(fitted_height));
138 138
139 *fitted_size = gfx::Size(fitted_width, fitted_height); 139 *fitted_size = gfx::Size(fitted_width, fitted_height);
140 } 140 }
141 141
142 // Keeps track of the RenderView to be sourced, and executes copying of the 142 // Keeps track of the RenderView to be sourced, and executes copying of the
143 // backing store on the UI BrowserThread. 143 // backing store on the UI BrowserThread.
144 // TODO(miu): Use WebContentsCaptureUtil::RenderViewTracker instead of doing the
145 // observing ourselves here.
144 class BackingStoreCopier : public WebContentsObserver { 146 class BackingStoreCopier : public WebContentsObserver {
145 public: 147 public:
146 // Result status and done callback used with StartCopy(). 148 // Result status and done callback used with StartCopy().
147 enum Result { 149 enum Result {
148 OK, 150 OK,
149 TRANSIENT_ERROR, 151 TRANSIENT_ERROR,
150 NO_SOURCE, 152 NO_SOURCE,
151 }; 153 };
152 typedef base::Callback<void(Result result, 154 typedef base::Callback<void(Result result,
153 scoped_ptr<skia::PlatformBitmap> capture, 155 scoped_ptr<skia::PlatformBitmap> capture,
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 capturer_->SetConsumer(NULL); 1052 capturer_->SetConsumer(NULL);
1051 capturer_->DeAllocate(); 1053 capturer_->DeAllocate();
1052 } 1054 }
1053 1055
1054 const media::VideoCaptureDevice::Name& 1056 const media::VideoCaptureDevice::Name&
1055 WebContentsVideoCaptureDevice::device_name() { 1057 WebContentsVideoCaptureDevice::device_name() {
1056 return device_name_; 1058 return device_name_;
1057 } 1059 }
1058 1060
1059 } // namespace content 1061 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698