Add VideoEncoderFactory::GetImplementations function.
The GetImplementations function is similar to the GetSupportedFormats function, but instead of providing one SdpVideoFormat per codec it provides one per codec implementation. These SdpVideoFormats can then be tagged so that a certain implementation can be instantiated when CreateVideoEncoder is called. Bug: webrtc:10795 Change-Id: I79f2380aa03d75d5f9f36138625abf3543c2339d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145215 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28553}
This commit is contained in:
@ -29,6 +29,10 @@ VideoEncoderFactoryWrapper::VideoEncoderFactoryWrapper(
|
||||
Java_VideoEncoderFactory_getSupportedCodecs(jni, encoder_factory);
|
||||
supported_formats_ = JavaToNativeVector<SdpVideoFormat>(
|
||||
jni, j_supported_codecs, &VideoCodecInfoToSdpVideoFormat);
|
||||
const ScopedJavaLocalRef<jobjectArray> j_implementations =
|
||||
Java_VideoEncoderFactory_getImplementations(jni, encoder_factory);
|
||||
implementations_ = JavaToNativeVector<SdpVideoFormat>(
|
||||
jni, j_implementations, &VideoCodecInfoToSdpVideoFormat);
|
||||
}
|
||||
VideoEncoderFactoryWrapper::~VideoEncoderFactoryWrapper() = default;
|
||||
|
||||
@ -49,6 +53,11 @@ std::vector<SdpVideoFormat> VideoEncoderFactoryWrapper::GetSupportedFormats()
|
||||
return supported_formats_;
|
||||
}
|
||||
|
||||
std::vector<SdpVideoFormat> VideoEncoderFactoryWrapper::GetImplementations()
|
||||
const {
|
||||
return implementations_;
|
||||
}
|
||||
|
||||
VideoEncoderFactory::CodecInfo VideoEncoderFactoryWrapper::QueryVideoEncoder(
|
||||
const SdpVideoFormat& format) const {
|
||||
JNIEnv* jni = AttachCurrentThreadIfNeeded();
|
||||
|
||||
@ -35,11 +35,14 @@ class VideoEncoderFactoryWrapper : public VideoEncoderFactory {
|
||||
// Returns a list of supported codecs in order of preference.
|
||||
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
|
||||
|
||||
std::vector<SdpVideoFormat> GetImplementations() const override;
|
||||
|
||||
CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const override;
|
||||
|
||||
private:
|
||||
const ScopedJavaGlobalRef<jobject> encoder_factory_;
|
||||
std::vector<SdpVideoFormat> supported_formats_;
|
||||
std::vector<SdpVideoFormat> implementations_;
|
||||
};
|
||||
|
||||
} // namespace jni
|
||||
|
||||
Reference in New Issue
Block a user