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;
|
|
|
|
|
|
2021-08-14 11:41:59 +09:00
|
|
|
import androidx.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);
|
|
|
|
|
|
|
|
|
|
/**
|
2020-02-26 13:01:19 +01:00
|
|
|
* Called with the current available bitrate. Returns null if the encoder selector prefers to
|
|
|
|
|
* keep the current encoder or a VideoCodecInfo if a new encoder is preferred.
|
|
|
|
|
*/
|
2020-03-02 13:10:24 +01:00
|
|
|
@Nullable @CalledByNative("VideoEncoderSelector") VideoCodecInfo onAvailableBitrate(int kbps);
|
2020-02-26 13:01:19 +01:00
|
|
|
|
2022-04-11 10:48:28 +02:00
|
|
|
/**
|
|
|
|
|
* Called every time the encoder input resolution change. Returns null if the encoder selector
|
|
|
|
|
* prefers to keep the current encoder or a VideoCodecInfo if a new encoder is preferred.
|
|
|
|
|
*/
|
|
|
|
|
@Nullable
|
|
|
|
|
@CalledByNative("VideoEncoderSelector")
|
|
|
|
|
default VideoCodecInfo onResolutionChange(int widht, int height) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-26 13:01:19 +01:00
|
|
|
/**
|
|
|
|
|
* Called when the currently used encoder signal itself as broken. Returns null if the encoder
|
|
|
|
|
* selector prefers to keep the current encoder or a VideoCodecInfo if a new encoder is
|
|
|
|
|
* preferred.
|
2020-02-12 11:24:45 +01:00
|
|
|
*/
|
|
|
|
|
@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
|
|
|
}
|