Migrate objc video decoder wrapper from InitDecode to Configure
Bug: webrtc:13045 Change-Id: Iff00489a91379298ac90cd48eb1aea109abd9906 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228945 Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34825}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
4c4c744818
commit
b74b2b5a99
@ -37,8 +37,9 @@ class ObjCVideoDecoder : public VideoDecoder {
|
||||
ObjCVideoDecoder(id<RTC_OBJC_TYPE(RTCVideoDecoder)> decoder)
|
||||
: decoder_(decoder), implementation_name_([decoder implementationName].stdString) {}
|
||||
|
||||
int32_t InitDecode(const VideoCodec *codec_settings, int32_t number_of_cores) override {
|
||||
return [decoder_ startDecodeWithNumberOfCores:number_of_cores];
|
||||
bool Configure(const Settings &settings) override {
|
||||
return
|
||||
[decoder_ startDecodeWithNumberOfCores:settings.number_of_cores()] == WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int32_t Decode(const EncodedImage &input_image,
|
||||
|
@ -55,18 +55,18 @@ std::unique_ptr<webrtc::VideoDecoder> GetObjCDecoder(
|
||||
|
||||
#pragma mark -
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, InitDecodeReturnsOKOnSuccess) {
|
||||
TEST(ObjCVideoDecoderFactoryTest, ConfigureReturnsTrueOnSuccess) {
|
||||
std::unique_ptr<webrtc::VideoDecoder> decoder = GetObjCDecoder(CreateOKDecoderFactory());
|
||||
|
||||
auto* settings = new webrtc::VideoCodec();
|
||||
EXPECT_EQ(decoder->InitDecode(settings, 1), WEBRTC_VIDEO_CODEC_OK);
|
||||
webrtc::VideoDecoder::Settings settings;
|
||||
EXPECT_TRUE(decoder->Configure(settings));
|
||||
}
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, InitDecodeReturnsErrorOnFail) {
|
||||
TEST(ObjCVideoDecoderFactoryTest, ConfigureReturnsFalseOnFail) {
|
||||
std::unique_ptr<webrtc::VideoDecoder> decoder = GetObjCDecoder(CreateErrorDecoderFactory());
|
||||
|
||||
auto* settings = new webrtc::VideoCodec();
|
||||
EXPECT_EQ(decoder->InitDecode(settings, 1), WEBRTC_VIDEO_CODEC_ERROR);
|
||||
webrtc::VideoDecoder::Settings settings;
|
||||
EXPECT_FALSE(decoder->Configure(settings));
|
||||
}
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, DecodeReturnsOKOnSuccess) {
|
||||
|
Reference in New Issue
Block a user