Use the factory instead of using the builtin code path in VideoCodecInitializer.

Bug: webrtc:9513
Change-Id: Ia299ae1044a3ff4c91e208200938cba540bdcea6
Reviewed-on: https://webrtc-review.googlesource.com/c/94782
Commit-Queue: Jiawei Ou <ouj@fb.com>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25456}
This commit is contained in:
Jiawei Ou
2018-10-10 01:16:20 -07:00
committed by Commit Bot
parent 838643550f
commit be142178aa
57 changed files with 389 additions and 137 deletions

View File

@ -12,6 +12,7 @@
#include <utility>
#include "api/call/callfactoryinterface.h"
#include "api/video/video_bitrate_allocator_factory.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "logging/rtc_event_log/rtc_event_log_factory_interface.h"
@ -36,12 +37,15 @@ cricket::MediaEngineInterface* CreateMediaEngine(
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
std::unique_ptr<VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processor) {
return cricket::WebRtcMediaEngineFactory::Create(
adm, audio_encoder_factory, audio_decoder_factory,
std::move(video_encoder_factory), std::move(video_decoder_factory),
audio_mixer, audio_processor)
std::move(video_bitrate_allocator_factory), audio_mixer,
audio_processor)
.release();
}

View File

@ -25,6 +25,7 @@ class AudioMixer;
class AudioProcessing;
class VideoEncoderFactory;
class VideoDecoderFactory;
class VideoBitrateAllocatorFactory;
} // namespace webrtc
namespace cricket {
@ -43,6 +44,8 @@ cricket::MediaEngineInterface* CreateMediaEngine(
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
std::unique_ptr<VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processor);

View File

@ -27,6 +27,8 @@ cricket::MediaEngineInterface* CreateMediaEngine(
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
std::unique_ptr<VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processor) {
return nullptr;

View File

@ -10,6 +10,7 @@
#include "sdk/android/src/jni/pc/video.h"
#include "api/video/video_bitrate_allocator_factory.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
@ -35,5 +36,10 @@ void* CreateVideoSource(JNIEnv* env,
return nullptr;
}
std::unique_ptr<VideoBitrateAllocatorFactory>
CreateVideoBitrateAllocatorFactory() {
return nullptr;
}
} // namespace jni
} // namespace webrtc

View File

@ -13,6 +13,7 @@
#include <memory>
#include <utility>
#include "api/video/video_bitrate_allocator_factory.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "media/base/mediaengine.h"
@ -259,13 +260,17 @@ jlong CreatePeerConnectionFactoryForJava(
std::unique_ptr<RtcEventLogFactoryInterface> rtc_event_log_factory(
CreateRtcEventLogFactory());
std::unique_ptr<VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory = CreateVideoBitrateAllocatorFactory();
std::unique_ptr<cricket::MediaEngineInterface> media_engine(CreateMediaEngine(
audio_device_module, audio_encoder_factory, audio_decoder_factory,
std::unique_ptr<VideoEncoderFactory>(
CreateVideoEncoderFactory(jni, jencoder_factory)),
std::unique_ptr<VideoDecoderFactory>(
CreateVideoDecoderFactory(jni, jdecoder_factory)),
audio_mixer, audio_processor));
std::move(video_bitrate_allocator_factory), audio_mixer,
audio_processor));
PeerConnectionFactoryDependencies dependencies;
dependencies.network_thread = network_thread.get();
dependencies.worker_thread = worker_thread.get();

View File

@ -13,6 +13,7 @@
#include <jni.h>
#include <memory>
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "api/videosourceproxy.h"
@ -52,5 +53,10 @@ void* CreateVideoSource(JNIEnv* env,
.release();
}
std::unique_ptr<VideoBitrateAllocatorFactory>
CreateVideoBitrateAllocatorFactory() {
return CreateBuiltinVideoBitrateAllocatorFactory();
}
} // namespace jni
} // namespace webrtc

View File

@ -13,6 +13,7 @@
#include <jni.h>
#include <memory>
#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/thread.h"
#include "sdk/android/native_api/jni/scoped_java_ref.h"
@ -20,6 +21,7 @@
namespace webrtc {
class VideoEncoderFactory;
class VideoDecoderFactory;
class VideoBitrateAllocatorFactory;
} // namespace webrtc
namespace webrtc {
@ -38,6 +40,9 @@ void* CreateVideoSource(JNIEnv* env,
rtc::Thread* worker_thread,
jboolean is_screencast);
std::unique_ptr<VideoBitrateAllocatorFactory>
CreateVideoBitrateAllocatorFactory();
} // namespace jni
} // namespace webrtc