OLD | NEW |
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 size_t frameSize = | 408 size_t frameSize = |
409 yPlaneBytesPerRow * yPlaneHeight + uvPlaneBytesPerRow * uvPlaneHeight; | 409 yPlaneBytesPerRow * yPlaneHeight + uvPlaneBytesPerRow * uvPlaneHeight; |
410 | 410 |
411 // Sanity check assumption that planar bytes are contiguous. | 411 // Sanity check assumption that planar bytes are contiguous. |
412 uint8_t* uvPlaneAddress = | 412 uint8_t* uvPlaneAddress = |
413 (uint8_t*)CVPixelBufferGetBaseAddressOfPlane(imageBuffer, kUVPlaneIndex); | 413 (uint8_t*)CVPixelBufferGetBaseAddressOfPlane(imageBuffer, kUVPlaneIndex); |
414 RTC_DCHECK( | 414 RTC_DCHECK( |
415 uvPlaneAddress == yPlaneAddress + yPlaneHeight * yPlaneBytesPerRow); | 415 uvPlaneAddress == yPlaneAddress + yPlaneHeight * yPlaneBytesPerRow); |
416 | 416 |
417 // Stuff data into a cricket::CapturedFrame. | 417 // Stuff data into a cricket::CapturedFrame. |
418 int64 currentTime = rtc::TimeNanos(); | 418 int64_t currentTime = rtc::TimeNanos(); |
419 cricket::CapturedFrame frame; | 419 cricket::CapturedFrame frame; |
420 frame.width = yPlaneWidth; | 420 frame.width = yPlaneWidth; |
421 frame.height = yPlaneHeight; | 421 frame.height = yPlaneHeight; |
422 frame.pixel_width = 1; | 422 frame.pixel_width = 1; |
423 frame.pixel_height = 1; | 423 frame.pixel_height = 1; |
424 frame.fourcc = static_cast<uint32>(cricket::FOURCC_NV12); | 424 frame.fourcc = static_cast<uint32_t>(cricket::FOURCC_NV12); |
425 frame.time_stamp = currentTime; | 425 frame.time_stamp = currentTime; |
426 frame.data = yPlaneAddress; | 426 frame.data = yPlaneAddress; |
427 frame.data_size = frameSize; | 427 frame.data_size = frameSize; |
428 | 428 |
429 if (_startThread->IsCurrent()) { | 429 if (_startThread->IsCurrent()) { |
430 SignalFrameCaptured(this, &frame); | 430 SignalFrameCaptured(this, &frame); |
431 } else { | 431 } else { |
432 _startThread->Invoke<void>( | 432 _startThread->Invoke<void>( |
433 rtc::Bind(&AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread, | 433 rtc::Bind(&AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread, |
434 this, &frame)); | 434 this, &frame)); |
435 } | 435 } |
436 CVPixelBufferUnlockBaseAddress(imageBuffer, lockFlags); | 436 CVPixelBufferUnlockBaseAddress(imageBuffer, lockFlags); |
437 } | 437 } |
438 | 438 |
439 void AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread( | 439 void AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread( |
440 const cricket::CapturedFrame* frame) { | 440 const cricket::CapturedFrame* frame) { |
441 RTC_DCHECK(_startThread->IsCurrent()); | 441 RTC_DCHECK(_startThread->IsCurrent()); |
442 // This will call a superclass method that will perform the frame conversion | 442 // This will call a superclass method that will perform the frame conversion |
443 // to I420. | 443 // to I420. |
444 SignalFrameCaptured(this, frame); | 444 SignalFrameCaptured(this, frame); |
445 } | 445 } |
446 | 446 |
447 } // namespace webrtc | 447 } // namespace webrtc |
OLD | NEW |