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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RTC_DCHECK( | 415 RTC_DCHECK( |
416 uvPlaneAddress == yPlaneAddress + yPlaneHeight * yPlaneBytesPerRow); | 416 uvPlaneAddress == yPlaneAddress + yPlaneHeight * yPlaneBytesPerRow); |
417 | 417 |
418 // Stuff data into a cricket::CapturedFrame. | 418 // Stuff data into a cricket::CapturedFrame. |
419 int64 currentTime = rtc::TimeNanos(); | 419 int64_t currentTime = rtc::TimeNanos(); |
420 cricket::CapturedFrame frame; | 420 cricket::CapturedFrame frame; |
421 frame.width = yPlaneWidth; | 421 frame.width = yPlaneWidth; |
422 frame.height = yPlaneHeight; | 422 frame.height = yPlaneHeight; |
423 frame.pixel_width = 1; | 423 frame.pixel_width = 1; |
424 frame.pixel_height = 1; | 424 frame.pixel_height = 1; |
425 frame.fourcc = static_cast<uint32>(cricket::FOURCC_NV12); | 425 frame.fourcc = static_cast<uint32_t>(cricket::FOURCC_NV12); |
426 frame.time_stamp = currentTime; | 426 frame.time_stamp = currentTime; |
427 frame.elapsed_time = currentTime - _startTime; | 427 frame.elapsed_time = currentTime - _startTime; |
428 frame.data = yPlaneAddress; | 428 frame.data = yPlaneAddress; |
429 frame.data_size = frameSize; | 429 frame.data_size = frameSize; |
430 | 430 |
431 if (_startThread->IsCurrent()) { | 431 if (_startThread->IsCurrent()) { |
432 SignalFrameCaptured(this, &frame); | 432 SignalFrameCaptured(this, &frame); |
433 } else { | 433 } else { |
434 _startThread->Invoke<void>( | 434 _startThread->Invoke<void>( |
435 rtc::Bind(&AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread, | 435 rtc::Bind(&AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread, |
436 this, &frame)); | 436 this, &frame)); |
437 } | 437 } |
438 CVPixelBufferUnlockBaseAddress(imageBuffer, lockFlags); | 438 CVPixelBufferUnlockBaseAddress(imageBuffer, lockFlags); |
439 } | 439 } |
440 | 440 |
441 void AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread( | 441 void AVFoundationVideoCapturer::SignalFrameCapturedOnStartThread( |
442 const cricket::CapturedFrame* frame) { | 442 const cricket::CapturedFrame* frame) { |
443 RTC_DCHECK(_startThread->IsCurrent()); | 443 RTC_DCHECK(_startThread->IsCurrent()); |
444 // 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 |
445 // to I420. | 445 // to I420. |
446 SignalFrameCaptured(this, frame); | 446 SignalFrameCaptured(this, frame); |
447 } | 447 } |
448 | 448 |
449 } // namespace webrtc | 449 } // namespace webrtc |
OLD | NEW |