Let CreateVideoDecoder take a cricket::VideoCodec.

This makes it possible for decoder factories to actually provide any
video codec, not just the ones WebRTC knows about. It also brings
the decoder factory interface more in line with that of the encoder
factory.

BUG=webrtc:8140

Review-Url: https://codereview.webrtc.org/3007433002
Cr-Commit-Position: refs/heads/master@{#19654}
This commit is contained in:
kthelgason
2017-09-04 04:36:21 -07:00
committed by Commit Bot
parent 3c39c0137a
commit ebd4f7988e
6 changed files with 30 additions and 10 deletions

View File

@ -25,8 +25,10 @@ class ObjCVideoDecoderFactory : public cricket::WebRtcVideoDecoderFactory {
id<RTCVideoDecoderFactory> wrapped_decoder_factory() const;
webrtc::VideoDecoder* CreateVideoDecoder(
webrtc::VideoCodecType type) override;
VideoDecoder* CreateVideoDecoderWithParams(
const cricket::VideoCodec& codec,
cricket::VideoDecoderParams params) override;
void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) override;
private:

View File

@ -103,10 +103,9 @@ id<RTCVideoDecoderFactory> ObjCVideoDecoderFactory::wrapped_decoder_factory() co
return decoder_factory_;
}
VideoDecoder *ObjCVideoDecoderFactory::CreateVideoDecoder(VideoCodecType type) {
const char *codec_name = CodecTypeToPayloadString(type);
NSString *codecName = [NSString stringWithUTF8String:codec_name];
VideoDecoder *ObjCVideoDecoderFactory::CreateVideoDecoderWithParams(
const cricket::VideoCodec &codec, cricket::VideoDecoderParams params) {
NSString *codecName = [NSString stringWithUTF8String:codec.name.c_str()];
for (RTCVideoCodecInfo *codecInfo in decoder_factory_.supportedCodecs) {
if ([codecName isEqualToString:codecInfo.name]) {
id<RTCVideoDecoder> decoder = [decoder_factory_ createDecoder:codecInfo];