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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 NSDictionary *captureDictionary = [NSDictionary | 133 NSDictionary *captureDictionary = [NSDictionary |
134 dictionaryWithObject: | 134 dictionaryWithObject: |
135 [NSNumber numberWithUnsignedInt:kCVPixelFormatType_422YpCbCr8] | 135 [NSNumber numberWithUnsignedInt:kCVPixelFormatType_422YpCbCr8] |
136 forKey:(id)kCVPixelBufferPixelFormatTypeKey]; | 136 forKey:(id)kCVPixelBufferPixelFormatTypeKey]; |
137 [captureDecompressedOutput setPixelBufferAttributes:captureDictionary]; | 137 [captureDecompressedOutput setPixelBufferAttributes:captureDictionary]; |
138 | 138 |
139 return YES; | 139 return YES; |
140 } else { | 140 } else { |
141 // Remove the previously set capture device. | 141 // Remove the previously set capture device. |
142 if (!captureDeviceInput_) { | 142 if (!captureDeviceInput_) { |
143 [self sendErrorString:[NSString | 143 // Being here means stopping a device that never started OK in the first |
| 144 // place, log it. |
| 145 [self sendLogString:[NSString |
144 stringWithUTF8String:"No video capture device set, on removal."]]; | 146 stringWithUTF8String:"No video capture device set, on removal."]]; |
145 return YES; | 147 return YES; |
146 } | 148 } |
147 if ([[captureSession_ inputs] count] > 0) { | 149 if ([[captureSession_ inputs] count] > 0) { |
148 // The device is still running. | 150 // The device is still running. |
149 [self stopCapture]; | 151 [self stopCapture]; |
150 } | 152 } |
151 if ([[captureSession_ outputs] count] > 0) { | 153 if ([[captureSession_ outputs] count] > 0) { |
152 // Only one output is set for |captureSession_|. | 154 // Only one output is set for |captureSession_|. |
153 DCHECK_EQ([[captureSession_ outputs] count], 1u); | 155 DCHECK_EQ([[captureSession_ outputs] count], 1u); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 340 } |
339 | 341 |
340 - (void)sendErrorString:(NSString*)error { | 342 - (void)sendErrorString:(NSString*)error { |
341 DLOG(ERROR) << [error UTF8String]; | 343 DLOG(ERROR) << [error UTF8String]; |
342 [lock_ lock]; | 344 [lock_ lock]; |
343 if (frameReceiver_) | 345 if (frameReceiver_) |
344 frameReceiver_->ReceiveError([error UTF8String]); | 346 frameReceiver_->ReceiveError([error UTF8String]); |
345 [lock_ unlock]; | 347 [lock_ unlock]; |
346 } | 348 } |
347 | 349 |
| 350 - (void)sendLogString:(NSString*)message { |
| 351 DVLOG(1) << [message UTF8String]; |
| 352 [lock_ lock]; |
| 353 if (frameReceiver_) |
| 354 frameReceiver_->LogMessage([message UTF8String]); |
| 355 [lock_ unlock]; |
| 356 } |
| 357 |
348 @end | 358 @end |
OLD | NEW |