OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 |
11 #include "examples/unityplugin/video_observer.h" | 11 #include "examples/unityplugin/video_observer.h" |
12 | 12 |
13 void VideoObserver::SetVideoCallback(I420FRAMEREADY_CALLBACK callback) { | 13 void VideoObserver::SetVideoCallback(I420FRAMEREADY_CALLBACK callback) { |
14 std::lock_guard<std::mutex> lock(mutex); | 14 std::lock_guard<std::mutex> lock(mutex); |
15 OnI420FrameReady = callback; | 15 OnI420FrameReady = callback; |
16 } | 16 } |
17 | 17 |
18 void VideoObserver::OnFrame(const webrtc::VideoFrame& frame) { | 18 void VideoObserver::OnFrame(const webrtc::VideoFrame& frame) { |
19 std::unique_lock<std::mutex> lock(mutex); | 19 std::unique_lock<std::mutex> lock(mutex); |
20 rtc::scoped_refptr<webrtc::PlanarYuvBuffer> buffer( | 20 rtc::scoped_refptr<webrtc::I420BufferInterface> buffer( |
21 frame.video_frame_buffer()->ToI420()); | 21 frame.video_frame_buffer()->ToI420()); |
22 if (OnI420FrameReady) { | 22 if (OnI420FrameReady) { |
23 OnI420FrameReady(buffer->DataY(), buffer->DataU(), buffer->DataV(), | 23 OnI420FrameReady( |
24 buffer->StrideY(), buffer->StrideU(), buffer->StrideV(), | 24 buffer->DataY(), buffer->DataU(), buffer->DataV(), nullptr, /*DataA*/ |
25 frame.width(), frame.height()); | 25 buffer->StrideY(), buffer->StrideU(), buffer->StrideV(), 0, /*StrideA*/ |
| 26 frame.width(), frame.height()); |
26 } | 27 } |
27 } | 28 } |
OLD | NEW |