Update internal video decoder factory to new interface

We want to move away from cricket::WebRtcVideoDecoderFactory and this CL
updates the internal factory. Also, VideoDecoderSoftwareFallbackWrapper
is updated to take a VideoDecoder as argument instead of a factory so it
can be used with external SW decoders.

Bug: webrtc:7925
Change-Id: Ie6dc6c24f8610a2129620c6e2b42e3cebb2ddef7
Reviewed-on: https://webrtc-review.googlesource.com/7301
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20597}
This commit is contained in:
Magnus Jedvert
2017-11-06 17:41:54 +01:00
committed by Commit Bot
parent 2416f894f5
commit b2fc9b1b10
8 changed files with 157 additions and 146 deletions

View File

@ -80,6 +80,23 @@ bool RunEncodeInRealTime(const TestConfig& config) {
#endif
}
// An internal decoder factory in the old WebRtcVideoDecoderFactory format.
// TODO(magjed): Update these tests to use new webrtc::VideoDecoderFactory
// instead.
class LegacyInternalDecoderFactory : public cricket::WebRtcVideoDecoderFactory {
public:
// WebRtcVideoDecoderFactory implementation.
VideoDecoder* CreateVideoDecoderWithParams(
const cricket::VideoCodec& codec,
cricket::VideoDecoderParams params) override {
return InternalDecoderFactory()
.CreateVideoDecoder(SdpVideoFormat(codec.name, codec.params))
.release();
}
void DestroyVideoDecoder(VideoDecoder* decoder) override { delete decoder; }
};
} // namespace
void VideoProcessorIntegrationTest::H264KeyframeChecker::CheckEncodedFrame(
@ -311,7 +328,7 @@ void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() {
RTC_NOTREACHED() << "Only support HW decoder on Android and iOS.";
#endif
} else {
decoder_factory.reset(new cricket::InternalDecoderFactory());
decoder_factory.reset(new LegacyInternalDecoderFactory());
}
cricket::VideoCodec codec;
@ -369,7 +386,9 @@ void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() {
}
if (config_.sw_fallback_decoder) {
decoder_ = rtc::MakeUnique<VideoDecoderSoftwareFallbackWrapper>(
config_.codec_settings.codecType, std::move(decoder_));
InternalDecoderFactory().CreateVideoDecoder(
SdpVideoFormat(codec.name, codec.params)),
std::move(decoder_));
}
EXPECT_TRUE(encoder_) << "Encoder not successfully created.";