2017-06-16 09:23:50 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright 2017 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package org.webrtc;
|
|
|
|
|
|
2018-12-10 12:30:46 +01:00
|
|
|
import android.support.annotation.Nullable;
|
2018-03-22 13:32:44 +01:00
|
|
|
|
2017-06-16 09:23:50 -07:00
|
|
|
/** Factory for creating VideoEncoders. */
|
2017-06-20 11:35:04 -07:00
|
|
|
public interface VideoEncoderFactory {
|
2020-02-12 11:24:45 +01:00
|
|
|
public interface VideoEncoderSelector {
|
|
|
|
|
/** Called with the VideoCodecInfo of the currently used encoder. */
|
|
|
|
|
@CalledByNative("VideoEncoderSelector") void onCurrentEncoder(VideoCodecInfo info);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Called with the current encoding bitrate. Returns null if the encoder
|
|
|
|
|
* selector which to keep the current encoder or a VideoCodecInfo if a
|
|
|
|
|
* new encoder is preferred.
|
|
|
|
|
*/
|
|
|
|
|
@Nullable @CalledByNative("VideoEncoderSelector") VideoCodecInfo onEncodingBitrate(int kbps);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Called when the currently used encoder signal itself as broken. Returns
|
|
|
|
|
* null if the encoder selector which to keep the current encoder or a
|
|
|
|
|
* VideoCodecInfo if a new encoder is preferred.
|
|
|
|
|
*/
|
|
|
|
|
@Nullable @CalledByNative("VideoEncoderSelector") VideoCodecInfo onEncoderBroken();
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-16 09:23:50 -07:00
|
|
|
/** Creates an encoder for the given video codec. */
|
2018-03-22 13:32:44 +01:00
|
|
|
@Nullable @CalledByNative VideoEncoder createEncoder(VideoCodecInfo info);
|
2017-06-16 09:23:50 -07:00
|
|
|
|
2017-09-04 03:57:21 -07:00
|
|
|
/**
|
|
|
|
|
* Enumerates the list of supported video codecs. This method will only be called once and the
|
|
|
|
|
* result will be cached.
|
|
|
|
|
*/
|
2017-12-07 14:07:20 +01:00
|
|
|
@CalledByNative VideoCodecInfo[] getSupportedCodecs();
|
2019-07-11 13:23:16 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Enumerates the list of supported video codecs that can also be tagged with
|
|
|
|
|
* implementation information. This method will only be called once and the
|
|
|
|
|
* result will be cached.
|
|
|
|
|
*/
|
|
|
|
|
@CalledByNative
|
|
|
|
|
default VideoCodecInfo[] getImplementations() {
|
|
|
|
|
return getSupportedCodecs();
|
|
|
|
|
}
|
2020-02-12 11:24:45 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a VideoEncoderSelector if implemented by the VideoEncoderFactory,
|
|
|
|
|
* null otherwise.
|
|
|
|
|
*/
|
|
|
|
|
@CalledByNative
|
|
|
|
|
default VideoEncoderSelector getEncoderSelector() {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2017-06-16 09:23:50 -07:00
|
|
|
}
|