Revert "Adding injectable audio decoder and encoder factory support to the RTCPeerConnection obj-c layer."

This reverts commit 96de428fd1f301c3ad1355183b45e44db5ef3f7f.

Reason for revert: Gives compile errors because the new ObjC++ headers are included in some targets that use ObjC.

Original change's description:
> Adding injectable audio decoder and encoder factory support to the RTCPeerConnection obj-c layer.
> 
> Bug: webrtc:8093
> Change-Id: I868ce5f75a72c6deb065dec60784289d045ae22a
> Reviewed-on: https://chromium-review.googlesource.com/608981
> Commit-Queue: Jeremy Newton-Smith <jeremyns@webrtc.org>
> Reviewed-by: Zeke Chin <tkchin@webrtc.org>
> Reviewed-by: Kári Tristan Helgason <kthelgason@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#19477}

TBR=kjellander@webrtc.org,tkchin@webrtc.org,kthelgason@webrtc.org,jeremyns@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:8093
Change-Id: I3ade9dd979c9f13990a2972b15b786b8e78e1cd4
Reviewed-on: https://chromium-review.googlesource.com/640810
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19573}
This commit is contained in:
Magnus Jedvert
2017-08-29 09:49:43 +00:00
committed by Commit Bot
parent f52d34d682
commit f83dc8bbe5
10 changed files with 59 additions and 247 deletions

View File

