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

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: 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
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"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 aspectRatioDict, kCVImageBufferPixelAspectRatioHorizontalSpacingKey); 317 aspectRatioDict, kCVImageBufferPixelAspectRatioHorizontalSpacingKey);
318 CFNumberRef aspectDenominatorRef = (CFNumberRef)CFDictionaryGetValue( 318 CFNumberRef aspectDenominatorRef = (CFNumberRef)CFDictionaryGetValue(
319 aspectRatioDict, kCVImageBufferPixelAspectRatioVerticalSpacingKey); 319 aspectRatioDict, kCVImageBufferPixelAspectRatioVerticalSpacingKey);
320 DCHECK(aspectNumeratorRef && aspectDenominatorRef) 320 DCHECK(aspectNumeratorRef && aspectDenominatorRef)
321 << "Aspect Ratio dictionary missing its entries."; 321 << "Aspect Ratio dictionary missing its entries.";
322 CFNumberGetValue(aspectNumeratorRef, kCFNumberIntType, &aspectNumerator); 322 CFNumberGetValue(aspectNumeratorRef, kCFNumberIntType, &aspectNumerator);
323 CFNumberGetValue(aspectDenominatorRef, kCFNumberIntType, 323 CFNumberGetValue(aspectDenominatorRef, kCFNumberIntType,
324 &aspectDenominator); 324 &aspectDenominator);
325 } 325 }
326 326
327 QTTime qt_timestamp = [sampleBuffer presentationTime];
mcasas 2015/10/31 03:24:25 const
qiangchen 2015/11/02 18:21:21 Done.
327 // Deliver the captured video frame. 328 // Deliver the captured video frame.
329 const int microseconds_per_second = 1000000;
330 const base::TimeTicks timestamp =
331 base::TimeTicks() +
332 base::TimeDelta::FromMicroseconds(qt_timestamp.timeValue *
333 microseconds_per_second /
334 qt_timestamp.timeScale);
328 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureFormat, 335 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureFormat,
329 aspectNumerator, aspectDenominator); 336 aspectNumerator, aspectDenominator, timestamp);
330 337
331 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); 338 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags);
332 } 339 }
333 [lock_ unlock]; 340 [lock_ unlock];
334 } 341 }
335 342
336 - (void)handleNotification:(NSNotification*)errorNotification { 343 - (void)handleNotification:(NSNotification*)errorNotification {
337 NSError* error = (NSError*) 344 NSError* error = (NSError*)
338 [[errorNotification userInfo] objectForKey:QTCaptureSessionErrorKey]; 345 [[errorNotification userInfo] objectForKey:QTCaptureSessionErrorKey];
339 [self sendErrorString: 346 [self sendErrorString:
(...skipping 11 matching lines...) Expand all
351 358
352 - (void)sendLogString:(NSString*)message { 359 - (void)sendLogString:(NSString*)message {
353 DVLOG(1) << [message UTF8String]; 360 DVLOG(1) << [message UTF8String];
354 [lock_ lock]; 361 [lock_ lock];
355 if (frameReceiver_) 362 if (frameReceiver_)
356 frameReceiver_->LogMessage([message UTF8String]); 363 frameReceiver_->LogMessage([message UTF8String]);
357 [lock_ unlock]; 364 [lock_ unlock];
358 } 365 }
359 366
360 @end 367 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698