In objc software video encoder wrappers expose functions to list supported scalability modes.
Bug: b/299588022 Change-Id: I41c06b1e4257d6ce47cadfec65e98f224c0f6be0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/360682 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42883}
This commit is contained in:
parent
41fffaa6f4
commit
61a52146f5
@ -763,8 +763,11 @@ if (is_ios || is_mac) {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":base_objc",
|
":base_objc",
|
||||||
|
":helpers_objc",
|
||||||
":wrapped_native_codec_objc",
|
":wrapped_native_codec_objc",
|
||||||
|
"../api/video_codecs:scalability_mode",
|
||||||
"../modules/video_coding:webrtc_vp8",
|
"../modules/video_coding:webrtc_vp8",
|
||||||
|
"../modules/video_coding:webrtc_vp8_scalability",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,7 +783,9 @@ if (is_ios || is_mac) {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":base_objc",
|
":base_objc",
|
||||||
|
":helpers_objc",
|
||||||
":wrapped_native_codec_objc",
|
":wrapped_native_codec_objc",
|
||||||
|
"../api/video_codecs:scalability_mode",
|
||||||
"../modules/video_coding:webrtc_vp9",
|
"../modules/video_coding:webrtc_vp9",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -811,7 +816,10 @@ if (is_ios || is_mac) {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":base_objc",
|
":base_objc",
|
||||||
|
":helpers_objc",
|
||||||
":wrapped_native_codec_objc",
|
":wrapped_native_codec_objc",
|
||||||
|
"../api/video_codecs:scalability_mode",
|
||||||
|
"../modules/video_coding/codecs/av1:av1_svc_config",
|
||||||
"../modules/video_coding/codecs/av1:libaom_av1_encoder",
|
"../modules/video_coding/codecs/av1:libaom_av1_encoder",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,12 @@ RTC_OBJC_EXPORT
|
|||||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
||||||
* used independently from the RTCPeerConnectionFactory.
|
* used independently from the RTCPeerConnectionFactory.
|
||||||
*/
|
*/
|
||||||
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)av1Encoder;
|
+ (nonnull id<RTC_OBJC_TYPE(RTCVideoEncoder)>)av1Encoder;
|
||||||
|
|
||||||
|
/* Returns list of scalability modes supported by the encoder that can be
|
||||||
|
* created with `av1Encoder` method above.
|
||||||
|
*/
|
||||||
|
+ (nonnull NSArray<NSString*>*)supportedScalabilityModes;
|
||||||
|
|
||||||
+ (bool)isSupported;
|
+ (bool)isSupported;
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,10 @@
|
|||||||
#import "RTCNativeVideoEncoder.h"
|
#import "RTCNativeVideoEncoder.h"
|
||||||
#import "RTCNativeVideoEncoderBuilder+Native.h"
|
#import "RTCNativeVideoEncoderBuilder+Native.h"
|
||||||
#import "RTCVideoEncoderAV1.h"
|
#import "RTCVideoEncoderAV1.h"
|
||||||
|
#import "helpers/NSString+StdString.h"
|
||||||
|
|
||||||
|
#include "api/video_codecs/scalability_mode.h"
|
||||||
|
#include "modules/video_coding/codecs/av1/av1_svc_config.h"
|
||||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h"
|
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h"
|
||||||
|
|
||||||
@interface RTC_OBJC_TYPE (RTCVideoEncoderAV1Builder)
|
@interface RTC_OBJC_TYPE (RTCVideoEncoderAV1Builder)
|
||||||
@ -35,6 +39,17 @@
|
|||||||
return [[RTC_OBJC_TYPE(RTCVideoEncoderAV1Builder) alloc] init];
|
return [[RTC_OBJC_TYPE(RTCVideoEncoderAV1Builder) alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (NSArray<NSString*>*)supportedScalabilityModes {
|
||||||
|
// `LibaomAv1EncoderSupportedScalabilityModes` returns an std::vector-like container, but
|
||||||
|
// exact type might change, thus use `auto`.
|
||||||
|
auto modes = webrtc::LibaomAv1EncoderSupportedScalabilityModes();
|
||||||
|
NSMutableArray<NSString*>* result = [NSMutableArray arrayWithCapacity:std::size(modes)];
|
||||||
|
for (webrtc::ScalabilityMode mode : modes) {
|
||||||
|
[result addObject:[NSString stringForAbslStringView:webrtc::ScalabilityModeToString(mode)]];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
+ (bool)isSupported {
|
+ (bool)isSupported {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,11 @@ RTC_OBJC_EXPORT
|
|||||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
||||||
* used independently from the RTCPeerConnectionFactory.
|
* used independently from the RTCPeerConnectionFactory.
|
||||||
*/
|
*/
|
||||||
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)vp8Encoder;
|
+ (nonnull id<RTC_OBJC_TYPE(RTCVideoEncoder)>)vp8Encoder;
|
||||||
|
|
||||||
|
/* Returns list of scalability modes supported by the encoder that can be
|
||||||
|
* created with `vp8Encoder` method above.
|
||||||
|
*/
|
||||||
|
+ (nonnull NSArray<NSString*>*)supportedScalabilityModes;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -15,8 +15,11 @@
|
|||||||
#import "RTCNativeVideoEncoder.h"
|
#import "RTCNativeVideoEncoder.h"
|
||||||
#import "RTCNativeVideoEncoderBuilder+Native.h"
|
#import "RTCNativeVideoEncoderBuilder+Native.h"
|
||||||
#import "RTCVideoEncoderVP8.h"
|
#import "RTCVideoEncoderVP8.h"
|
||||||
|
#import "helpers/NSString+StdString.h"
|
||||||
|
|
||||||
|
#include "api/video_codecs/scalability_mode.h"
|
||||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||||
|
#include "modules/video_coding/codecs/vp8/vp8_scalability.h"
|
||||||
|
|
||||||
@interface RTC_OBJC_TYPE (RTCVideoEncoderVP8Builder)
|
@interface RTC_OBJC_TYPE (RTCVideoEncoderVP8Builder)
|
||||||
: RTC_OBJC_TYPE(RTCNativeVideoEncoder) <RTC_OBJC_TYPE (RTCNativeVideoEncoderBuilder)>
|
: RTC_OBJC_TYPE(RTCNativeVideoEncoder) <RTC_OBJC_TYPE (RTCNativeVideoEncoderBuilder)>
|
||||||
@ -36,4 +39,13 @@
|
|||||||
return [[RTC_OBJC_TYPE(RTCVideoEncoderVP8Builder) alloc] init];
|
return [[RTC_OBJC_TYPE(RTCVideoEncoderVP8Builder) alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (NSArray<NSString*>*)supportedScalabilityModes {
|
||||||
|
NSMutableArray<NSString*>* result =
|
||||||
|
[NSMutableArray arrayWithCapacity:std::size(webrtc::kVP8SupportedScalabilityModes)];
|
||||||
|
for (webrtc::ScalabilityMode mode : webrtc::kVP8SupportedScalabilityModes) {
|
||||||
|
[result addObject:[NSString stringForAbslStringView:webrtc::ScalabilityModeToString(mode)]];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -20,7 +20,12 @@ RTC_OBJC_EXPORT
|
|||||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
||||||
* used independently from the RTCPeerConnectionFactory.
|
* used independently from the RTCPeerConnectionFactory.
|
||||||
*/
|
*/
|
||||||
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)vp9Encoder;
|
+ (nullable id<RTC_OBJC_TYPE(RTCVideoEncoder)>)vp9Encoder;
|
||||||
|
|
||||||
|
/* Returns list of scalability modes supported by the encoder that can be
|
||||||
|
* created with `vp9Encoder` method above.
|
||||||
|
*/
|
||||||
|
+ (nonnull NSArray<NSString*>*)supportedScalabilityModes;
|
||||||
|
|
||||||
+ (bool)isSupported;
|
+ (bool)isSupported;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,9 @@
|
|||||||
#import "RTCNativeVideoEncoder.h"
|
#import "RTCNativeVideoEncoder.h"
|
||||||
#import "RTCNativeVideoEncoderBuilder+Native.h"
|
#import "RTCNativeVideoEncoderBuilder+Native.h"
|
||||||
#import "RTCVideoEncoderVP9.h"
|
#import "RTCVideoEncoderVP9.h"
|
||||||
|
#import "helpers/NSString+StdString.h"
|
||||||
|
|
||||||
|
#include "api/video_codecs/scalability_mode.h"
|
||||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||||
|
|
||||||
@interface RTC_OBJC_TYPE (RTCVideoEncoderVP9Builder)
|
@interface RTC_OBJC_TYPE (RTCVideoEncoderVP9Builder)
|
||||||
@ -40,6 +42,17 @@
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (NSArray<NSString*>*)supportedScalabilityModes {
|
||||||
|
NSMutableArray<NSString*>* result = [NSMutableArray array];
|
||||||
|
for (webrtc::ScalabilityMode mode : webrtc::kAllScalabilityModes) {
|
||||||
|
if (webrtc::VP9Encoder::SupportsScalabilityMode(mode)) {
|
||||||
|
[result
|
||||||
|
addObject:[NSString stringForAbslStringView:webrtc::ScalabilityModeToString(mode)]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
+ (bool)isSupported {
|
+ (bool)isSupported {
|
||||||
#if defined(RTC_ENABLE_VP9)
|
#if defined(RTC_ENABLE_VP9)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user