mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 06:40:43 +01:00

This method used to just wrap frame when passed a native frame and create a new one when passed non-native frame. This caused a memory leak when a new frame was returned because the caller didn't release the frame. Now the method always returns a new frame and the caller is responsible for releasing it. Bug: webrtc:8892, b/72675429 Change-Id: I06d67a6ed4c059cae1d709c51b0266f9c72fef1a Reviewed-on: https://webrtc-review.googlesource.com/53840 Reviewed-by: Anders Carlsson <andersc@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22033}
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
/*
|
|
* Copyright 2018 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 "sdk/android/native_api/video/wrapper.h"
|
|
|
|
#include "rtc_base/ptr_util.h"
|
|
#include "sdk/android/native_api/jni/scoped_java_ref.h"
|
|
#include "sdk/android/src/jni/videoframe.h"
|
|
#include "sdk/android/src/jni/videosink.h"
|
|
|
|
namespace webrtc {
|
|
|
|
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> JavaToNativeVideoSink(
|
|
JNIEnv* jni,
|
|
jobject video_sink) {
|
|
return rtc::MakeUnique<jni::VideoSinkWrapper>(
|
|
jni, JavaParamRef<jobject>(video_sink));
|
|
}
|
|
|
|
ScopedJavaLocalRef<jobject> NativeToJavaVideoFrame(JNIEnv* jni,
|
|
const VideoFrame& frame) {
|
|
return jni::NativeToJavaVideoFrame(jni, frame);
|
|
}
|
|
|
|
} // namespace webrtc
|