Pass MediaTransportFactory to PeerConnectionFactory.
And use RTCConfiguration to enable/disable it on a per connection basis. With the advent of MediaTransportInterface, we need to be able to enable it on the per PeerConnection basis. At this point PeerConnection will not take any action when the MediaTransportInterface is set; this code will land a bit later, and will be accompanied by the tests that verify correct setup (hence no tests right now). At this point this is just a method stub to enable further development. Bug: webrtc:9719 Change-Id: I1f77d650cb03bf1191aa0b35669cd32f1b68446f Reviewed-on: https://webrtc-review.googlesource.com/c/103860 Reviewed-by: Bjorn Mellem <mellem@webrtc.org> Reviewed-by: Anton Sukhanov <sukhanov@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25053}
This commit is contained in:
parent
1e05486914
commit
e0c2e97474
@ -19,6 +19,8 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
MediaTransportEncodedAudioFrame::~MediaTransportEncodedAudioFrame() {}
|
||||
|
||||
MediaTransportEncodedAudioFrame::MediaTransportEncodedAudioFrame(
|
||||
int sampling_rate_hz,
|
||||
int starting_sample_index,
|
||||
@ -35,7 +37,19 @@ MediaTransportEncodedAudioFrame::MediaTransportEncodedAudioFrame(
|
||||
payload_type_(payload_type),
|
||||
encoded_data_(std::move(encoded_data)) {}
|
||||
|
||||
MediaTransportEncodedAudioFrame::~MediaTransportEncodedAudioFrame() = default;
|
||||
MediaTransportEncodedAudioFrame& MediaTransportEncodedAudioFrame::operator=(
|
||||
const MediaTransportEncodedAudioFrame&) = default;
|
||||
|
||||
MediaTransportEncodedAudioFrame& MediaTransportEncodedAudioFrame::operator=(
|
||||
MediaTransportEncodedAudioFrame&&) = default;
|
||||
|
||||
MediaTransportEncodedAudioFrame::MediaTransportEncodedAudioFrame(
|
||||
const MediaTransportEncodedAudioFrame&) = default;
|
||||
|
||||
MediaTransportEncodedAudioFrame::MediaTransportEncodedAudioFrame(
|
||||
MediaTransportEncodedAudioFrame&&) = default;
|
||||
|
||||
MediaTransportEncodedVideoFrame::~MediaTransportEncodedVideoFrame() {}
|
||||
|
||||
MediaTransportEncodedVideoFrame::MediaTransportEncodedVideoFrame(
|
||||
int64_t frame_id,
|
||||
@ -47,6 +61,16 @@ MediaTransportEncodedVideoFrame::MediaTransportEncodedVideoFrame(
|
||||
frame_id_(frame_id),
|
||||
referenced_frame_ids_(std::move(referenced_frame_ids)) {}
|
||||
|
||||
MediaTransportEncodedVideoFrame::~MediaTransportEncodedVideoFrame() = default;
|
||||
MediaTransportEncodedVideoFrame& MediaTransportEncodedVideoFrame::operator=(
|
||||
const MediaTransportEncodedVideoFrame&) = default;
|
||||
|
||||
MediaTransportEncodedVideoFrame& MediaTransportEncodedVideoFrame::operator=(
|
||||
MediaTransportEncodedVideoFrame&&) = default;
|
||||
|
||||
MediaTransportEncodedVideoFrame::MediaTransportEncodedVideoFrame(
|
||||
const MediaTransportEncodedVideoFrame&) = default;
|
||||
|
||||
MediaTransportEncodedVideoFrame::MediaTransportEncodedVideoFrame(
|
||||
MediaTransportEncodedVideoFrame&&) = default;
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
/*
|
||||
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||
/* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -35,7 +34,7 @@ namespace webrtc {
|
||||
|
||||
// Represents encoded audio frame in any encoding (type of encoding is opaque).
|
||||
// To avoid copying of encoded data use move semantics when passing by value.
|
||||
class MediaTransportEncodedAudioFrame {
|
||||
class MediaTransportEncodedAudioFrame final {
|
||||
public:
|
||||
enum class FrameType {
|
||||
// Normal audio frame (equivalent to webrtc::kAudioFrameSpeech).
|
||||
@ -79,6 +78,12 @@ class MediaTransportEncodedAudioFrame {
|
||||
std::vector<uint8_t> encoded_data);
|
||||
|
||||
~MediaTransportEncodedAudioFrame();
|
||||
MediaTransportEncodedAudioFrame(const MediaTransportEncodedAudioFrame&);
|
||||
MediaTransportEncodedAudioFrame& operator=(
|
||||
const MediaTransportEncodedAudioFrame& other);
|
||||
MediaTransportEncodedAudioFrame& operator=(
|
||||
MediaTransportEncodedAudioFrame&& other);
|
||||
MediaTransportEncodedAudioFrame(MediaTransportEncodedAudioFrame&&);
|
||||
|
||||
// Getters.
|
||||
int sampling_rate_hz() const { return sampling_rate_hz_; }
|
||||
@ -121,13 +126,19 @@ class MediaTransportAudioSinkInterface {
|
||||
};
|
||||
|
||||
// Represents encoded video frame, along with the codec information.
|
||||
class MediaTransportEncodedVideoFrame {
|
||||
class MediaTransportEncodedVideoFrame final {
|
||||
public:
|
||||
MediaTransportEncodedVideoFrame(int64_t frame_id,
|
||||
std::vector<int64_t> referenced_frame_ids,
|
||||
VideoCodecType codec_type,
|
||||
const webrtc::EncodedImage& encoded_image);
|
||||
~MediaTransportEncodedVideoFrame();
|
||||
MediaTransportEncodedVideoFrame(const MediaTransportEncodedVideoFrame&);
|
||||
MediaTransportEncodedVideoFrame& operator=(
|
||||
const MediaTransportEncodedVideoFrame& other);
|
||||
MediaTransportEncodedVideoFrame& operator=(
|
||||
MediaTransportEncodedVideoFrame&& other);
|
||||
MediaTransportEncodedVideoFrame(MediaTransportEncodedVideoFrame&&);
|
||||
|
||||
VideoCodecType codec_type() const { return codec_type_; }
|
||||
const webrtc::EncodedImage& encoded_image() const { return encoded_image_; }
|
||||
|
||||
@ -80,6 +80,7 @@
|
||||
#include "api/datachannelinterface.h"
|
||||
#include "api/fec_controller.h"
|
||||
#include "api/jsep.h"
|
||||
#include "api/media_transport_interface.h"
|
||||
#include "api/mediastreaminterface.h"
|
||||
#include "api/rtcerror.h"
|
||||
#include "api/rtceventlogoutput.h"
|
||||
@ -560,6 +561,12 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||
// correctly. This flag will be deprecated soon. Do not rely on it.
|
||||
bool active_reset_srtp_params = false;
|
||||
|
||||
// If MediaTransportFactory is provided in PeerConnectionFactory, this flag
|
||||
// informs PeerConnection that it should use the MediaTransportInterface.
|
||||
// It's invalid to set it to |true| if the MediaTransportFactory wasn't
|
||||
// provided.
|
||||
bool use_media_transport = false;
|
||||
|
||||
//
|
||||
// Don't forget to update operator== if adding something.
|
||||
//
|
||||
@ -1153,6 +1160,7 @@ struct PeerConnectionFactoryDependencies final {
|
||||
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory;
|
||||
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory;
|
||||
std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory;
|
||||
std::unique_ptr<MediaTransportFactory> media_transport_factory;
|
||||
};
|
||||
|
||||
// PeerConnectionFactoryInterface is the factory interface used for creating
|
||||
|
||||
@ -129,10 +129,14 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
|
||||
|
||||
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory =
|
||||
CreateRtcEventLogFactory();
|
||||
|
||||
return CreateModularPeerConnectionFactory(
|
||||
network_thread, worker_thread, signaling_thread, std::move(media_engine),
|
||||
std::move(call_factory), std::move(event_log_factory));
|
||||
PeerConnectionFactoryDependencies dependencies;
|
||||
dependencies.network_thread = network_thread;
|
||||
dependencies.worker_thread = worker_thread;
|
||||
dependencies.signaling_thread = signaling_thread;
|
||||
dependencies.media_engine = std::move(media_engine);
|
||||
dependencies.call_factory = std::move(call_factory);
|
||||
dependencies.event_log_factory = std::move(event_log_factory);
|
||||
return CreateModularPeerConnectionFactory(std::move(dependencies));
|
||||
}
|
||||
|
||||
#if defined(USE_BUILTIN_SW_CODECS)
|
||||
|
||||
@ -705,6 +705,7 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
|
||||
SdpSemantics sdp_semantics;
|
||||
absl::optional<rtc::AdapterType> network_preference;
|
||||
bool active_reset_srtp_params;
|
||||
bool use_media_transport;
|
||||
};
|
||||
static_assert(sizeof(stuff_being_tested_for_equality) == sizeof(*this),
|
||||
"Did you add something to RTCConfiguration and forget to "
|
||||
@ -752,7 +753,8 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
|
||||
turn_customizer == o.turn_customizer &&
|
||||
sdp_semantics == o.sdp_semantics &&
|
||||
network_preference == o.network_preference &&
|
||||
active_reset_srtp_params == o.active_reset_srtp_params;
|
||||
active_reset_srtp_params == o.active_reset_srtp_params &&
|
||||
use_media_transport == o.use_media_transport;
|
||||
}
|
||||
|
||||
bool PeerConnectionInterface::RTCConfiguration::operator!=(
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/media_transport_interface.h"
|
||||
#include "api/peerconnectioninterface.h"
|
||||
#include "api/turncustomizer.h"
|
||||
#include "pc/iceserverparsing.h"
|
||||
@ -1026,6 +1027,10 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
// List of content names for which the remote side triggered an ICE restart.
|
||||
std::set<std::string> pending_ice_restarts_;
|
||||
|
||||
// Optional media transport for sending / receiving encoded frames.
|
||||
// If available, media transport will be used instead of RTP / SRTP.
|
||||
std::unique_ptr<MediaTransportFactory> media_transport_factory_;
|
||||
|
||||
std::unique_ptr<WebRtcSessionDescriptionFactory> webrtc_session_desc_factory_;
|
||||
|
||||
// Member variables for caching global options.
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/fec_controller.h"
|
||||
#include "api/media_transport_interface.h"
|
||||
#include "api/mediaconstraintsinterface.h"
|
||||
#include "api/mediastreamproxy.h"
|
||||
#include "api/mediastreamtrackproxy.h"
|
||||
@ -187,7 +188,9 @@ PeerConnectionFactory::PeerConnectionFactory(
|
||||
std::move(dependencies.call_factory),
|
||||
std::move(dependencies.event_log_factory),
|
||||
std::move(dependencies.fec_controller_factory),
|
||||
std::move(dependencies.network_controller_factory)) {}
|
||||
std::move(dependencies.network_controller_factory)) {
|
||||
media_transport_factory_ = std::move(dependencies.media_transport_factory);
|
||||
}
|
||||
|
||||
PeerConnectionFactory::~PeerConnectionFactory() {
|
||||
RTC_DCHECK(signaling_thread_->IsCurrent());
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "api/media_transport_interface.h"
|
||||
#include "api/mediastreaminterface.h"
|
||||
#include "api/peerconnectioninterface.h"
|
||||
#include "media/sctp/sctptransportinternal.h"
|
||||
@ -96,6 +97,10 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
|
||||
virtual rtc::Thread* network_thread();
|
||||
const Options& options() const { return options_; }
|
||||
|
||||
MediaTransportFactory* media_transport_factory() {
|
||||
return media_transport_factory_.get();
|
||||
}
|
||||
|
||||
protected:
|
||||
PeerConnectionFactory(
|
||||
rtc::Thread* network_thread,
|
||||
@ -148,6 +153,7 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
|
||||
injected_network_controller_factory_;
|
||||
std::unique_ptr<NetworkControllerFactoryInterface>
|
||||
bbr_network_controller_factory_;
|
||||
std::unique_ptr<MediaTransportFactory> media_transport_factory_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -1170,6 +1170,7 @@ if (is_ios || is_mac) {
|
||||
":videoframebuffer_objc",
|
||||
":videosource_objc",
|
||||
":videotoolbox_objc",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api/audio_codecs:audio_codecs_api",
|
||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||
|
||||
@ -168,6 +168,12 @@ RTC_OBJC_EXPORT
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL activeResetSrtpParams;
|
||||
|
||||
/**
|
||||
* If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection
|
||||
* that it should use the MediaTransportInterface.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL useMediaTransport;
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
@end
|
||||
|
||||
@ -48,6 +48,7 @@
|
||||
@synthesize sdpSemantics = _sdpSemantics;
|
||||
@synthesize turnCustomizer = _turnCustomizer;
|
||||
@synthesize activeResetSrtpParams = _activeResetSrtpParams;
|
||||
@synthesize useMediaTransport = _useMediaTransport;
|
||||
|
||||
- (instancetype)init {
|
||||
// Copy defaults.
|
||||
@ -117,7 +118,7 @@
|
||||
- (NSString *)description {
|
||||
static NSString *formatString =
|
||||
@"RTCConfiguration: "
|
||||
@"{\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%@\n%@\n%d\n%d\n%d\n}\n";
|
||||
@"{\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%@\n%@\n%d\n%d\n%d\n%@\n}\n";
|
||||
|
||||
return [NSString
|
||||
stringWithFormat:formatString,
|
||||
@ -140,7 +141,8 @@
|
||||
_iceRegatherIntervalRange,
|
||||
_disableLinkLocalNetworks,
|
||||
_maxIPv6Networks,
|
||||
_activeResetSrtpParams];
|
||||
_activeResetSrtpParams,
|
||||
_useMediaTransport];
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "api/jsepicecandidate.h"
|
||||
#include "api/media_transport_interface.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
NSString * const kRTCPeerConnectionErrorDomain =
|
||||
|
||||
@ -17,6 +17,7 @@ namespace webrtc {
|
||||
class AudioDeviceModule;
|
||||
class AudioEncoderFactory;
|
||||
class AudioDecoderFactory;
|
||||
class MediaTransportFactory;
|
||||
class VideoEncoderFactory;
|
||||
class VideoDecoderFactory;
|
||||
class AudioProcessing;
|
||||
@ -49,6 +50,25 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
audioProcessingModule:
|
||||
(rtc::scoped_refptr<webrtc::AudioProcessing>)audioProcessingModule;
|
||||
|
||||
- (instancetype)
|
||||
initWithNativeAudioEncoderFactory:
|
||||
(rtc::scoped_refptr<webrtc::AudioEncoderFactory>)audioEncoderFactory
|
||||
nativeAudioDecoderFactory:
|
||||
(rtc::scoped_refptr<webrtc::AudioDecoderFactory>)audioDecoderFactory
|
||||
nativeVideoEncoderFactory:
|
||||
(std::unique_ptr<webrtc::VideoEncoderFactory>)videoEncoderFactory
|
||||
nativeVideoDecoderFactory:
|
||||
(std::unique_ptr<webrtc::VideoDecoderFactory>)videoDecoderFactory
|
||||
audioDeviceModule:(nullable webrtc::AudioDeviceModule *)audioDeviceModule
|
||||
audioProcessingModule:
|
||||
(rtc::scoped_refptr<webrtc::AudioProcessing>)audioProcessingModule
|
||||
mediaTransportFactory:
|
||||
(std::unique_ptr<webrtc::MediaTransportFactory>)mediaTransportFactory;
|
||||
|
||||
- (instancetype)initWithEncoderFactory:(nullable id<RTCVideoEncoderFactory>)encoderFactory
|
||||
decoderFactory:(nullable id<RTCVideoDecoderFactory>)decoderFactory
|
||||
mediaTransportFactory:
|
||||
(std::unique_ptr<webrtc::MediaTransportFactory>)mediaTransportFactory;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
// TODO(zhihuang): Remove nogncheck once MediaEngineInterface is moved to C++
|
||||
// API layer.
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/media_transport_interface.h"
|
||||
#include "media/engine/webrtcmediaengine.h" // nogncheck
|
||||
|
||||
@implementation RTCPeerConnectionFactory {
|
||||
@ -80,12 +81,15 @@
|
||||
nativeVideoDecoderFactory:webrtc::ObjCToNativeVideoDecoderFactory(
|
||||
[[RTCVideoDecoderFactoryH264 alloc] init])
|
||||
audioDeviceModule:[self audioDeviceModule]
|
||||
audioProcessingModule:nullptr];
|
||||
audioProcessingModule:nullptr
|
||||
mediaTransportFactory:nullptr];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (instancetype)initWithEncoderFactory:(nullable id<RTCVideoEncoderFactory>)encoderFactory
|
||||
decoderFactory:(nullable id<RTCVideoDecoderFactory>)decoderFactory {
|
||||
decoderFactory:(nullable id<RTCVideoDecoderFactory>)decoderFactory
|
||||
mediaTransportFactory:
|
||||
(std::unique_ptr<webrtc::MediaTransportFactory>)mediaTransportFactory {
|
||||
#ifdef HAVE_NO_MEDIA
|
||||
return [self initWithNoMedia];
|
||||
#else
|
||||
@ -102,9 +106,16 @@
|
||||
nativeVideoEncoderFactory:std::move(native_encoder_factory)
|
||||
nativeVideoDecoderFactory:std::move(native_decoder_factory)
|
||||
audioDeviceModule:[self audioDeviceModule]
|
||||
audioProcessingModule:nullptr];
|
||||
audioProcessingModule:nullptr
|
||||
mediaTransportFactory:std::move(mediaTransportFactory)];
|
||||
#endif
|
||||
}
|
||||
- (instancetype)initWithEncoderFactory:(nullable id<RTCVideoEncoderFactory>)encoderFactory
|
||||
decoderFactory:(nullable id<RTCVideoDecoderFactory>)decoderFactory {
|
||||
return [self initWithEncoderFactory:encoderFactory
|
||||
decoderFactory:decoderFactory
|
||||
mediaTransportFactory:nullptr];
|
||||
}
|
||||
|
||||
- (instancetype)initNative {
|
||||
if (self = [super init]) {
|
||||
@ -152,20 +163,57 @@
|
||||
(nullable webrtc::AudioDeviceModule *)audioDeviceModule
|
||||
audioProcessingModule:
|
||||
(rtc::scoped_refptr<webrtc::AudioProcessing>)audioProcessingModule {
|
||||
return [self initWithNativeAudioEncoderFactory:audioEncoderFactory
|
||||
nativeAudioDecoderFactory:audioDecoderFactory
|
||||
nativeVideoEncoderFactory:std::move(videoEncoderFactory)
|
||||
nativeVideoDecoderFactory:std::move(videoDecoderFactory)
|
||||
audioDeviceModule:audioDeviceModule
|
||||
audioProcessingModule:audioProcessingModule
|
||||
mediaTransportFactory:nullptr];
|
||||
}
|
||||
|
||||
- (instancetype)
|
||||
initWithNativeAudioEncoderFactory:
|
||||
(rtc::scoped_refptr<webrtc::AudioEncoderFactory>)audioEncoderFactory
|
||||
nativeAudioDecoderFactory:
|
||||
(rtc::scoped_refptr<webrtc::AudioDecoderFactory>)audioDecoderFactory
|
||||
nativeVideoEncoderFactory:
|
||||
(std::unique_ptr<webrtc::VideoEncoderFactory>)videoEncoderFactory
|
||||
nativeVideoDecoderFactory:
|
||||
(std::unique_ptr<webrtc::VideoDecoderFactory>)videoDecoderFactory
|
||||
audioDeviceModule:(nullable webrtc::AudioDeviceModule *)audioDeviceModule
|
||||
audioProcessingModule:
|
||||
(rtc::scoped_refptr<webrtc::AudioProcessing>)audioProcessingModule
|
||||
mediaTransportFactory:
|
||||
(std::unique_ptr<webrtc::MediaTransportFactory>)mediaTransportFactory {
|
||||
#ifdef HAVE_NO_MEDIA
|
||||
return [self initWithNoMedia];
|
||||
#else
|
||||
if (self = [self initNative]) {
|
||||
_nativeFactory = webrtc::CreatePeerConnectionFactory(_networkThread.get(),
|
||||
_workerThread.get(),
|
||||
_signalingThread.get(),
|
||||
audioDeviceModule,
|
||||
audioEncoderFactory,
|
||||
audioDecoderFactory,
|
||||
std::move(videoEncoderFactory),
|
||||
std::move(videoDecoderFactory),
|
||||
nullptr, // audio mixer
|
||||
audioProcessingModule);
|
||||
if (!audioProcessingModule) audioProcessingModule = webrtc::AudioProcessingBuilder().Create();
|
||||
|
||||
std::unique_ptr<cricket::MediaEngineInterface> media_engine =
|
||||
cricket::WebRtcMediaEngineFactory::Create(audioDeviceModule,
|
||||
audioEncoderFactory,
|
||||
audioDecoderFactory,
|
||||
std::move(videoEncoderFactory),
|
||||
std::move(videoDecoderFactory),
|
||||
nullptr, // audio mixer
|
||||
audioProcessingModule);
|
||||
|
||||
std::unique_ptr<webrtc::CallFactoryInterface> call_factory = webrtc::CreateCallFactory();
|
||||
|
||||
std::unique_ptr<webrtc::RtcEventLogFactoryInterface> event_log_factory =
|
||||
webrtc::CreateRtcEventLogFactory();
|
||||
webrtc::PeerConnectionFactoryDependencies dependencies;
|
||||
dependencies.network_thread = _networkThread.get();
|
||||
dependencies.worker_thread = _workerThread.get();
|
||||
dependencies.signaling_thread = _signalingThread.get();
|
||||
dependencies.media_engine = std::move(media_engine);
|
||||
dependencies.call_factory = std::move(call_factory);
|
||||
dependencies.event_log_factory = std::move(event_log_factory);
|
||||
dependencies.media_transport_factory = std::move(mediaTransportFactory);
|
||||
_nativeFactory = webrtc::CreateModularPeerConnectionFactory(std::move(dependencies));
|
||||
NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
|
||||
}
|
||||
return self;
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/audio_encoder_factory.h"
|
||||
#include "api/media_transport_interface.h"
|
||||
#include "api/video_codecs/video_decoder_factory.h"
|
||||
#include "api/video_codecs/video_encoder_factory.h"
|
||||
#include "modules/audio_device/include/audio_device.h"
|
||||
@ -25,6 +26,7 @@
|
||||
rtc::scoped_refptr<webrtc::AudioDecoderFactory> _audioDecoderFactory;
|
||||
rtc::scoped_refptr<webrtc::AudioDeviceModule> _audioDeviceModule;
|
||||
rtc::scoped_refptr<webrtc::AudioProcessing> _audioProcessingModule;
|
||||
std::unique_ptr<webrtc::MediaTransportFactory> _mediaTransportFactory;
|
||||
}
|
||||
|
||||
+ (RTCPeerConnectionFactoryBuilder *)builder {
|
||||
@ -38,7 +40,8 @@
|
||||
nativeVideoEncoderFactory:std::move(_videoEncoderFactory)
|
||||
nativeVideoDecoderFactory:std::move(_videoDecoderFactory)
|
||||
audioDeviceModule:_audioDeviceModule
|
||||
audioProcessingModule:_audioProcessingModule];
|
||||
audioProcessingModule:_audioProcessingModule
|
||||
mediaTransportFactory:std::move(_mediaTransportFactory)];
|
||||
}
|
||||
|
||||
- (void)setVideoEncoderFactory:(std::unique_ptr<webrtc::VideoEncoderFactory>)videoEncoderFactory {
|
||||
|
||||
@ -22,6 +22,7 @@ extern "C" {
|
||||
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
#include "api/media_transport_interface.h"
|
||||
#include "api/video_codecs/video_decoder_factory.h"
|
||||
#include "api/video_codecs/video_encoder_factory.h"
|
||||
#include "modules/audio_device/include/audio_device.h"
|
||||
@ -49,7 +50,8 @@ extern "C" {
|
||||
nativeVideoEncoderFactory:nullptr
|
||||
nativeVideoDecoderFactory:nullptr
|
||||
audioDeviceModule:nullptr
|
||||
audioProcessingModule:nullptr]);
|
||||
audioProcessingModule:nullptr
|
||||
mediaTransportFactory:nullptr]);
|
||||
#endif
|
||||
RTCPeerConnectionFactoryBuilder* builder = [[RTCPeerConnectionFactoryBuilder alloc] init];
|
||||
RTCPeerConnectionFactory* peerConnectionFactory = [builder createPeerConnectionFactory];
|
||||
@ -69,7 +71,8 @@ extern "C" {
|
||||
nativeVideoEncoderFactory:nullptr
|
||||
nativeVideoDecoderFactory:nullptr
|
||||
audioDeviceModule:nullptr
|
||||
audioProcessingModule:nullptr]);
|
||||
audioProcessingModule:nullptr
|
||||
mediaTransportFactory:nullptr]);
|
||||
#endif
|
||||
RTCPeerConnectionFactoryBuilder* builder = [RTCPeerConnectionFactoryBuilder defaultBuilder];
|
||||
RTCPeerConnectionFactory* peerConnectionFactory = [builder createPeerConnectionFactory];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user