• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "api/video_codecs/video_decoder_software_fallback_wrapper.h"
14 #include "sdk/android/generated_video_jni/VideoDecoderFallback_jni.h"
15 #include "sdk/android/src/jni/jni_helpers.h"
16 #include "sdk/android/src/jni/video_decoder_wrapper.h"
17 
18 namespace webrtc {
19 namespace jni {
20 
JNI_VideoDecoderFallback_CreateDecoder(JNIEnv * jni,const JavaParamRef<jobject> & j_fallback_decoder,const JavaParamRef<jobject> & j_primary_decoder)21 static jlong JNI_VideoDecoderFallback_CreateDecoder(
22     JNIEnv* jni,
23     const JavaParamRef<jobject>& j_fallback_decoder,
24     const JavaParamRef<jobject>& j_primary_decoder) {
25   std::unique_ptr<VideoDecoder> fallback_decoder =
26       JavaToNativeVideoDecoder(jni, j_fallback_decoder);
27   std::unique_ptr<VideoDecoder> primary_decoder =
28       JavaToNativeVideoDecoder(jni, j_primary_decoder);
29 
30   VideoDecoder* nativeWrapper =
31       CreateVideoDecoderSoftwareFallbackWrapper(std::move(fallback_decoder),
32                                                 std::move(primary_decoder))
33           .release();
34 
35   return jlongFromPointer(nativeWrapper);
36 }
37 
38 }  // namespace jni
39 }  // namespace webrtc
40