Anders Carlsson | c3fedcc | 2017-11-15 14:36:33 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include <jni.h> |
| 12 | |
| 13 | #include "media/engine/videoencodersoftwarefallbackwrapper.h" |
| 14 | #include "sdk/android/src/jni/jni_helpers.h" |
| 15 | #include "sdk/android/src/jni/wrappednativecodec.h" |
| 16 | |
| 17 | namespace webrtc { |
| 18 | namespace jni { |
| 19 | |
| 20 | JNI_FUNCTION_DECLARATION(jlong, |
| 21 | VideoEncoderFallback_createNativeEncoder, |
| 22 | JNIEnv* jni, |
| 23 | jclass, |
| 24 | jobject j_fallback_encoder, |
| 25 | jobject j_primary_encoder) { |
| 26 | std::unique_ptr<VideoEncoder> fallback_encoder = |
| 27 | JavaToNativeVideoEncoder(jni, j_fallback_encoder); |
| 28 | std::unique_ptr<VideoEncoder> primary_encoder = |
| 29 | JavaToNativeVideoEncoder(jni, j_primary_encoder); |
| 30 | |
| 31 | VideoEncoderSoftwareFallbackWrapper* nativeWrapper = |
| 32 | new VideoEncoderSoftwareFallbackWrapper(std::move(fallback_encoder), |
| 33 | std::move(primary_encoder)); |
| 34 | |
| 35 | return jlongFromPointer(nativeWrapper); |
| 36 | } |
| 37 | |
| 38 | } // namespace jni |
| 39 | } // namespace webrtc |