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

Side by Side Diff: talk/app/webrtc/objc/avfoundationvideocapturer.mm

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 years, 3 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
« no previous file with comments | « talk/app/webrtc/objc/RTCFileLogger.mm ('k') | talk/app/webrtc/peerconnectionfactory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 LOG(LS_ERROR) << "The capturer is already running."; 329 LOG(LS_ERROR) << "The capturer is already running.";
330 return cricket::CaptureState::CS_FAILED; 330 return cricket::CaptureState::CS_FAILED;
331 } 331 }
332 if (format != kDefaultFormat) { 332 if (format != kDefaultFormat) {
333 LOG(LS_ERROR) << "Unsupported format provided."; 333 LOG(LS_ERROR) << "Unsupported format provided.";
334 return cricket::CaptureState::CS_FAILED; 334 return cricket::CaptureState::CS_FAILED;
335 } 335 }
336 336
337 // Keep track of which thread capture started on. This is the thread that 337 // Keep track of which thread capture started on. This is the thread that
338 // frames need to be sent to. 338 // frames need to be sent to.
339 DCHECK(!_startThread); 339 RTC_DCHECK(!_startThread);
340 _startThread = rtc::Thread::Current(); 340 _startThread = rtc::Thread::Current();
341 341
342 SetCaptureFormat(&format); 342 SetCaptureFormat(&format);
343 // This isn't super accurate because it takes a while for the AVCaptureSession 343 // This isn't super accurate because it takes a while for the AVCaptureSession
344 // to spin up, and this call returns async. 344 // to spin up, and this call returns async.
345 // TODO(tkchin): make this better. 345 // TODO(tkchin): make this better.
346 [_capturer startCaptureAsync]; 346 [_capturer startCaptureAsync];
347 _startTime = rtc::TimeNanos(); 347 _startTime = rtc::TimeNanos();
348 SetCaptureState(cricket::CaptureState::CS_RUNNING); 348 SetCaptureState(cricket::CaptureState::CS_RUNNING);
349 349
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 size_t uvPlaneHeight = 405 size_t uvPlaneHeight =
406 CVPixelBufferGetHeightOfPlane(imageBuffer, kUVPlaneIndex); 406 CVPixelBufferGetHeightOfPlane(imageBuffer, kUVPlaneIndex);
407 size_t uvPlaneBytesPerRow = 407 size_t uvPlaneBytesPerRow =
408 CVPixelBufferGetBytesPerRowOfPlane(imageBuffer, kUVPlaneIndex); 408 CVPixelBufferGetBytesPerRowOfPlane(imageBuffer, kUVPlaneIndex);
409 size_t frameSize = 409 size_t frameSize =
410 yPlaneBytesPerRow * yPlaneHeight + uvPlaneBytesPerRow * uvPlaneHeight; 410 yPlaneBytesPerRow * yPlaneHeight + uvPlaneBytesPerRow * uvPlaneHeight;
411 411
412 // Sanity check assumption that planar bytes are contiguous. 412 // Sanity check assumption that planar bytes are contiguous.
413 uint8_t* uvPlaneAddress = 413 uint8_t* uvPlaneAddress =
414 (uint8_t*)CVPixelBufferGetBaseAddressOfPlane(imageBuffer, kUVPlaneIndex); 414 (uint8_t*)CVPixelBufferGetBaseAddressOfPlane(imageBuffer, kUVPlaneIndex);
415 DCHECK(uvPlaneAddress == yPlaneAddress + yPlaneHeight * yPlaneBytesPerRow); 415 RTC_DCHECK(
416 uvPlaneAddress == yPlaneAddress + yPlaneHeight * yPlaneBytesPerRow);
416 417
417 // Stuff data into a cricket::CapturedFrame. 418 // Stuff data into a cricket::CapturedFrame.
418 int64 currentTime = rtc::TimeNanos(); 419 int64 currentTime = rtc::TimeNanos();
419 cricket::CapturedFrame frame; 420 cricket::CapturedFrame frame;
420 frame.width = yPlaneWidth; 421 frame.width = yPlaneWidth;
421 frame.height = yPlaneHeight; 422 frame.height = yPlaneHeight;
422 frame.pixel_width = 1; 423 frame.pixel_width = 1;
423 frame.pixel_height = 1; 424 frame.pixel_height = 1;
424 frame.fourcc = static_cast<uint32>(cricket::FOURCC_NV12); 425 frame.fourcc = static_cast<uint32>(cricket::FOURCC_NV12);
425 frame.time_stamp = currentTime; 426 frame.time_stamp = currentTime;
426 frame.elapsed_time = currentTime - _startTime; 427 frame.elapsed_time = currentTime - _startTime;
427 frame.data = yPlaneAddress; 428 frame.data = yPlaneAddress;
428 frame.data_size = frameSize; 429 frame.data_size = frameSize;
429 430
430 if (_startThread->IsCurrent()) { 431 if (_startThread->IsCurrent()) {
431 SignalFrameCaptured(this, &frame); 432 SignalFrameCaptured(this, &frame);
432 } else { 433 } else {
433 _startThread->Invoke<void>( 434 _startThread->Invoke<void>(
434 rtc::Bind(&AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread, 435 rtc::Bind(&AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread,
435 this, &frame)); 436 this, &frame));
436 } 437 }
437 CVPixelBufferUnlockBaseAddress(imageBuffer, lockFlags); 438 CVPixelBufferUnlockBaseAddress(imageBuffer, lockFlags);
438 } 439 }
439 440
440 void AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread( 441 void AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread(
441 const cricket::CapturedFrame* frame) { 442 const cricket::CapturedFrame* frame) {
442 DCHECK(_startThread->IsCurrent()); 443 RTC_DCHECK(_startThread->IsCurrent());
443 // This will call a superclass method that will perform the frame conversion 444 // This will call a superclass method that will perform the frame conversion
444 // to I420. 445 // to I420.
445 SignalFrameCaptured(this, frame); 446 SignalFrameCaptured(this, frame);
446 } 447 }
447 448
448 } // namespace webrtc 449 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/objc/RTCFileLogger.mm ('k') | talk/app/webrtc/peerconnectionfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698