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 import org.webrtc.VideoEncoder; 14 15 /** 16 * An implementation of VideoEncoder that is used for testing of functionalities of 17 * VideoEncoderWrapper. 18 */ 19 class FakeVideoEncoder implements VideoEncoder { 20 @Override initEncode(Settings settings, Callback encodeCallback)21 public VideoCodecStatus initEncode(Settings settings, Callback encodeCallback) { 22 return VideoCodecStatus.OK; 23 } 24 25 @Override release()26 public VideoCodecStatus release() { 27 return VideoCodecStatus.OK; 28 } 29 30 @Override encode(VideoFrame frame, EncodeInfo info)31 public VideoCodecStatus encode(VideoFrame frame, EncodeInfo info) { 32 return VideoCodecStatus.OK; 33 } 34 35 @Override setRateAllocation(BitrateAllocation allocation, int framerate)36 public VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate) { 37 return VideoCodecStatus.OK; 38 } 39 40 @Override getScalingSettings()41 public ScalingSettings getScalingSettings() { 42 return ScalingSettings.OFF; 43 } 44 45 @Override getResolutionBitrateLimits()46 public ResolutionBitrateLimits[] getResolutionBitrateLimits() { 47 ResolutionBitrateLimits resolution_bitrate_limits[] = { 48 new ResolutionBitrateLimits(/* frameSizePixels = */ 640 * 360, 49 /* minStartBitrateBps = */ 300000, 50 /* minBitrateBps = */ 200000, 51 /* maxBitrateBps = */ 1000000)}; 52 53 return resolution_bitrate_limits; 54 } 55 56 @Override getImplementationName()57 public String getImplementationName() { 58 return "FakeVideoEncoder"; 59 } 60 } 61