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

Side by Side Diff: media/video/capture/mac/video_capture_device_qtkit_mac.mm

Issue 12090109: Tab Capture: Backing store readbacks to YV12 VideoFrames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fix per wjia 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
« no previous file with comments | « media/base/video_util.cc ('k') | media/video/capture/screen/screen_capture_device_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" 5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
6 6
7 #import <QTKit/QTKit.h> 7 #import <QTKit/QTKit.h>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 == kCVReturnSuccess) { 223 == kCVReturnSuccess) {
224 void *baseAddress = CVPixelBufferGetBaseAddress(videoFrame); 224 void *baseAddress = CVPixelBufferGetBaseAddress(videoFrame);
225 size_t bytesPerRow = CVPixelBufferGetBytesPerRow(videoFrame); 225 size_t bytesPerRow = CVPixelBufferGetBytesPerRow(videoFrame);
226 int frameHeight = CVPixelBufferGetHeight(videoFrame); 226 int frameHeight = CVPixelBufferGetHeight(videoFrame);
227 int frameSize = bytesPerRow * frameHeight; 227 int frameSize = bytesPerRow * frameHeight;
228 228
229 // TODO(shess): bytesPerRow may not correspond to frameWidth_*4, 229 // TODO(shess): bytesPerRow may not correspond to frameWidth_*4,
230 // but VideoCaptureController::OnIncomingCapturedFrame() requires 230 // but VideoCaptureController::OnIncomingCapturedFrame() requires
231 // it to do so. Plumbing things through is intrusive, for now 231 // it to do so. Plumbing things through is intrusive, for now
232 // just deliver an adjusted buffer. 232 // just deliver an adjusted buffer.
233 // TODO(nick): This workaround could probably be eliminated by using
234 // VideoCaptureController::OnIncomingCapturedVideoFrame, which supports
235 // pitches.
233 UInt8* addressToPass = static_cast<UInt8*>(baseAddress); 236 UInt8* addressToPass = static_cast<UInt8*>(baseAddress);
234 size_t expectedBytesPerRow = frameWidth_ * 4; 237 size_t expectedBytesPerRow = frameWidth_ * 4;
235 if (bytesPerRow > expectedBytesPerRow) { 238 if (bytesPerRow > expectedBytesPerRow) {
236 // TODO(shess): frameHeight and frameHeight_ are not the same, 239 // TODO(shess): frameHeight and frameHeight_ are not the same,
237 // try to do what the surrounding code seems to assume. 240 // try to do what the surrounding code seems to assume.
238 // Ironically, captureCapability and frameSize are ignored 241 // Ironically, captureCapability and frameSize are ignored
239 // anyhow. 242 // anyhow.
240 adjustedFrame_.resize(expectedBytesPerRow * frameHeight); 243 adjustedFrame_.resize(expectedBytesPerRow * frameHeight);
241 // std::vector is contiguous according to standard. 244 // std::vector is contiguous according to standard.
242 UInt8* adjustedAddress = &adjustedFrame_[0]; 245 UInt8* adjustedAddress = &adjustedFrame_[0];
(...skipping 17 matching lines...) Expand all
260 263
261 // Deliver the captured video frame. 264 // Deliver the captured video frame.
262 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureCapability); 265 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureCapability);
263 266
264 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); 267 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags);
265 } 268 }
266 [lock_ unlock]; 269 [lock_ unlock];
267 } 270 }
268 271
269 @end 272 @end
OLDNEW
« no previous file with comments | « media/base/video_util.cc ('k') | media/video/capture/screen/screen_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698