| 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 #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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 const int kLockFlags = 0; | 241 const int kLockFlags = 0; |
| 242 if (CVPixelBufferLockBaseAddress(videoFrame, kLockFlags) | 242 if (CVPixelBufferLockBaseAddress(videoFrame, kLockFlags) |
| 243 == kCVReturnSuccess) { | 243 == kCVReturnSuccess) { |
| 244 void *baseAddress = CVPixelBufferGetBaseAddress(videoFrame); | 244 void *baseAddress = CVPixelBufferGetBaseAddress(videoFrame); |
| 245 size_t bytesPerRow = CVPixelBufferGetBytesPerRow(videoFrame); | 245 size_t bytesPerRow = CVPixelBufferGetBytesPerRow(videoFrame); |
| 246 size_t frameWidth = CVPixelBufferGetWidth(videoFrame); | 246 size_t frameWidth = CVPixelBufferGetWidth(videoFrame); |
| 247 size_t frameHeight = CVPixelBufferGetHeight(videoFrame); | 247 size_t frameHeight = CVPixelBufferGetHeight(videoFrame); |
| 248 size_t frameSize = bytesPerRow * frameHeight; | 248 size_t frameSize = bytesPerRow * frameHeight; |
| 249 | 249 |
| 250 // TODO(shess): bytesPerRow may not correspond to frameWidth_*2, | 250 // TODO(shess): bytesPerRow may not correspond to frameWidth_*2, |
| 251 // but VideoCaptureController::OnIncomingCapturedFrame() requires | 251 // but VideoCaptureController::OnIncomingCapturedData() requires |
| 252 // it to do so. Plumbing things through is intrusive, for now | 252 // it to do so. Plumbing things through is intrusive, for now |
| 253 // just deliver an adjusted buffer. | 253 // just deliver an adjusted buffer. |
| 254 // TODO(nick): This workaround could probably be eliminated by using | 254 // TODO(nick): This workaround could probably be eliminated by using |
| 255 // VideoCaptureController::OnIncomingCapturedVideoFrame, which supports | 255 // VideoCaptureController::OnIncomingCapturedVideoFrame, which supports |
| 256 // pitches. | 256 // pitches. |
| 257 UInt8* addressToPass = static_cast<UInt8*>(baseAddress); | 257 UInt8* addressToPass = static_cast<UInt8*>(baseAddress); |
| 258 // UYVY is 2 bytes per pixel. | 258 // UYVY is 2 bytes per pixel. |
| 259 size_t expectedBytesPerRow = frameWidth * 2; | 259 size_t expectedBytesPerRow = frameWidth * 2; |
| 260 if (bytesPerRow > expectedBytesPerRow) { | 260 if (bytesPerRow > expectedBytesPerRow) { |
| 261 // TODO(shess): frameHeight and frameHeight_ are not the same, | 261 // TODO(shess): frameHeight and frameHeight_ are not the same, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 [lock_ unlock]; | 306 [lock_ unlock]; |
| 307 } | 307 } |
| 308 | 308 |
| 309 - (void)handleNotification:(NSNotification*)errorNotification { | 309 - (void)handleNotification:(NSNotification*)errorNotification { |
| 310 NSError * error = (NSError*)[[errorNotification userInfo] | 310 NSError * error = (NSError*)[[errorNotification userInfo] |
| 311 objectForKey:QTCaptureSessionErrorKey]; | 311 objectForKey:QTCaptureSessionErrorKey]; |
| 312 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); | 312 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); |
| 313 } | 313 } |
| 314 | 314 |
| 315 @end | 315 @end |
| OLD | NEW |