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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sampleBuffer); | 464 CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sampleBuffer); |
465 if (image_buffer == NULL) { | 465 if (image_buffer == NULL) { |
466 return; | 466 return; |
467 } | 467 } |
468 | 468 |
469 // Retain the buffer and post it to the webrtc thread. It will be released | 469 // Retain the buffer and post it to the webrtc thread. It will be released |
470 // after it has successfully been signaled. | 470 // after it has successfully been signaled. |
471 CVBufferRetain(image_buffer); | 471 CVBufferRetain(image_buffer); |
472 AVFoundationFrame frame(image_buffer, rtc::TimeNanos()); | 472 AVFoundationFrame frame(image_buffer, rtc::TimeNanos()); |
473 _startThread->Post(this, kMessageTypeFrame, | 473 _startThread->Post(FROM_HERE, this, kMessageTypeFrame, |
474 new rtc::TypedMessageData<AVFoundationFrame>(frame)); | 474 new rtc::TypedMessageData<AVFoundationFrame>(frame)); |
475 } | 475 } |
476 | 476 |
477 void AVFoundationVideoCapturer::OnMessage(rtc::Message *msg) { | 477 void AVFoundationVideoCapturer::OnMessage(rtc::Message *msg) { |
478 switch (msg->message_id) { | 478 switch (msg->message_id) { |
479 case kMessageTypeFrame: { | 479 case kMessageTypeFrame: { |
480 rtc::TypedMessageData<AVFoundationFrame>* data = | 480 rtc::TypedMessageData<AVFoundationFrame>* data = |
481 static_cast<rtc::TypedMessageData<AVFoundationFrame>*>(msg->pdata); | 481 static_cast<rtc::TypedMessageData<AVFoundationFrame>*>(msg->pdata); |
482 const AVFoundationFrame& frame = data->data(); | 482 const AVFoundationFrame& frame = data->data(); |
483 OnFrameMessage(frame.image_buffer, frame.capture_time); | 483 OnFrameMessage(frame.image_buffer, frame.capture_time); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 536 |
537 // This will call a superclass method that will perform the frame conversion | 537 // This will call a superclass method that will perform the frame conversion |
538 // to I420. | 538 // to I420. |
539 SignalFrameCaptured(this, &frame); | 539 SignalFrameCaptured(this, &frame); |
540 | 540 |
541 CVPixelBufferUnlockBaseAddress(image_buffer, lock_flags); | 541 CVPixelBufferUnlockBaseAddress(image_buffer, lock_flags); |
542 CVBufferRelease(image_buffer); | 542 CVBufferRelease(image_buffer); |
543 } | 543 } |
544 | 544 |
545 } // namespace webrtc | 545 } // namespace webrtc |
OLD | NEW |