| Index: webrtc/examples/unityplugin/video_observer.cc
|
| diff --git a/webrtc/examples/unityplugin/video_observer.cc b/webrtc/examples/unityplugin/video_observer.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9cf79c70b49881fcdf6c75a9df4a9b6cbd437cba
|
| --- /dev/null
|
| +++ b/webrtc/examples/unityplugin/video_observer.cc
|
| @@ -0,0 +1,27 @@
|
| +/*
|
| + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license
|
| + * that can be found in the LICENSE file in the root of the source
|
| + * tree. An additional intellectual property rights grant can be found
|
| + * in the file PATENTS. All contributing project authors may
|
| + * be found in the AUTHORS file in the root of the source tree.
|
| + */
|
| +
|
| +#include "webrtc/examples/unityplugin/video_observer.h"
|
| +
|
| +void VideoObserver::SetVideoCallback(I420FRAMEREADY_CALLBACK callback) {
|
| + std::lock_guard<std::mutex> lock(mutex);
|
| + OnI420FrameReady = callback;
|
| +}
|
| +
|
| +void VideoObserver::OnFrame(const webrtc::VideoFrame& frame) {
|
| + std::unique_lock<std::mutex> lock(mutex);
|
| + rtc::scoped_refptr<webrtc::PlanarYuvBuffer> buffer(
|
| + frame.video_frame_buffer()->ToI420());
|
| + if (OnI420FrameReady) {
|
| + OnI420FrameReady(buffer->DataY(), buffer->DataU(), buffer->DataV(),
|
| + buffer->StrideY(), buffer->StrideU(), buffer->StrideV(),
|
| + frame.width(), frame.height());
|
| + }
|
| +}
|
|
|