• 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 package org.webrtc;
12 
13 // Explicit imports necessary for JNI generation.
14 import androidx.annotation.Nullable;
15 import org.webrtc.VideoEncoder;
16 
17 /**
18  * This class contains the Java glue code for JNI generation of VideoEncoder.
19  */
20 class VideoEncoderWrapper {
21   @CalledByNative
getScalingSettingsOn(VideoEncoder.ScalingSettings scalingSettings)22   static boolean getScalingSettingsOn(VideoEncoder.ScalingSettings scalingSettings) {
23     return scalingSettings.on;
24   }
25 
26   @Nullable
27   @CalledByNative
getScalingSettingsLow(VideoEncoder.ScalingSettings scalingSettings)28   static Integer getScalingSettingsLow(VideoEncoder.ScalingSettings scalingSettings) {
29     return scalingSettings.low;
30   }
31 
32   @Nullable
33   @CalledByNative
getScalingSettingsHigh(VideoEncoder.ScalingSettings scalingSettings)34   static Integer getScalingSettingsHigh(VideoEncoder.ScalingSettings scalingSettings) {
35     return scalingSettings.high;
36   }
37 
38   @CalledByNative
createEncoderCallback(final long nativeEncoder)39   static VideoEncoder.Callback createEncoderCallback(final long nativeEncoder) {
40     return (EncodedImage frame,
41                VideoEncoder.CodecSpecificInfo info) -> nativeOnEncodedFrame(nativeEncoder, frame);
42   }
43 
nativeOnEncodedFrame( long nativeVideoEncoderWrapper, EncodedImage frame)44   private static native void nativeOnEncodedFrame(
45       long nativeVideoEncoderWrapper, EncodedImage frame);
46 }
47