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

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

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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 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/capture/video/mac/video_capture_device_avfoundation_mac.h" 5 #import "media/capture/video/mac/video_capture_device_avfoundation_mac.h"
6 6
7 #import <CoreMedia/CoreMedia.h> 7 #import <CoreMedia/CoreMedia.h>
8 #import <CoreVideo/CoreVideo.h> 8 #import <CoreVideo/CoreVideo.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 { 475 {
476 base::AutoLock lock(lock_); 476 base::AutoLock lock(lock_);
477 const CoreMediaGlue::CMTime cm_timestamp = 477 const CoreMediaGlue::CMTime cm_timestamp =
478 CoreMediaGlue::CMSampleBufferGetPresentationTimeStamp(sampleBuffer); 478 CoreMediaGlue::CMSampleBufferGetPresentationTimeStamp(sampleBuffer);
479 const base::TimeDelta timestamp = 479 const base::TimeDelta timestamp =
480 CMTIME_IS_VALID(cm_timestamp) 480 CMTIME_IS_VALID(cm_timestamp)
481 ? base::TimeDelta::FromMicroseconds( 481 ? base::TimeDelta::FromMicroseconds(
482 cm_timestamp.value * base::TimeTicks::kMicrosecondsPerSecond / 482 cm_timestamp.value * base::TimeTicks::kMicrosecondsPerSecond /
483 cm_timestamp.timescale) 483 cm_timestamp.timescale)
484 : media::kNoTimestamp(); 484 : media::kNoTimestamp;
485 485
486 if (frameReceiver_ && baseAddress) { 486 if (frameReceiver_ && baseAddress) {
487 frameReceiver_->ReceiveFrame(reinterpret_cast<uint8_t*>(baseAddress), 487 frameReceiver_->ReceiveFrame(reinterpret_cast<uint8_t*>(baseAddress),
488 frameSize, captureFormat, 0, 0, timestamp); 488 frameSize, captureFormat, 0, 0, timestamp);
489 } 489 }
490 } 490 }
491 491
492 if (videoFrame) 492 if (videoFrame)
493 CVPixelBufferUnlockBaseAddress(videoFrame, kCVPixelBufferLock_ReadOnly); 493 CVPixelBufferUnlockBaseAddress(videoFrame, kCVPixelBufferLock_ReadOnly);
494 } 494 }
495 495
496 - (void)onVideoError:(NSNotification*)errorNotification { 496 - (void)onVideoError:(NSNotification*)errorNotification {
497 NSError* error = base::mac::ObjCCast<NSError>([[errorNotification userInfo] 497 NSError* error = base::mac::ObjCCast<NSError>([[errorNotification userInfo]
498 objectForKey:AVFoundationGlue::AVCaptureSessionErrorKey()]); 498 objectForKey:AVFoundationGlue::AVCaptureSessionErrorKey()]);
499 [self sendErrorString:[NSString 499 [self sendErrorString:[NSString
500 stringWithFormat:@"%@: %@", 500 stringWithFormat:@"%@: %@",
501 [error localizedDescription], 501 [error localizedDescription],
502 [error localizedFailureReason]]]; 502 [error localizedFailureReason]]];
503 } 503 }
504 504
505 - (void)sendErrorString:(NSString*)error { 505 - (void)sendErrorString:(NSString*)error {
506 DLOG(ERROR) << [error UTF8String]; 506 DLOG(ERROR) << [error UTF8String];
507 base::AutoLock lock(lock_); 507 base::AutoLock lock(lock_);
508 if (frameReceiver_) 508 if (frameReceiver_)
509 frameReceiver_->ReceiveError(FROM_HERE, [error UTF8String]); 509 frameReceiver_->ReceiveError(FROM_HERE, [error UTF8String]);
510 } 510 }
511 511
512 @end 512 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698