ObjC: Add implementationName for injectable codecs
BUG=webrtc:7924 Review-Url: https://codereview.webrtc.org/2987253003 Cr-Commit-Position: refs/heads/master@{#19213}
This commit is contained in:
parent
c5fb4683e5
commit
5805c9dbda
@ -181,6 +181,10 @@ class H264VideoToolboxDecodeCompleteCallback : public webrtc::DecodedImageCallba
|
||||
high:kHighH264QpThreshold];
|
||||
}
|
||||
|
||||
- (NSString *)implementationName {
|
||||
return @"VideoToolbox";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// Decoder.
|
||||
@ -247,6 +251,10 @@ class H264VideoToolboxDecodeCompleteCallback : public webrtc::DecodedImageCallba
|
||||
image, missingFrames, header.release(), &codecSpecificInfo, renderTimeMs);
|
||||
}
|
||||
|
||||
- (NSString *)implementationName {
|
||||
return @"VideoToolbox";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// Encoder factory.
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include "webrtc/sdk/objc/Framework/Classes/VideoToolbox/objc_video_decoder_factory.h"
|
||||
|
||||
#import "NSString+StdString.h"
|
||||
#import "RTCVideoCodec+Private.h"
|
||||
#import "WebRTC/RTCVideoCodec.h"
|
||||
#import "WebRTC/RTCVideoCodecFactory.h"
|
||||
@ -30,7 +31,8 @@ namespace webrtc {
|
||||
namespace {
|
||||
class ObjCVideoDecoder : public VideoDecoder {
|
||||
public:
|
||||
ObjCVideoDecoder(id<RTCVideoDecoder> decoder) : decoder_(decoder) {}
|
||||
ObjCVideoDecoder(id<RTCVideoDecoder> decoder)
|
||||
: decoder_(decoder), implementation_name_([decoder implementationName].stdString) {}
|
||||
~ObjCVideoDecoder() { [decoder_ destroy]; }
|
||||
|
||||
int32_t InitDecode(const VideoCodec *codec_settings, int32_t number_of_cores) {
|
||||
@ -85,8 +87,11 @@ class ObjCVideoDecoder : public VideoDecoder {
|
||||
|
||||
int32_t Release() { return [decoder_ releaseDecoder]; }
|
||||
|
||||
const char *ImplementationName() const { return implementation_name_.c_str(); }
|
||||
|
||||
private:
|
||||
id<RTCVideoDecoder> decoder_;
|
||||
const std::string implementation_name_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -10,6 +10,9 @@
|
||||
|
||||
#include "webrtc/sdk/objc/Framework/Classes/VideoToolbox/objc_video_encoder_factory.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#import "NSString+StdString.h"
|
||||
#import "RTCVideoCodec+Private.h"
|
||||
#import "WebRTC/RTCVideoCodec.h"
|
||||
#import "WebRTC/RTCVideoCodecFactory.h"
|
||||
@ -32,7 +35,8 @@ namespace webrtc {
|
||||
namespace {
|
||||
class ObjCVideoEncoder : public VideoEncoder {
|
||||
public:
|
||||
ObjCVideoEncoder(id<RTCVideoEncoder> encoder) : encoder_(encoder) {}
|
||||
ObjCVideoEncoder(id<RTCVideoEncoder> encoder)
|
||||
: encoder_(encoder), implementation_name_([encoder implementationName].stdString) {}
|
||||
~ObjCVideoEncoder() { [encoder_ destroy]; }
|
||||
|
||||
int32_t InitEncode(const VideoCodec *codec_settings,
|
||||
@ -118,8 +122,11 @@ class ObjCVideoEncoder : public VideoEncoder {
|
||||
ScalingSettings(false /* enabled */);
|
||||
}
|
||||
|
||||
const char *ImplementationName() const { return implementation_name_.c_str(); }
|
||||
|
||||
private:
|
||||
id<RTCVideoEncoder> encoder_;
|
||||
const std::string implementation_name_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -128,14 +128,13 @@ RTC_EXPORT
|
||||
codecSpecificInfo:(id<RTCCodecSpecificInfo>)info
|
||||
frameTypes:(NSArray<NSNumber *> *)frameTypes;
|
||||
- (BOOL)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate;
|
||||
- (NSString *)implementationName;
|
||||
|
||||
/** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to
|
||||
* keep the QP from the encoded images within the given range. Returning nil from this function
|
||||
* disables quality scaling. */
|
||||
- (RTCVideoEncoderQpThresholds *)scalingSettings;
|
||||
|
||||
// TODO(andersc): Add implementationName method.
|
||||
|
||||
@end
|
||||
|
||||
/** Protocol for decoder implementations. */
|
||||
@ -152,8 +151,7 @@ RTC_EXPORT
|
||||
fragmentationHeader:(RTCRtpFragmentationHeader *)fragmentationHeader
|
||||
codecSpecificInfo:(__nullable id<RTCCodecSpecificInfo>)info
|
||||
renderTimeMs:(int64_t)renderTimeMs;
|
||||
|
||||
// TODO(andersc): Add implementationName method.
|
||||
- (NSString *)implementationName;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user