Fix build errors when rtc_use_builtin_sw_codecs is set to false.

The previous effort of building WebRTC without SW codecs stopped when
libjingle_peerconnection was possible to build. In order to make the
group("default") target build, this basically updates a bunch of
tests to explicitly depend on the built-in software video codecs.

Bug: webrtc:7925
Change-Id: I2715414770c197fca01cb8dbde173a21f4434500
Reviewed-on: https://webrtc-review.googlesource.com/70503
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23216}
This commit is contained in:
Anders Carlsson
2018-05-14 10:11:42 +02:00
committed by Commit Bot
parent f55babc298
commit b330688ef7
11 changed files with 47 additions and 37 deletions

View File

@ -1435,6 +1435,8 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
// Create a new instance of PeerConnectionFactoryInterface with optional video
// codec factories. These video factories represents all video codecs, i.e. no
// extra internal video codecs will be added.
// When building WebRTC with rtc_use_builtin_sw_codecs = false, this is the
// only available CreatePeerConnectionFactory overload.
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,

View File

@ -12,11 +12,9 @@
#include "api/video_codecs/sdp_video_format.h"
#include "media/base/mediaconstants.h"
#if defined(USE_BUILTIN_SW_CODECS)
#include "modules/video_coding/codecs/h264/include/h264.h"
#include "modules/video_coding/codecs/vp8/include/vp8.h" // nogncheck
#include "modules/video_coding/codecs/vp9/include/vp9.h" // nogncheck
#endif
#include "modules/video_coding/codecs/vp8/include/vp8.h"
#include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
@ -25,19 +23,16 @@ namespace webrtc {
std::vector<SdpVideoFormat> InternalDecoderFactory::GetSupportedFormats()
const {
std::vector<SdpVideoFormat> formats;
#if defined(USE_BUILTIN_SW_CODECS)
formats.push_back(SdpVideoFormat(cricket::kVp8CodecName));
if (VP9Decoder::IsSupported())
formats.push_back(SdpVideoFormat(cricket::kVp9CodecName));
for (const SdpVideoFormat& h264_format : SupportedH264Codecs())
formats.push_back(h264_format);
#endif
return formats;
}
std::unique_ptr<VideoDecoder> InternalDecoderFactory::CreateVideoDecoder(
const SdpVideoFormat& format) {
#if defined(USE_BUILTIN_SW_CODECS)
if (cricket::CodecNamesEq(format.name, cricket::kVp8CodecName))
return VP8Decoder::Create();
@ -48,7 +43,6 @@ std::unique_ptr<VideoDecoder> InternalDecoderFactory::CreateVideoDecoder(
if (cricket::CodecNamesEq(format.name, cricket::kH264CodecName))
return H264Decoder::Create();
#endif
RTC_LOG(LS_ERROR) << "Trying to create decoder for unsupported format";
return nullptr;

View File

@ -13,11 +13,9 @@
#include <utility>
#include "api/video_codecs/sdp_video_format.h"
#if defined(USE_BUILTIN_SW_CODECS)
#include "modules/video_coding/codecs/h264/include/h264.h"
#include "modules/video_coding/codecs/vp8/include/vp8.h" // nogncheck
#include "modules/video_coding/codecs/vp9/include/vp9.h" // nogncheck
#endif
#include "modules/video_coding/codecs/vp8/include/vp8.h"
#include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "rtc_base/logging.h"
namespace webrtc {
@ -25,14 +23,12 @@ namespace webrtc {
std::vector<SdpVideoFormat> InternalEncoderFactory::GetSupportedFormats()
const {
std::vector<SdpVideoFormat> supported_codecs;
#if defined(USE_BUILTIN_SW_CODECS)
supported_codecs.push_back(SdpVideoFormat(cricket::kVp8CodecName));
if (webrtc::VP9Encoder::IsSupported())
supported_codecs.push_back(SdpVideoFormat(cricket::kVp9CodecName));
for (const webrtc::SdpVideoFormat& format : webrtc::SupportedH264Codecs())
supported_codecs.push_back(format);
#endif
return supported_codecs;
}
@ -47,7 +43,6 @@ VideoEncoderFactory::CodecInfo InternalEncoderFactory::QueryVideoEncoder(
std::unique_ptr<VideoEncoder> InternalEncoderFactory::CreateVideoEncoder(
const SdpVideoFormat& format) {
#if defined(USE_BUILTIN_SW_CODECS)
if (cricket::CodecNamesEq(format.name, cricket::kVp8CodecName))
return VP8Encoder::Create();
@ -56,7 +51,6 @@ std::unique_ptr<VideoEncoder> InternalEncoderFactory::CreateVideoEncoder(
if (cricket::CodecNamesEq(format.name, cricket::kH264CodecName))
return H264Encoder::Create(cricket::VideoCodec(format));
#endif
RTC_LOG(LS_ERROR) << "Trying to created encoder of unsupported format "
<< format.name;

View File

@ -12,7 +12,10 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "media/engine/webrtcmediaengine.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "test/gtest.h"
using webrtc::RtpExtension;
@ -238,8 +241,11 @@ TEST(WebRtcMediaEngineTest, FilterRtpExtensions_RemoveRedundantBwe_3) {
TEST(WebRtcMediaEngineFactoryTest, CreateWithBuiltinDecoders) {
std::unique_ptr<MediaEngineInterface> engine(WebRtcMediaEngineFactory::Create(
nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
webrtc::CreateBuiltinAudioDecoderFactory(), nullptr, nullptr));
nullptr /* adm */, webrtc::CreateBuiltinAudioEncoderFactory(),
webrtc::CreateBuiltinAudioDecoderFactory(),
webrtc::CreateBuiltinVideoEncoderFactory(),
webrtc::CreateBuiltinVideoDecoderFactory(), nullptr /* audio_mixer */,
webrtc::AudioProcessingBuilder().Create()));
EXPECT_TRUE(engine);
}

View File

@ -739,6 +739,7 @@ if (rtc_include_tests) {
"../../api/video_codecs:video_codecs_api",
"../../common_video",
"../../media:rtc_h264_profile_id",
"../../media:rtc_internal_video_codecs",
"../../media:rtc_media_base",
"../../rtc_base:rtc_base",
"../../test:fileutils",
@ -822,6 +823,7 @@ if (rtc_include_tests) {
if (rtc_use_h264) {
sources += [ "codecs/h264/h264_encoder_impl_unittest.cc" ]
}
deps = [
":codec_globals_headers",
":encoded_frame",

View File

@ -36,6 +36,8 @@ rtc_static_library("ortc") {
"../api:libjingle_peerconnection_api",
"../api:optional",
"../api:ortc_api",
"../api/video_codecs:builtin_video_decoder_factory",
"../api/video_codecs:builtin_video_encoder_factory",
"../call:call_interfaces",
"../call:rtp_sender",
"../logging:rtc_event_log_api",

View File

@ -17,6 +17,8 @@
#include "api/mediastreamtrackproxy.h"
#include "api/proxy.h"
#include "api/rtcerror.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "api/videosourceproxy.h"
#include "logging/rtc_event_log/rtc_event_log.h"
#include "media/base/mediaconstants.h"
@ -551,8 +553,11 @@ OrtcFactory::CreateMediaEngine_w() {
// AudioDeviceModule will be used.
return std::unique_ptr<cricket::MediaEngineInterface>(
cricket::WebRtcMediaEngineFactory::Create(
adm_, audio_encoder_factory_, audio_decoder_factory_, nullptr,
nullptr, nullptr, webrtc::AudioProcessingBuilder().Create()));
rtc::scoped_refptr<webrtc::AudioDeviceModule>(adm_),
audio_encoder_factory_, audio_decoder_factory_,
webrtc::CreateBuiltinVideoEncoderFactory(),
webrtc::CreateBuiltinVideoDecoderFactory(), nullptr,
webrtc::AudioProcessingBuilder().Create()));
}
} // namespace webrtc

View File

@ -67,7 +67,6 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
network_thread, worker_thread, signaling_thread, std::move(media_engine),
std::move(call_factory), std::move(event_log_factory));
}
#endif
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
@ -102,6 +101,7 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
std::move(call_factory), std::move(event_log_factory),
std::move(fec_controller_factory));
}
#endif
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,

View File

@ -10,6 +10,8 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "media/engine/webrtcmediaengine.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "pc/mediasession.h"
@ -44,20 +46,20 @@ using ::testing::UnorderedElementsAre;
class PeerConnectionFactoryForJsepTest : public PeerConnectionFactory {
public:
PeerConnectionFactoryForJsepTest()
: PeerConnectionFactory(
rtc::Thread::Current(),
rtc::Thread::Current(),
rtc::Thread::Current(),
rtc::WrapUnique(cricket::WebRtcMediaEngineFactory::Create(
FakeAudioCaptureModule::Create(),
CreateBuiltinAudioEncoderFactory(),
CreateBuiltinAudioDecoderFactory(),
nullptr,
nullptr,
nullptr,
AudioProcessingBuilder().Create())),
CreateCallFactory(),
nullptr) {}
: PeerConnectionFactory(rtc::Thread::Current(),
rtc::Thread::Current(),
rtc::Thread::Current(),
cricket::WebRtcMediaEngineFactory::Create(
rtc::scoped_refptr<AudioDeviceModule>(
FakeAudioCaptureModule::Create()),
CreateBuiltinAudioEncoderFactory(),
CreateBuiltinAudioDecoderFactory(),
CreateBuiltinVideoEncoderFactory(),
CreateBuiltinVideoDecoderFactory(),
nullptr,
AudioProcessingBuilder().Create()),
CreateCallFactory(),
nullptr) {}
std::unique_ptr<cricket::SctpTransportInternalFactory>
CreateSctpTransportInternalFactory() {

View File

@ -634,13 +634,16 @@ class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory {
CreatePeerConnectionFactoryForTest() {
auto audio_encoder_factory = webrtc::CreateBuiltinAudioEncoderFactory();
auto audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory();
auto video_encoder_factory = webrtc::CreateBuiltinVideoEncoderFactory();
auto video_decoder_factory = webrtc::CreateBuiltinVideoDecoderFactory();
// Use fake audio device module since we're only testing the interface
// level, and using a real one could make tests flaky when run in parallel.
auto media_engine = std::unique_ptr<cricket::MediaEngineInterface>(
cricket::WebRtcMediaEngineFactory::Create(
FakeAudioCaptureModule::Create(), audio_encoder_factory,
audio_decoder_factory, nullptr, nullptr, nullptr,
audio_decoder_factory, std::move(video_encoder_factory),
std::move(video_decoder_factory), nullptr,
webrtc::AudioProcessingBuilder().Create()));
std::unique_ptr<webrtc::CallFactoryInterface> call_factory =

View File

@ -580,7 +580,7 @@ rtc_source_set("test_common") {
"../modules/video_coding:video_coding_utility",
"../modules/video_coding:webrtc_h264",
"../modules/video_coding:webrtc_multiplex",
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp8_helpers",
"../modules/video_coding:webrtc_vp9",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",