Update internal encoder factory to new interface

TBR=stefan@webrtc.org

Bug: webrtc:7925
Change-Id: I0bb97acdf0d58a9ce531ecdd672bb17ef96360df
Reviewed-on: https://webrtc-review.googlesource.com/21162
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20717}
This commit is contained in:
Magnus Jedvert
2017-11-16 16:56:39 +01:00
committed by Commit Bot
parent 1e1dd77604
commit 2c8c8e26fc
14 changed files with 283 additions and 206 deletions

View File

@ -80,6 +80,40 @@ bool RunEncodeInRealTime(const TestConfig& config) {
#endif
}
// An internal encoder factory in the old WebRtcVideoEncoderFactory format.
// TODO(magjed): Update these tests to use new webrtc::VideoEncoderFactory
// instead.
class LegacyInternalEncoderFactory : public cricket::WebRtcVideoEncoderFactory {
public:
LegacyInternalEncoderFactory() {
for (const SdpVideoFormat& format :
InternalEncoderFactory().GetSupportedFormats()) {
supported_codecs_.push_back(cricket::VideoCodec(format));
}
}
// WebRtcVideoEncoderFactory implementation.
VideoEncoder* CreateVideoEncoder(const cricket::VideoCodec& codec) override {
return InternalEncoderFactory()
.CreateVideoEncoder(SdpVideoFormat(codec.name, codec.params))
.release();
}
const std::vector<cricket::VideoCodec>& supported_codecs() const override {
return supported_codecs_;
}
bool EncoderTypeHasInternalSource(
webrtc::VideoCodecType type) const override {
return false;
}
void DestroyVideoEncoder(VideoEncoder* encoder) override { delete encoder; }
private:
std::vector<cricket::VideoCodec> supported_codecs_;
};
// An internal decoder factory in the old WebRtcVideoDecoderFactory format.
// TODO(magjed): Update these tests to use new webrtc::VideoDecoderFactory
// instead.
@ -313,7 +347,7 @@ void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() {
RTC_NOTREACHED() << "Only support HW encoder on Android and iOS.";
#endif
} else {
encoder_factory.reset(new cricket::InternalEncoderFactory());
encoder_factory.reset(new LegacyInternalEncoderFactory());
}
std::unique_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory;
@ -382,8 +416,8 @@ void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() {
if (config_.sw_fallback_encoder) {
encoder_ = rtc::MakeUnique<VideoEncoderSoftwareFallbackWrapper>(
std::unique_ptr<VideoEncoder>(
cricket::InternalEncoderFactory().CreateVideoEncoder(codec)),
InternalEncoderFactory().CreateVideoEncoder(
SdpVideoFormat(codec.name, codec.params)),
std::move(encoder_));
}
if (config_.sw_fallback_decoder) {