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

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: Fallback 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Deliver the captured video frame. 327 // Deliver the captured video frame.
328 const QTTime qt_timestamp = [sampleBuffer presentationTime];
329 base::TimeTicks timestamp;
330 if (!(qt_timestamp.flags & kQTTimeIsIndefinite) && qt_timestamp.timeScale) {
331 timestamp =
332 base::TimeTicks() +
333 base::TimeDelta::FromMicroseconds(
334 qt_timestamp.timeValue * base::TimeTicks::kMicrosecondsPerSecond /
335 qt_timestamp.timeScale);
336 } else {
337 timestamp = base::TimeTicks::Now();
338 }
328 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureFormat, 339 frameReceiver_->ReceiveFrame(addressToPass, frameSize, captureFormat,
329 aspectNumerator, aspectDenominator); 340 aspectNumerator, aspectDenominator, timestamp);
330 341
331 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags); 342 CVPixelBufferUnlockBaseAddress(videoFrame, kLockFlags);
332 } 343 }
333 [lock_ unlock]; 344 [lock_ unlock];
334 } 345 }
335 346
336 - (void)handleNotification:(NSNotification*)errorNotification { 347 - (void)handleNotification:(NSNotification*)errorNotification {
337 NSError* error = (NSError*) 348 NSError* error = (NSError*)
338 [[errorNotification userInfo] objectForKey:QTCaptureSessionErrorKey]; 349 [[errorNotification userInfo] objectForKey:QTCaptureSessionErrorKey];
339 [self sendErrorString: 350 [self sendErrorString:
(...skipping 11 matching lines...) Expand all
351 362
352 - (void)sendLogString:(NSString*)message { 363 - (void)sendLogString:(NSString*)message {
353 DVLOG(1) << [message UTF8String]; 364 DVLOG(1) << [message UTF8String];
354 [lock_ lock]; 365 [lock_ lock];
355 if (frameReceiver_) 366 if (frameReceiver_)
356 frameReceiver_->LogMessage([message UTF8String]); 367 frameReceiver_->LogMessage([message UTF8String]);
357 [lock_ unlock]; 368 [lock_ unlock];
358 } 369 }
359 370
360 @end 371 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698