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

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

Issue 1421583007: Mac Video Capture: Sending the timestamps provided by the driver to the capture pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alignment Created 5 years, 1 month 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
« no previous file with comments | « media/capture/video/mac/video_capture_device_mac.mm ('k') | no next file » | 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/capture/video/mac/video_capture_device_qtkit_mac.h" 5 #import "media/capture/video/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"
11 #include "media/base/timestamp_constants.h"
11 #include "media/base/video_capture_types.h" 12 #include "media/base/video_capture_types.h"
12 #include "media/capture/video/mac/video_capture_device_mac.h" 13 #include "media/capture/video/mac/video_capture_device_mac.h"
13 #include "media/capture/video/video_capture_device.h" 14 #include "media/capture/video/video_capture_device.h"
14 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
15 16
16 @implementation VideoCaptureDeviceQTKit 17 @implementation VideoCaptureDeviceQTKit
17 18
18 #pragma mark Class methods 19 #pragma mark Class methods
19 20
20 + (void)getDeviceNames:(NSMutableDictionary*)deviceNames { 21 + (void)getDeviceNames:(NSMutableDictionary*)deviceNames {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 CFNumberRef aspectDenominatorRef = (CFNumberRef)CFDictionaryGetValue( 319 CFNumberRef aspectDenominatorRef = (CFNumberRef)CFDictionaryGetValue(
319 aspectRatioDict, kCVImageBufferPixelAspectRatioVerticalSpacingKey); 320 aspectRatioDict, kCVImageBufferPixelAspectRatioVerticalSpacingKey);
320 DCHECK(aspectNumeratorRef && aspectDenominatorRef) 321 DCHECK(aspectNumeratorRef && aspectDenominatorRef)
321 << "Aspect Ratio dictionary missing its entries."; 322 << "Aspect Ratio dictionary missing its entries.";
322 CFNumberGetValue(aspectNumeratorRef, kCFNumberIntType, &aspectNumerator); 323 CFNumberGetValue(aspectNumeratorRef, kCFNumberIntType, &aspectNumerator);
323 CFNumberGetValue(aspectDenominatorRef, kCFNumberIntType, 324 CFNumberGetValue(aspectDenominatorRef, kCFNumberIntType,
324 &aspectDenominator); 325 &aspectDenominator);
325 } 326 }
326 327
327 // Deliver the captured video frame. 328 // Deliver the captured video frame.
329 const QTTime qt_timestamp = [sampleBuffer presentationTime];
330 base::TimeDelta timestamp;
331 if (!(qt_timestamp.flags & kQTTimeIsIndefinite) && qt_timestamp.timeScale) {
332 timestamp = base::TimeDelta::FromMicroseconds(
333 qt_timestamp.timeValue * base::TimeTicks::kMicrosecondsPerSecond /
334 qt_timestamp.timeScale);
335 } else {
336 timestamp = media::kNoTimestamp();
337 }
328 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureFormat, 338 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureFormat,
329 aspectNumerator, aspectDenominator); 339 aspectNumerator, aspectDenominator, timestamp);
330 340
331 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); 341 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags);
332 } 342 }
333 [lock_ unlock]; 343 [lock_ unlock];
334 } 344 }
335 345
336 - (void)handleNotification:(NSNotification*)errorNotification { 346 - (void)handleNotification:(NSNotification*)errorNotification {
337 NSError* error = (NSError*) 347 NSError* error = (NSError*)
338 [[errorNotification userInfo] objectForKey:QTCaptureSessionErrorKey]; 348 [[errorNotification userInfo] objectForKey:QTCaptureSessionErrorKey];
339 [self sendErrorString: 349 [self sendErrorString:
(...skipping 11 matching lines...) Expand all
351 361
352 - (void)sendLogString:(NSString*)message { 362 - (void)sendLogString:(NSString*)message {
353 DVLOG(1) << [message UTF8String]; 363 DVLOG(1) << [message UTF8String];
354 [lock_ lock]; 364 [lock_ lock];
355 if (frameReceiver_) 365 if (frameReceiver_)
356 frameReceiver_->LogMessage([message UTF8String]); 366 frameReceiver_->LogMessage([message UTF8String]);
357 [lock_ unlock]; 367 [lock_ unlock];
358 } 368 }
359 369
360 @end 370 @end
OLDNEW
« no previous file with comments | « media/capture/video/mac/video_capture_device_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698