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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 480 |
481 CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sampleBuffer); | 481 CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sampleBuffer); |
482 if (image_buffer == NULL) { | 482 if (image_buffer == NULL) { |
483 return; | 483 return; |
484 } | 484 } |
485 | 485 |
486 // Retain the buffer and post it to the webrtc thread. It will be released | 486 // Retain the buffer and post it to the webrtc thread. It will be released |
487 // after it has successfully been signaled. | 487 // after it has successfully been signaled. |
488 CVBufferRetain(image_buffer); | 488 CVBufferRetain(image_buffer); |
489 AVFoundationFrame frame(image_buffer, rtc::TimeNanos()); | 489 AVFoundationFrame frame(image_buffer, rtc::TimeNanos()); |
490 _startThread->Post(this, kMessageTypeFrame, | 490 _startThread->Post(RTC_FROM_HERE, this, kMessageTypeFrame, |
491 new rtc::TypedMessageData<AVFoundationFrame>(frame)); | 491 new rtc::TypedMessageData<AVFoundationFrame>(frame)); |
492 } | 492 } |
493 | 493 |
494 void AVFoundationVideoCapturer::OnMessage(rtc::Message *msg) { | 494 void AVFoundationVideoCapturer::OnMessage(rtc::Message *msg) { |
495 switch (msg->message_id) { | 495 switch (msg->message_id) { |
496 case kMessageTypeFrame: { | 496 case kMessageTypeFrame: { |
497 rtc::TypedMessageData<AVFoundationFrame>* data = | 497 rtc::TypedMessageData<AVFoundationFrame>* data = |
498 static_cast<rtc::TypedMessageData<AVFoundationFrame>*>(msg->pdata); | 498 static_cast<rtc::TypedMessageData<AVFoundationFrame>*>(msg->pdata); |
499 const AVFoundationFrame& frame = data->data(); | 499 const AVFoundationFrame& frame = data->data(); |
500 OnFrameMessage(frame.image_buffer, frame.capture_time); | 500 OnFrameMessage(frame.image_buffer, frame.capture_time); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 553 |
554 // This will call a superclass method that will perform the frame conversion | 554 // This will call a superclass method that will perform the frame conversion |
555 // to I420. | 555 // to I420. |
556 SignalFrameCaptured(this, &frame); | 556 SignalFrameCaptured(this, &frame); |
557 | 557 |
558 CVPixelBufferUnlockBaseAddress(image_buffer, lock_flags); | 558 CVPixelBufferUnlockBaseAddress(image_buffer, lock_flags); |
559 CVBufferRelease(image_buffer); | 559 CVBufferRelease(image_buffer); |
560 } | 560 } |
561 | 561 |
562 } // namespace webrtc | 562 } // namespace webrtc |
OLD | NEW |