Add a webrtc{en,de}coderfactory implementation for VideoToolbox

This CL removes the coupling of the VideoToolbox h264 implementation
to the generic h264 code. The files have been moved into sdb/obj/Framework
and all dependency on them has been removed from the rest of WebRTC.
We now add it as an external encoder via a factory supplied to the
CreatePeerConnectionFactory call. This also brings the iOS implementation
closer to what we do on Android for MediaCodec.

BUG=webrtc:6619

Review-Url: https://codereview.webrtc.org/2463313002
Cr-Commit-Position: refs/heads/master@{#14953}
This commit is contained in:
kthelgason
2016-11-07 07:26:00 -08:00
committed by Commit bot
parent 3babb99039
commit 6a5047dad3
17 changed files with 239 additions and 212 deletions

View File

@ -21,6 +21,8 @@
#import "RTCVideoTrack+Private.h"
#import "WebRTC/RTCLogging.h"
#include "videotoolboxvideocodecfactory.h"
@implementation RTCPeerConnectionFactory {
std::unique_ptr<rtc::Thread> _networkThread;
std::unique_ptr<rtc::Thread> _workerThread;
@ -44,9 +46,14 @@
result = _signalingThread->Start();
NSAssert(result, @"Failed to start signaling thread.");
const auto encoder_factory = new webrtc::VideoToolboxVideoEncoderFactory();
const auto decoder_factory = new webrtc::VideoToolboxVideoDecoderFactory();
// Ownership of encoder/decoder factories is passed on to the
// peerconnectionfactory, that handles deleting them.
_nativeFactory = webrtc::CreatePeerConnectionFactory(
_networkThread.get(), _workerThread.get(), _signalingThread.get(),
nullptr, nullptr, nullptr);
nullptr, encoder_factory, decoder_factory);
NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
}
return self;