@ -1,27 +0,0 @@
/*
* Copyright 2017 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
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#import "WebRTC/RTCBuiltinAudioDecoderFactory.h"
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h"
@implementation RTCBuiltinAudioDecoderFactory {
rtc::scoped_refptr<webrtc::AudioDecoderFactory> _nativeAudioDecoderFactory;
}
- (rtc::scoped_refptr<webrtc::AudioDecoderFactory>)nativeAudioDecoderFactory {
if (_nativeAudioDecoderFactory == nullptr) {
_nativeAudioDecoderFactory = webrtc::CreateBuiltinAudioDecoderFactory();
}
return _nativeAudioDecoderFactory;
}
@end

View File

@ -1,27 +0,0 @@
/*
* Copyright 2017 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
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#import "WebRTC/RTCBuiltinAudioEncoderFactory.h"
#include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h"
@implementation RTCBuiltinAudioEncoderFactory {
rtc::scoped_refptr<webrtc::AudioEncoderFactory> _nativeAudioEncoderFactory;
}
- (rtc::scoped_refptr<webrtc::AudioEncoderFactory>)nativeAudioEncoderFactory {
if (_nativeAudioEncoderFactory == nullptr) {
_nativeAudioEncoderFactory = webrtc::CreateBuiltinAudioEncoderFactory();
}
return _nativeAudioEncoderFactory;
}
@end

View File

@ -19,13 +19,9 @@
#import "RTCPeerConnection+Private.h"
#import "RTCVideoSource+Private.h"
#import "RTCVideoTrack+Private.h"
#import "WebRTC/RTCAudioDecoderFactory.h"
#import "WebRTC/RTCAudioEncoderFactory.h"
#import "WebRTC/RTCLogging.h"
#import "WebRTC/RTCVideoCodecFactory.h"
#ifndef HAVE_NO_MEDIA
#import "WebRTC/RTCBuiltinAudioDecoderFactory.h"
#import "WebRTC/RTCBuiltinAudioEncoderFactory.h"
#import "WebRTC/RTCVideoCodecH264.h"
#endif
@ -51,22 +47,15 @@
- (instancetype)init {
#ifdef HAVE_NO_MEDIA
return [self initWithAudioEncoderFactory:nil
audioDecoderFactory:nil
videoEncoderFactory:nil
videoDecoderFactory:nil];
return [self initWithEncoderFactory:nil decoderFactory:nil];
#else
return [self initWithAudioEncoderFactory:[[RTCBuiltinAudioEncoderFactory alloc] init]
audioDecoderFactory:[[RTCBuiltinAudioDecoderFactory alloc] init]
videoEncoderFactory:[[RTCVideoEncoderFactoryH264 alloc] init]
videoDecoderFactory:[[RTCVideoDecoderFactoryH264 alloc] init]];
return [self initWithEncoderFactory:[[RTCVideoEncoderFactoryH264 alloc] init]
decoderFactory:[[RTCVideoDecoderFactoryH264 alloc] init]];
#endif
}
- (instancetype)initWithAudioEncoderFactory:(id<RTCAudioEncoderFactory>)audioEncoderFactory
audioDecoderFactory:(id<RTCAudioDecoderFactory>)audioDecoderFactory
videoEncoderFactory:(id<RTCVideoEncoderFactory>)videoEncoderFactory
videoDecoderFactory:(id<RTCVideoDecoderFactory>)videoDecoderFactory {
- (instancetype)initWithEncoderFactory:(nullable id<RTCVideoEncoderFactory>)encoderFactory
decoderFactory:(nullable id<RTCVideoDecoderFactory>)decoderFactory {
if (self = [super init]) {
_networkThread = rtc::Thread::CreateWithSocketServer();
BOOL result = _networkThread->Start();
@ -94,21 +83,13 @@
std::unique_ptr<webrtc::CallFactoryInterface>(),
std::unique_ptr<webrtc::RtcEventLogFactoryInterface>());
#else
rtc::scoped_refptr<webrtc::AudioEncoderFactory> platform_audio_encoder_factory = nullptr;
rtc::scoped_refptr<webrtc::AudioDecoderFactory> platform_audio_decoder_factory = nullptr;
if (audioEncoderFactory) {
platform_audio_encoder_factory = [audioEncoderFactory nativeAudioEncoderFactory];
cricket::WebRtcVideoEncoderFactory *platform_encoder_factory = nullptr;
cricket::WebRtcVideoDecoderFactory *platform_decoder_factory = nullptr;
if (encoderFactory) {
platform_encoder_factory = new webrtc::ObjCVideoEncoderFactory(encoderFactory);
}
if (audioDecoderFactory) {
platform_audio_decoder_factory = [audioDecoderFactory nativeAudioDecoderFactory];
}
cricket::WebRtcVideoEncoderFactory *platform_video_encoder_factory = nullptr;
cricket::WebRtcVideoDecoderFactory *platform_video_decoder_factory = nullptr;
if (videoEncoderFactory) {
platform_video_encoder_factory = new webrtc::ObjCVideoEncoderFactory(videoEncoderFactory);
}
if (videoDecoderFactory) {
platform_video_decoder_factory = new webrtc::ObjCVideoDecoderFactory(videoDecoderFactory);
if (decoderFactory) {
platform_decoder_factory = new webrtc::ObjCVideoDecoderFactory(decoderFactory);
}
// Ownership of encoder/decoder factories is passed on to the
@ -116,11 +97,9 @@
_nativeFactory = webrtc::CreatePeerConnectionFactory(_networkThread.get(),
_workerThread.get(),
_signalingThread.get(),
nullptr, // audio device module
platform_audio_encoder_factory,
platform_audio_decoder_factory,
platform_video_encoder_factory,
platform_video_decoder_factory);
nullptr,
platform_encoder_factory,
platform_decoder_factory);
#endif
NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
}
@ -142,12 +121,15 @@
return [self audioTrackWithSource:audioSource trackId:trackId];
}
- (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source trackId:(NSString *)trackId {
return [[RTCAudioTrack alloc] initWithFactory:self source:source trackId:trackId];
- (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source
trackId:(NSString *)trackId {
return [[RTCAudioTrack alloc] initWithFactory:self
source:source
trackId:trackId];
}
- (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints:
(nullable RTCMediaConstraints *)constraints {
(nullable RTCMediaConstraints *)constraints {
#ifdef HAVE_NO_MEDIA
return nil;
#else
@ -164,25 +146,32 @@
objcVideoTrackSource)];
}
- (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source trackId:(NSString *)trackId {
return [[RTCVideoTrack alloc] initWithFactory:self source:source trackId:trackId];
- (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source
trackId:(NSString *)trackId {
return [[RTCVideoTrack alloc] initWithFactory:self
source:source
trackId:trackId];
}
- (RTCMediaStream *)mediaStreamWithStreamId:(NSString *)streamId {
return [[RTCMediaStream alloc] initWithFactory:self streamId:streamId];
return [[RTCMediaStream alloc] initWithFactory:self
streamId:streamId];
}
- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration
constraints:(RTCMediaConstraints *)constraints
- (RTCPeerConnection *)peerConnectionWithConfiguration:
(RTCConfiguration *)configuration
constraints:
(RTCMediaConstraints *)constraints
delegate:
(nullable id<RTCPeerConnectionDelegate>)delegate {
(nullable id<RTCPeerConnectionDelegate>)delegate {
return [[RTCPeerConnection alloc] initWithFactory:self
configuration:configuration
constraints:constraints
delegate:delegate];
}
- (BOOL)startAecDumpWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes {
- (BOOL)startAecDumpWithFilePath:(NSString *)filePath
maxSizeInBytes:(int64_t)maxSizeInBytes {
RTC_DCHECK(filePath.length);
RTC_DCHECK_GT(maxSizeInBytes, 0);