| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_avfoundation_mac.h" | 5 #import "media/video/capture/mac/video_capture_device_avfoundation_mac.h" |
| 6 | 6 |
| 7 #import <CoreVideo/CoreVideo.h> | 7 #import <CoreVideo/CoreVideo.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 272 |
| 273 #pragma mark Private methods | 273 #pragma mark Private methods |
| 274 | 274 |
| 275 // |captureOutput| is called by the capture device to deliver a new frame. | 275 // |captureOutput| is called by the capture device to deliver a new frame. |
| 276 - (void)captureOutput:(CrAVCaptureOutput*)captureOutput | 276 - (void)captureOutput:(CrAVCaptureOutput*)captureOutput |
| 277 didOutputSampleBuffer:(CoreMediaGlue::CMSampleBufferRef)sampleBuffer | 277 didOutputSampleBuffer:(CoreMediaGlue::CMSampleBufferRef)sampleBuffer |
| 278 fromConnection:(CrAVCaptureConnection*)connection { | 278 fromConnection:(CrAVCaptureConnection*)connection { |
| 279 // AVFoundation calls from a number of threads, depending on, at least, if | 279 // AVFoundation calls from a number of threads, depending on, at least, if |
| 280 // Chrome is on foreground or background. Sample the actual thread here. | 280 // Chrome is on foreground or background. Sample the actual thread here. |
| 281 callback_thread_checker_.DetachFromThread(); | 281 callback_thread_checker_.DetachFromThread(); |
| 282 callback_thread_checker_.CalledOnValidThread(); | 282 CHECK(callback_thread_checker_.CalledOnValidThread()); |
| 283 | 283 |
| 284 const CoreMediaGlue::CMFormatDescriptionRef formatDescription = | 284 const CoreMediaGlue::CMFormatDescriptionRef formatDescription = |
| 285 CoreMediaGlue::CMSampleBufferGetFormatDescription(sampleBuffer); | 285 CoreMediaGlue::CMSampleBufferGetFormatDescription(sampleBuffer); |
| 286 const FourCharCode fourcc = | 286 const FourCharCode fourcc = |
| 287 CoreMediaGlue::CMFormatDescriptionGetMediaSubType(formatDescription); | 287 CoreMediaGlue::CMFormatDescriptionGetMediaSubType(formatDescription); |
| 288 const CoreMediaGlue::CMVideoDimensions dimensions = | 288 const CoreMediaGlue::CMVideoDimensions dimensions = |
| 289 CoreMediaGlue::CMVideoFormatDescriptionGetDimensions(formatDescription); | 289 CoreMediaGlue::CMVideoFormatDescriptionGetDimensions(formatDescription); |
| 290 const media::VideoCaptureFormat captureFormat( | 290 const media::VideoCaptureFormat captureFormat( |
| 291 gfx::Size(dimensions.width, dimensions.height), | 291 gfx::Size(dimensions.width, dimensions.height), |
| 292 frameRate_, | 292 frameRate_, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } | 342 } |
| 343 | 343 |
| 344 - (void)sendErrorString:(NSString*)error { | 344 - (void)sendErrorString:(NSString*)error { |
| 345 DLOG(ERROR) << [error UTF8String]; | 345 DLOG(ERROR) << [error UTF8String]; |
| 346 base::AutoLock lock(lock_); | 346 base::AutoLock lock(lock_); |
| 347 if (frameReceiver_) | 347 if (frameReceiver_) |
| 348 frameReceiver_->ReceiveError([error UTF8String]); | 348 frameReceiver_->ReceiveError([error UTF8String]); |
| 349 } | 349 } |
| 350 | 350 |
| 351 @end | 351 @end |
| OLD | NEW |