OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 | 617 |
618 CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sampleBuffer); | 618 CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sampleBuffer); |
619 if (image_buffer == NULL) { | 619 if (image_buffer == NULL) { |
620 return; | 620 return; |
621 } | 621 } |
622 | 622 |
623 // Retain the buffer and post it to the webrtc thread. It will be released | 623 // Retain the buffer and post it to the webrtc thread. It will be released |
624 // after it has successfully been signaled. | 624 // after it has successfully been signaled. |
625 CVBufferRetain(image_buffer); | 625 CVBufferRetain(image_buffer); |
626 AVFoundationFrame frame(image_buffer, rtc::TimeNanos()); | 626 AVFoundationFrame frame(image_buffer, rtc::TimeNanos()); |
627 _startThread->Post(this, kMessageTypeFrame, | 627 _startThread->Post(RTC_FROM_HERE, this, kMessageTypeFrame, |
628 new rtc::TypedMessageData<AVFoundationFrame>(frame)); | 628 new rtc::TypedMessageData<AVFoundationFrame>(frame)); |
629 } | 629 } |
630 | 630 |
631 void AVFoundationVideoCapturer::OnMessage(rtc::Message *msg) { | 631 void AVFoundationVideoCapturer::OnMessage(rtc::Message *msg) { |
632 switch (msg->message_id) { | 632 switch (msg->message_id) { |
633 case kMessageTypeFrame: { | 633 case kMessageTypeFrame: { |
634 rtc::TypedMessageData<AVFoundationFrame>* data = | 634 rtc::TypedMessageData<AVFoundationFrame>* data = |
635 static_cast<rtc::TypedMessageData<AVFoundationFrame>*>(msg->pdata); | 635 static_cast<rtc::TypedMessageData<AVFoundationFrame>*>(msg->pdata); |
636 const AVFoundationFrame& frame = data->data(); | 636 const AVFoundationFrame& frame = data->data(); |
637 OnFrameMessage(frame.image_buffer, frame.capture_time); | 637 OnFrameMessage(frame.image_buffer, frame.capture_time); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 | 690 |
691 // This will call a superclass method that will perform the frame conversion | 691 // This will call a superclass method that will perform the frame conversion |
692 // to I420. | 692 // to I420. |
693 SignalFrameCaptured(this, &frame); | 693 SignalFrameCaptured(this, &frame); |
694 | 694 |
695 CVPixelBufferUnlockBaseAddress(image_buffer, lock_flags); | 695 CVPixelBufferUnlockBaseAddress(image_buffer, lock_flags); |
696 CVBufferRelease(image_buffer); | 696 CVBufferRelease(image_buffer); |
697 } | 697 } |
698 | 698 |
699 } // namespace webrtc | 699 } // namespace webrtc |
OLD | NEW |