Add ObjC interface wrapping new GetImplementations method.

Bug: webrtc:10795
Change-Id: I32a4bcb9bd51155b6bc82a161765b5cda9539100
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150100
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28947}
This commit is contained in:
Kári Tristan Helgason
2019-08-23 13:02:05 +02:00
committed by Commit Bot
parent b6b4deee49
commit 6e706ede5f
4 changed files with 31 additions and 1 deletions

View File

@ -27,6 +27,7 @@ class ObjCVideoEncoderFactory : public VideoEncoderFactory {
id<RTCVideoEncoderFactory> wrapped_encoder_factory() const;
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
std::vector<SdpVideoFormat> GetImplementations() const override;
std::unique_ptr<VideoEncoder> CreateVideoEncoder(
const SdpVideoFormat& format) override;
CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const override;

View File

@ -121,7 +121,7 @@ id<RTCVideoEncoderFactory> ObjCVideoEncoderFactory::wrapped_encoder_factory() co
std::vector<SdpVideoFormat> ObjCVideoEncoderFactory::GetSupportedFormats() const {
std::vector<SdpVideoFormat> supported_formats;
for (RTCVideoCodecInfo *supportedCodec in encoder_factory_.supportedCodecs) {
for (RTCVideoCodecInfo *supportedCodec in [encoder_factory_ supportedCodecs]) {
SdpVideoFormat format = [supportedCodec nativeSdpVideoFormat];
supported_formats.push_back(format);
}
@ -129,6 +129,18 @@ std::vector<SdpVideoFormat> ObjCVideoEncoderFactory::GetSupportedFormats() const
return supported_formats;
}
std::vector<SdpVideoFormat> ObjCVideoEncoderFactory::GetImplementations() const {
if ([encoder_factory_ respondsToSelector:SEL("implementations")]) {
std::vector<SdpVideoFormat> supported_formats;
for (RTCVideoCodecInfo *supportedCodec in [encoder_factory_ implementations]) {
SdpVideoFormat format = [supportedCodec nativeSdpVideoFormat];
supported_formats.push_back(format);
}
return supported_formats;
}
return GetSupportedFormats();
}
VideoEncoderFactory::CodecInfo ObjCVideoEncoderFactory::QueryVideoEncoder(
const SdpVideoFormat &format) const {
// TODO(andersc): This is a hack until we figure out how this should be done properly.