diff --git a/extra/libwebrtc-objc-iosrtc-misc.patch b/extra/libwebrtc-objc-iosrtc-misc.patch new file mode 100644 index 00000000..31446e6b --- /dev/null +++ b/extra/libwebrtc-objc-iosrtc-misc.patch @@ -0,0 +1,22 @@ +--- a/webrtc/build/common.gypi ++++ b/webrtc/build/common.gypi +@@ -155,7 +155,7 @@ + + # Enable this to use HW H.264 encoder/decoder on iOS/Mac PeerConnections. + # Enabling this may break interop with Android clients that support H264. +- 'use_objc_h264%': 0, ++ 'use_objc_h264%': 1, + + # Enable this to prevent extern symbols from being hidden on iOS builds. + # The chromium settings we inherit hide symbols by default on Release +--- a/webrtc/system_wrappers/system_wrappers.gyp ++++ b/webrtc/system_wrappers/system_wrappers.gyp +@@ -76,6 +76,8 @@ + 'source/trace_posix.h', + 'source/trace_win.cc', + 'source/trace_win.h', ++ 'include/metrics_default.h', ++ 'source/metrics_default.cc', + ], + 'conditions': [ + ['enable_data_logging==1', { diff --git a/extra/libwebrtc-objc-iosrtc.patch b/extra/libwebrtc-objc-iosrtc.patch index 5b357c96..57953817 100644 --- a/extra/libwebrtc-objc-iosrtc.patch +++ b/extra/libwebrtc-objc-iosrtc.patch @@ -1,10 +1,9 @@ -diff -ruN objc/RTCMediaStream+Internal.h objc.iosrtc/RTCMediaStream+Internal.h ---- objc/RTCMediaStream+Internal.h 2016-02-16 18:13:43.000000000 +0100 -+++ objc.iosrtc/RTCMediaStream+Internal.h 2016-02-16 18:23:22.000000000 +0100 +--- a/talk/app/webrtc/objc/RTCMediaStream+Internal.h ++++ b/talk/app/webrtc/objc/RTCMediaStream+Internal.h @@ -37,4 +37,12 @@ - (id)initWithMediaStream: (rtc::scoped_refptr)mediaStream; - + +- (void)update; +- (BOOL)hasNativeAudioTrack:(RTCAudioTrack *)objcTrack; +- (BOOL)hasNativeVideoTrack:(RTCVideoTrack *)objcTrack; @@ -14,20 +13,19 @@ diff -ruN objc/RTCMediaStream+Internal.h objc.iosrtc/RTCMediaStream+Internal.h + (rtc::scoped_refptr)nativeTrack; + @end -diff -ruN objc/RTCMediaStream.mm objc.iosrtc/RTCMediaStream.mm ---- objc/RTCMediaStream.mm 2016-02-16 18:13:43.000000000 +0100 -+++ objc.iosrtc/RTCMediaStream.mm 2016-02-16 18:34:04.000000000 +0100 +--- a/talk/app/webrtc/objc/RTCMediaStream.mm ++++ b/talk/app/webrtc/objc/RTCMediaStream.mm @@ -31,16 +31,31 @@ - + #import "RTCMediaStream+Internal.h" - + -#import "RTCAudioTrack+Internal.h" #import "RTCMediaStreamTrack+Internal.h" +#import "RTCAudioTrack+Internal.h" #import "RTCVideoTrack+Internal.h" - + #include "webrtc/api/mediastreaminterface.h" - + +namespace webrtc { + class RTCMediaStreamObserver : public ObserverInterface { + public: @@ -46,27 +44,27 @@ diff -ruN objc/RTCMediaStream.mm objc.iosrtc/RTCMediaStream.mm NSMutableArray* _audioTracks; NSMutableArray* _videoTracks; rtc::scoped_refptr _mediaStream; -+ rtc::scoped_ptr _observer; ++ std::unique_ptr _observer; } - + - (NSString*)description { -@@ -64,7 +79,6 @@ - +@@ -64,7 +79,6 @@ - (NSString*)label { + - (BOOL)addAudioTrack:(RTCAudioTrack*)track { if (self.mediaStream->AddTrack(track.audioTrack)) { - [_audioTracks addObject:track]; return YES; } return NO; -@@ -72,7 +86,6 @@ - +@@ -72,7 +86,6 @@ - (BOOL)addAudioTrack:(RTCAudioTrack*)track { + - (BOOL)addVideoTrack:(RTCVideoTrack*)track { if (self.mediaStream->AddTrack(track.nativeVideoTrack)) { - [_videoTracks addObject:track]; return YES; } return NO; -@@ -83,7 +96,6 @@ +@@ -83,7 +96,6 @@ - (BOOL)removeAudioTrack:(RTCAudioTrack*)track { NSAssert(index != NSNotFound, @"|removeAudioTrack| called on unexpected RTCAudioTrack"); if (index != NSNotFound && self.mediaStream->RemoveTrack(track.audioTrack)) { @@ -74,7 +72,7 @@ diff -ruN objc/RTCMediaStream.mm objc.iosrtc/RTCMediaStream.mm return YES; } return NO; -@@ -93,9 +105,7 @@ +@@ -93,9 +105,7 @@ - (BOOL)removeVideoTrack:(RTCVideoTrack*)track { NSUInteger index = [_videoTracks indexOfObjectIdenticalTo:track]; NSAssert(index != NSNotFound, @"|removeAudioTrack| called on unexpected RTCVideoTrack"); @@ -85,19 +83,19 @@ diff -ruN objc/RTCMediaStream.mm objc.iosrtc/RTCMediaStream.mm return YES; } return NO; -@@ -119,6 +129,8 @@ +@@ -119,6 +129,8 @@ - (id)initWithMediaStream: _audioTracks = [NSMutableArray arrayWithCapacity:audio_tracks.size()]; _videoTracks = [NSMutableArray arrayWithCapacity:video_tracks.size()]; _mediaStream = mediaStream; + _observer.reset(new webrtc::RTCMediaStreamObserver(self)); + _mediaStream->RegisterObserver(_observer.get()); - + for (size_t i = 0; i < audio_tracks.size(); ++i) { rtc::scoped_refptr track = -@@ -139,8 +151,157 @@ +@@ -139,8 +151,157 @@ - (id)initWithMediaStream: return self; } - + +- (void)dealloc { + _mediaStream->UnregisterObserver(_observer.get()); +} @@ -105,7 +103,7 @@ diff -ruN objc/RTCMediaStream.mm objc.iosrtc/RTCMediaStream.mm - (rtc::scoped_refptr)mediaStream { return _mediaStream; } - + +- (void)update { + size_t i; + webrtc::AudioTrackVector native_audio_tracks = _mediaStream->GetAudioTracks(); @@ -252,11 +250,10 @@ diff -ruN objc/RTCMediaStream.mm objc.iosrtc/RTCMediaStream.mm +} + @end -diff -ruN objc/public/RTCMediaStream.h objc.iosrtc/public/RTCMediaStream.h ---- objc/public/RTCMediaStream.h 2016-02-16 18:13:43.000000000 +0100 -+++ objc.iosrtc/public/RTCMediaStream.h 2016-02-16 18:24:45.000000000 +0100 +--- a/talk/app/webrtc/objc/public/RTCMediaStream.h ++++ b/talk/app/webrtc/objc/public/RTCMediaStream.h @@ -29,6 +29,21 @@ - + @class RTCAudioTrack; @class RTCVideoTrack; +@class RTCMediaStream; @@ -274,7 +271,7 @@ diff -ruN objc/public/RTCMediaStream.h objc.iosrtc/public/RTCMediaStream.h + (RTCMediaStream*)mediaStream track:(RTCMediaStreamTrack*)track; + +@end - + // RTCMediaStream is an ObjectiveC wrapper for MediaStreamInterface. @interface RTCMediaStream : NSObject @@ -36,6 +51,7 @@ @@ -282,6 +279,6 @@ diff -ruN objc/public/RTCMediaStream.h objc.iosrtc/public/RTCMediaStream.h @property(nonatomic, strong, readonly) NSArray *videoTracks; @property(nonatomic, strong, readonly) NSString *label; +@property(nonatomic, weak) id delegate; - + - (BOOL)addAudioTrack:(RTCAudioTrack *)track; - (BOOL)addVideoTrack:(RTCVideoTrack *)track;