(Auto)update libjingle 62865357-> 62871616

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5674 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrike@webrtc.org
2014-03-10 20:41:22 +00:00
parent d32797f853
commit d3d6bce9ed
20 changed files with 856 additions and 132 deletions

View File

@@ -126,14 +126,14 @@
[[RTCAudioTrack alloc] initWithMediaTrack:track];
[_audioTracks addObject:audioTrack];
}
// TODO(hughv): Add video.
// for (size_t i = 0; i < video_tracks.size(); ++i) {
// talk_base::scoped_refptr<webrtc::VideoTrackInterface> track =
// video_tracks[i];
// RTCVideoTrack *videoTrack =
// [[RTCVideoTrack alloc] initWithMediaTrack:track];
// [_videoTracks addObject:videoTrack];
// }
for (size_t i = 0; i < video_tracks.size(); ++i) {
talk_base::scoped_refptr<webrtc::VideoTrackInterface> track =
video_tracks[i];
RTCVideoTrack* videoTrack =
[[RTCVideoTrack alloc] initWithMediaTrack:track];
[_videoTracks addObject:videoTrack];
}
}
return self;
}

View File

@@ -120,7 +120,7 @@
return nil;
}
talk_base::scoped_refptr<webrtc::VideoSourceInterface> source =
self.nativeFactory->CreateVideoSource(capturer.capturer.get(),
self.nativeFactory->CreateVideoSource([capturer release_native_capturer],
constraints.constraints);
return [[RTCVideoSource alloc] initWithMediaSource:source];
}

View File

@@ -31,7 +31,7 @@
@interface RTCVideoCapturer (Internal)
@property(nonatomic, assign, readonly) const talk_base::scoped_ptr<cricket::VideoCapturer> &capturer;
- (cricket::VideoCapturer*)release_native_capturer;
- (id)initWithCapturer:(cricket::VideoCapturer*)capturer;

View File

@@ -67,10 +67,8 @@
return self;
}
// TODO(hughv): When capturer is implemented, this needs to return
// _capturer.release() instead. For now, this isn't used.
- (const talk_base::scoped_ptr<cricket::VideoCapturer> &)capturer {
return _capturer;
- (cricket::VideoCapturer*)release_native_capturer {
return _capturer.release();
}
@end

View File

@@ -35,6 +35,4 @@
@property(nonatomic, assign, readonly)
webrtc::VideoRendererInterface *videoRenderer;
- (id)initWithVideoRenderer:(webrtc::VideoRendererInterface *)videoRenderer;
@end

View File

@@ -33,18 +33,70 @@
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#endif
#import "RTCI420Frame.h"
#import "RTCVideoRendererDelegate.h"
@implementation RTCVideoRenderer
#import "webrtc/modules/video_render/ios/video_render_ios_impl.h"
#import "webrtc/modules/video_render/ios/video_render_ios_view.h"
#include "common_video/interface/i420_video_frame.h"
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/media/base/videoframe.h"
#include "webrtc/modules/video_render/include/video_render_defines.h"
// An adapter presenting VideoRendererInterface's API and delegating to
// a VideoRenderCallback. Suitable for feeding to
// VideoTrackInterface::AddRenderer().
class CallbackConverter : public webrtc::VideoRendererInterface {
public:
CallbackConverter(webrtc::VideoRenderCallback* callback,
const uint32_t streamId)
: callback_(callback), streamId_(streamId) {}
virtual void SetSize(int width, int height) {};
virtual void RenderFrame(const cricket::VideoFrame* frame) {
// Make this into an I420VideoFrame.
size_t width = frame->GetWidth();
size_t height = frame->GetHeight();
size_t y_plane_size = width * height;
size_t uv_plane_size = frame->GetChromaSize();
webrtc::I420VideoFrame i420Frame;
i420Frame.CreateFrame(y_plane_size,
frame->GetYPlane(),
uv_plane_size,
frame->GetUPlane(),
uv_plane_size,
frame->GetVPlane(),
width,
height,
frame->GetYPitch(),
frame->GetUPitch(),
frame->GetVPitch());
i420Frame.set_render_time_ms(frame->GetTimeStamp() / 1000000);
callback_->RenderFrame(streamId_, i420Frame);
}
private:
webrtc::VideoRenderCallback* callback_;
const uint32_t streamId_;
};
@implementation RTCVideoRenderer {
CallbackConverter* _converter;
talk_base::scoped_ptr<webrtc::VideoRenderIosImpl> _iosRenderer;
}
@synthesize delegate = _delegate;
+ (RTCVideoRenderer *)videoRenderGUIWithFrame:(CGRect)frame {
// TODO (hughv): Implement.
return nil;
return [[RTCVideoRenderer alloc]
initWithRenderView:[RTCVideoRenderer newRenderViewWithFrame:frame]];
}
- (id)initWithDelegate:(id<RTCVideoRendererDelegate>)delegate {
@@ -55,20 +107,93 @@
return self;
}
@end
+ (UIView*)newRenderViewWithFrame:(CGRect)frame {
VideoRenderIosView* newView =
[[VideoRenderIosView alloc] initWithFrame:frame];
return newView;
}
@implementation RTCVideoRenderer (Internal)
- (id)initWithVideoRenderer:(webrtc::VideoRendererInterface *)videoRenderer {
- (id)initWithRenderView:(UIView*)view {
NSAssert([view isKindOfClass:[VideoRenderIosView class]],
@"The view must be of kind 'VideoRenderIosView'");
if ((self = [super init])) {
// TODO (hughv): Implement.
VideoRenderIosView* renderView = (VideoRenderIosView*)view;
_iosRenderer.reset(
new webrtc::VideoRenderIosImpl(0, (__bridge void*)renderView, NO));
if (_iosRenderer->Init() != -1) {
webrtc::VideoRenderCallback* callback =
_iosRenderer->AddIncomingRenderStream(0, 1, 0, 0, 1, 1);
_converter = new CallbackConverter(callback, 0);
_iosRenderer->StartRender();
} else {
self = nil;
}
}
return self;
}
- (webrtc::VideoRendererInterface *)videoRenderer {
// TODO (hughv): Implement.
return NULL;
- (void)start {
_iosRenderer->StartRender();
}
- (void)stop {
_iosRenderer->StopRender();
}
@end
@implementation RTCVideoRenderer (Internal)
- (webrtc::VideoRendererInterface*)videoRenderer {
return _converter;
}
@end
#else // TARGET_OS_IPHONE
// TODO(fischman): implement an OS/X RTCVideoRenderer (and add to
// RTCPeerConnectionTest!).
#import "RTCI420Frame.h"
#import "RTCVideoRendererDelegate.h"
@implementation RTCVideoRenderer
@synthesize delegate = _delegate;
+ (RTCVideoRenderer*)videoRenderGUIWithFrame:(CGRect)frame {
// TODO(hughv): Implement.
return nil;
}
- (id)initWithDelegate:(id<RTCVideoRendererDelegate>)delegate {
if ((self = [super init])) {
_delegate = delegate;
// TODO(hughv): Create video renderer.
}
return self;
}
+ (UIView*)newRenderViewWithFrame:(CGRect)frame {
return nil;
}
- (id)initWithRenderView:(UIView*)renderView {
return nil;
}
- (void)start {
}
- (void)stop {
}
@end
@implementation RTCVideoRenderer (Internal)
- (id)initWithVideoRenderer:(webrtc::VideoRendererInterface *)videoRenderer {
if ((self = [super init])) {
// TODO(hughv): Implement.
}
return self;
}
- (webrtc::VideoRendererInterface *)videoRenderer {
// TODO(hughv): Implement.
return NULL;
}
@end
#endif // TARGET_OS_IPHONE

View File

@@ -29,6 +29,7 @@
@protocol RTCVideoRendererDelegate;
struct CGRect;
@class UIView;
// Interface for rendering VideoFrames from a VideoTrack
@interface RTCVideoRenderer : NSObject
@@ -38,11 +39,20 @@ struct CGRect;
// A convenience method to create a renderer and window and render frames into
// that window.
+ (RTCVideoRenderer *)videoRenderGUIWithFrame:(CGRect)frame;
+ (UIView*)newRenderViewWithFrame:(CGRect)frame;
// The view to the following constructor
// must be one of the views from newRenderViewWithFrame.
- (id)initWithRenderView:(UIView*)renderView;
// Initialize the renderer. Requires a delegate which does the actual drawing
// of frames.
- (id)initWithDelegate:(id<RTCVideoRendererDelegate>)delegate;
// Starts rendering.
- (void)start;
// Stops rendering. It can be restarted again using the 'start' method above.
- (void)stop;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Disallow init and don't add to documentation
- (id)init __attribute__(

View File

@@ -922,7 +922,12 @@ void StatsCollector::UpdateStatsFromExistingLocalAudioTracks() {
std::string ssrc_id = talk_base::ToString<uint32>(ssrc);
StatsReport* report = GetReport(StatsReport::kStatsReportTypeSsrc,
ssrc_id);
ASSERT(report != NULL);
if (report == NULL) {
// This can happen if a local audio track is added to a stream on the
// fly and the report has not been set up yet. Do nothing in this case.
LOG(LS_ERROR) << "Stats report does not exist for ssrc " << ssrc;
continue;
}
// The same ssrc can be used by both local and remote audio tracks.
std::string track_id;

View File

@@ -36,6 +36,8 @@
@end
@class RTCMediaConstraints;
// Negotiates signaling for chatting with apprtc.appspot.com "rooms".
// Uses the client<->server specifics of the apprtc AppEngine webapp.
//
@@ -48,6 +50,7 @@
@property(nonatomic, assign) id<ICEServerDelegate> ICEServerDelegate;
@property(nonatomic, assign) id<GAEMessageHandler> messageHandler;
@property(nonatomic, assign) BOOL initiator;
@property(nonatomic, strong) RTCMediaConstraints* videoConstraints;
- (void)connectToRoom:(NSURL *)room;
- (void)sendData:(NSData *)data;

View File

@@ -31,6 +31,8 @@
#import "GAEChannelClient.h"
#import "RTCICEServer.h"
#import "APPRTCAppDelegate.h"
#import "RTCMediaConstraints.h"
@interface APPRTCAppClient ()
@@ -62,6 +64,7 @@
@synthesize token = _token;
@synthesize verboseLogging = _verboseLogging;
@synthesize initiator = _initiator;
@synthesize videoConstraints = _videoConstraints;
- (id)init {
if (self = [super init]) {
@@ -263,6 +266,9 @@
options:0
range:NSMakeRange(0, [self.roomHtml length])]) {
[self showMessage:@"Room full"];
APPRTCAppDelegate *ad =
(APPRTCAppDelegate *)[[UIApplication sharedApplication] delegate];
[ad closeVideoUI];
return;
}
@@ -331,6 +337,18 @@
}
[self updateICEServers:ICEServers withTurnServer:turnServerUrl];
NSString* mc = [self findVar:@"mediaConstraints" strippingQuotes:NO];
if (mc) {
error = nil;
NSData *mcData = [mc dataUsingEncoding:NSUTF8StringEncoding];
json =
[NSJSONSerialization JSONObjectWithData:mcData options:0 error:&error];
NSAssert(!error, @"Unable to parse. %@", error.localizedDescription);
if ([[json objectForKey:@"video"] boolValue]) {
self.videoConstraints = [[RTCMediaConstraints alloc] init];
}
}
[self maybeLogMessage:
[NSString stringWithFormat:@"About to open GAE with token: %@",
self.token]];

View File

@@ -40,6 +40,7 @@
@end
@class APPRTCViewController;
@class RTCVideoTrack;
// The main application class of the AppRTCDemo iOS app demonstrating
// interoperability between the Objcective C implementation of PeerConnection
@@ -53,4 +54,6 @@
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) APPRTCViewController *viewController;
- (void)closeVideoUI;
@end

View File

@@ -25,6 +25,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <AVFoundation/AVFoundation.h>
#import "APPRTCAppDelegate.h"
#import "APPRTCViewController.h"
@@ -37,17 +39,25 @@
#import "RTCPeerConnectionDelegate.h"
#import "RTCPeerConnectionFactory.h"
#import "RTCSessionDescription.h"
#import "RTCVideoRenderer.h"
#import "RTCVideoCapturer.h"
#import "RTCVideoTrack.h"
#import "VideoView.h"
@interface PCObserver : NSObject<RTCPeerConnectionDelegate>
- (id)initWithDelegate:(id<APPRTCSendMessage>)delegate;
@property(nonatomic, strong) VideoView *videoView;
@end
@implementation PCObserver {
id<APPRTCSendMessage> _delegate;
}
@synthesize videoView = _videoView;
- (id)initWithDelegate:(id<APPRTCSendMessage>)delegate {
if (self = [super init]) {
_delegate = delegate;
@@ -71,16 +81,18 @@
dispatch_async(dispatch_get_main_queue(), ^(void) {
NSAssert([stream.audioTracks count] >= 1,
@"Expected at least 1 audio stream");
//NSAssert([stream.videoTracks count] >= 1,
// @"Expected at least 1 video stream");
// TODO(hughv): Add video support
NSAssert([stream.videoTracks count] <= 1,
@"Expected at most 1 video stream");
if ([stream.videoTracks count] != 0) {
[[self videoView]
renderVideoTrackInterface:[stream.videoTracks objectAtIndex:0]];
}
});
}
- (void)peerConnection:(RTCPeerConnection *)peerConnection
removedStream:(RTCMediaStream *)stream {
NSLog(@"PCO onRemoveStream.");
// TODO(hughv): Remove video track.
}
- (void)
@@ -166,8 +178,7 @@
- (void)applicationWillResignActive:(UIApplication *)application {
[self displayLogMessage:@"Application lost focus, connection broken."];
[self disconnect];
[self.viewController resetUI];
[self closeVideoUI];
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
@@ -212,7 +223,21 @@
- (void)onICEServers:(NSArray *)servers {
self.queuedRemoteCandidates = [NSMutableArray array];
self.peerConnectionFactory = [[RTCPeerConnectionFactory alloc] init];
RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc] init];
RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc]
initWithMandatoryConstraints:
@[[[RTCPair alloc]
initWithKey:@"OfferToReceiveAudio"
value:@"true"],
[[RTCPair alloc]
initWithKey:@"OfferToReceiveVideo"
value:@"true"]]
optionalConstraints:
@[[[RTCPair alloc]
initWithKey:@"internalSctpDataChannels"
value:@"true"],
[[RTCPair alloc]
initWithKey:@"DtlsSrtpKeyAgreement"
value:@"true"]]];
self.pcObserver = [[PCObserver alloc] initWithDelegate:self];
self.peerConnection =
[self.peerConnectionFactory peerConnectionWithICEServers:servers
@@ -220,7 +245,34 @@
delegate:self.pcObserver];
RTCMediaStream *lms =
[self.peerConnectionFactory mediaStreamWithLabel:@"ARDAMS"];
// TODO(hughv): Add video.
NSString *cameraID = nil;
for (AVCaptureDevice *captureDevice in
[AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo] ) {
if (captureDevice.position == AVCaptureDevicePositionFront) {
cameraID = [captureDevice localizedName];
break;
}
}
NSAssert(cameraID, @"Unable to get the front camera id");
RTCVideoCapturer *capturer =
[RTCVideoCapturer capturerWithDeviceName:cameraID];
RTCVideoSource *videoSource =
[self.peerConnectionFactory
videoSourceWithCapturer:capturer constraints:self.client.videoConstraints];
RTCVideoTrack *localVideoTrack =
[self.peerConnectionFactory
videoTrackWithID:@"ARDAMSv0" source:videoSource];
if (localVideoTrack) {
[lms addVideoTrack:localVideoTrack];
}
[self.viewController.localVideoView
renderVideoTrackInterface:localVideoTrack];
self.pcObserver.videoView = self.viewController.remoteVideoView;
[lms addAudioTrack:[self.peerConnectionFactory audioTrackWithID:@"ARDAMSa0"]];
[self.peerConnection addStream:lms constraints:constraints];
[self displayLogMessage:@"onICEServers - add local stream."];
@@ -236,10 +288,9 @@
[self displayLogMessage:@"GAE onOpen - create offer."];
RTCPair *audio =
[[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" value:@"true"];
// TODO(hughv): Add video.
// RTCPair *video = [[RTCPair alloc] initWithKey:@"OfferToReceiveVideo"
// value:@"true"];
NSArray *mandatory = @[ audio /*, video*/ ];
RTCPair *video = [[RTCPair alloc] initWithKey:@"OfferToReceiveVideo"
value:@"true"];
NSArray *mandatory = @[ audio , video ];
RTCMediaConstraints *constraints =
[[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatory
optionalConstraints:nil];
@@ -283,7 +334,14 @@
sessionDescription:sdp];
[self displayLogMessage:@"PC - setRemoteDescription."];
} else if ([value compare:@"bye"] == NSOrderedSame) {
[self disconnect];
[self closeVideoUI];
UIAlertView *alertView =
[[UIAlertView alloc] initWithTitle:@"Remote end hung up"
message:@"dropping PeerConnection"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
} else {
NSAssert(NO, @"Invalid message: %@", data);
}
@@ -291,13 +349,13 @@
- (void)onClose {
[self displayLogMessage:@"GAE onClose."];
[self disconnect];
[self closeVideoUI];
}
- (void)onError:(int)code withDescription:(NSString *)description {
[self displayLogMessage:
[NSString stringWithFormat:@"GAE onError: %@", description]];
[self disconnect];
[self closeVideoUI];
}
#pragma mark - RTCSessionDescriptonDelegate methods
@@ -411,11 +469,10 @@
RTCPair *audio =
[[RTCPair alloc]
initWithKey:@"OfferToReceiveAudio" value:@"true"];
// TODO(hughv): Add video.
// RTCPair *video =
// [[RTCPair alloc]
// initWithKey:@"OfferToReceiveVideo" value:@"true"];
NSArray *mandatory = @[ audio /*, video*/ ];
RTCPair *video =
[[RTCPair alloc]
initWithKey:@"OfferToReceiveVideo" value:@"true"];
NSArray *mandatory = @[ audio , video ];
RTCMediaConstraints *constraints =
[[RTCMediaConstraints alloc]
initWithMandatoryConstraints:mandatory
@@ -441,6 +498,7 @@
- (void)disconnect {
[self.client
sendData:[@"{\"type\": \"bye\"}" dataUsingEncoding:NSUTF8StringEncoding]];
[self.peerConnection close];
self.peerConnection = nil;
self.peerConnectionFactory = nil;
self.pcObserver = nil;
@@ -479,4 +537,11 @@
return removeBackslash;
}
#pragma mark - public methods
- (void)closeVideoUI {
[self disconnect];
[self.viewController resetUI];
}
@end

View File

@@ -27,12 +27,18 @@
#import <UIKit/UIKit.h>
@class VideoView;
// The view controller that is displayed when AppRTCDemo is loaded.
@interface APPRTCViewController : UIViewController<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UITextView *textInstructions;
@property (weak, nonatomic) IBOutlet UITextView *textOutput;
@property(weak, nonatomic) IBOutlet UIView* blackView;
@property(nonatomic, strong) VideoView* remoteVideoView;
@property(nonatomic, strong) VideoView* localVideoView;
- (void)displayText:(NSString *)text;
- (void)resetUI;

View File

@@ -27,8 +27,12 @@
#import "APPRTCViewController.h"
#import "VideoView.h"
@interface APPRTCViewController ()
@property (nonatomic, assign) UIInterfaceOrientation statusBarOrientation;
@end
@implementation APPRTCViewController
@@ -36,13 +40,31 @@
@synthesize textField = _textField;
@synthesize textInstructions = _textInstructions;
@synthesize textOutput = _textOutput;
@synthesize blackView = _blackView;
@synthesize remoteVideoView = _remoteVideoView;
@synthesize localVideoView = _localVideoView;
@synthesize statusBarOrientation = _statusBarOrientation;
- (void)viewDidLoad {
[super viewDidLoad];
self.statusBarOrientation =
[UIApplication sharedApplication].statusBarOrientation;
self.textField.delegate = self;
[self.textField becomeFirstResponder];
}
- (void)viewDidLayoutSubviews {
if (self.statusBarOrientation !=
[UIApplication sharedApplication].statusBarOrientation) {
self.statusBarOrientation =
[UIApplication sharedApplication].statusBarOrientation;
[[NSNotificationCenter defaultCenter]
postNotificationName:@"StatusBarOrientationDidChange" object:nil];
}
}
- (void)displayText:(NSString *)text {
dispatch_async(dispatch_get_main_queue(), ^(void) {
NSString *output =
@@ -52,11 +74,75 @@
}
- (void)resetUI {
[self.textField resignFirstResponder];
self.textField.text = nil;
self.textField.hidden = NO;
self.textInstructions.hidden = NO;
self.textOutput.hidden = YES;
self.textOutput.text = nil;
self.blackView.hidden = YES;
[_remoteVideoView stop];
[_remoteVideoView removeFromSuperview];
self.remoteVideoView = nil;
[_localVideoView stop];
[_localVideoView removeFromSuperview];
self.localVideoView = nil;
}
// TODO(fischman): Use video dimensions from the incoming video stream
// and resize the Video View accordingly w.r.t. aspect ratio.
enum {
// Remote video view dimensions.
kRemoteVideoWidth = 640,
kRemoteVideoHeight = 480,
// Padding space for local video view with its parent.
kLocalViewPadding = 20
};
- (void)setupCaptureSession {
self.blackView.hidden = NO;
CGRect frame = CGRectMake((self.blackView.bounds.size.width
-kRemoteVideoWidth)/2,
(self.blackView.bounds.size.height
-kRemoteVideoHeight)/2,
kRemoteVideoWidth,
kRemoteVideoHeight);
VideoView *videoView = [[VideoView alloc] initWithFrame:frame];
videoView.isRemote = TRUE;
[self.blackView addSubview:videoView];
videoView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleBottomMargin |
UIViewAutoresizingFlexibleTopMargin;
videoView.translatesAutoresizingMaskIntoConstraints = YES;
_remoteVideoView = videoView;
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
CGFloat localVideoViewWidth =
UIInterfaceOrientationIsPortrait(self.statusBarOrientation) ?
screenSize.width/4 : screenSize.height/4;
CGFloat localVideoViewHeight =
UIInterfaceOrientationIsPortrait(self.statusBarOrientation) ?
screenSize.height/4 : screenSize.width/4;
frame = CGRectMake(self.blackView.bounds.size.width
-localVideoViewWidth-kLocalViewPadding,
kLocalViewPadding,
localVideoViewWidth,
localVideoViewHeight);
videoView = [[VideoView alloc] initWithFrame:frame];
videoView.isRemote = FALSE;
[self.blackView addSubview:videoView];
videoView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleBottomMargin |
UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth;
videoView.translatesAutoresizingMaskIntoConstraints = YES;
_localVideoView = videoView;
}
#pragma mark - UITextFieldDelegate
@@ -76,6 +162,10 @@
NSString *url =
[NSString stringWithFormat:@"apprtc://apprtc.appspot.com/?r=%@", room];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
dispatch_async(dispatch_get_main_queue(), ^{
[self setupCaptureSession];
});
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {

View File

@@ -0,0 +1,50 @@
/*
* libjingle
* Copyright 2013, Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <UIKit/UIKit.h>
@class RTCVideoTrack;
// This class encapsulates VideoRenderIosView.
@interface VideoView : UIView
// Property to get/set required video orientation.
@property(nonatomic, assign) UIInterfaceOrientation videoOrientation;
// Specifies whether the object represents a local or remote video stream.
@property(nonatomic, assign) BOOL isRemote;
// Sets up the underlying renderer and track objects.
- (void)renderVideoTrackInterface:(RTCVideoTrack*)track;
// Stops rendering.
- (void)pause;
// Starts rendering.
- (void)resume;
// Stops rendering and resets underlying renderer and track objects.
- (void)stop;
@end

View File

@@ -0,0 +1,168 @@
/*
* libjingle
* Copyright 2013, Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This VideoView must be initialzed and added to a View to get
* either the local or remote video stream rendered.
* It is a view itself and it encapsulates
* an object of VideoRenderIosView and UIActivityIndicatorView.
* Both of the views will get resized as per the frame of their parent.
*/
#import "VideoView.h"
#import "RTCVideoRenderer.h"
#import "RTCVideoTrack.h"
@interface VideoView () {
RTCVideoTrack *_track;
RTCVideoRenderer *_renderer;
}
@property (nonatomic, weak) UIView *renderView;
@property (nonatomic, weak) UIActivityIndicatorView *activityView;
@end
@implementation VideoView
@synthesize videoOrientation = _videoOrientation;
@synthesize isRemote = _isRemote;
@synthesize renderView = _renderView;
@synthesize activityView = _activityView;
static void init(VideoView *self) {
UIView *renderView = [RTCVideoRenderer newRenderViewWithFrame:
CGRectMake(0,
0,
self.bounds.size.width,
self.bounds.size.height)];
[self addSubview:renderView];
renderView.autoresizingMask = UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth;
renderView.translatesAutoresizingMaskIntoConstraints = YES;
self.renderView = renderView;
UIActivityIndicatorView *indicatorView =
[[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:
UIActivityIndicatorViewStyleWhiteLarge];
indicatorView.frame = self.bounds;
indicatorView.hidesWhenStopped = YES;
[self addSubview:indicatorView];
indicatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight;
indicatorView.translatesAutoresizingMaskIntoConstraints = YES;
[indicatorView startAnimating];
self.activityView = indicatorView;
}
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
init(self);
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
init(self);
}
return self;
}
- (UIInterfaceOrientation)videoOrientation {
return _videoOrientation;
}
- (void)setVideoOrientation:(UIInterfaceOrientation)videoOrientation {
if (_videoOrientation != videoOrientation) {
_videoOrientation = videoOrientation;
CGFloat angle;
switch (videoOrientation) {
case UIInterfaceOrientationPortrait:
angle = M_PI_2;
break;
case UIInterfaceOrientationPortraitUpsideDown:
angle = -M_PI_2;
break;
case UIInterfaceOrientationLandscapeLeft:
angle = M_PI;
break;
case UIInterfaceOrientationLandscapeRight:
angle = 0;
break;
}
// The video comes in mirrored. That is fine for the local video,
// but the remote video should be put back to original.
CGAffineTransform xform =
CGAffineTransformMakeScale([self isRemote] ? -1 : 1, 1);
xform = CGAffineTransformRotate(xform, angle);
[[self renderView] setTransform:xform];
}
}
- (void)renderVideoTrackInterface:(RTCVideoTrack *)videoTrack {
[self stop];
_track = videoTrack;
if (_track) {
if (!_renderer) {
_renderer = [[RTCVideoRenderer alloc]
initWithRenderView:[self renderView]];
}
[_track addRenderer:_renderer];
[self resume];
}
[self setVideoOrientation:UIInterfaceOrientationLandscapeLeft];
[self setVideoOrientation:UIInterfaceOrientationPortrait];
[self setVideoOrientation:UIInterfaceOrientationLandscapeLeft];
}
-(void)pause {
[_renderer stop];
}
-(void)resume {
[self.activityView stopAnimating];
[self.activityView removeFromSuperview];
self.activityView = nil;
[_renderer start];
}
- (void)stop {
[_track removeRenderer:_renderer];
[_renderer stop];
}
@end

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">12D78</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.37</string>
<string key="IBDocument.HIToolboxVersion">626.00</string>
<int key="IBDocument.SystemTarget">1536</int>
<string key="IBDocument.SystemVersion">13B42</string>
<string key="IBDocument.InterfaceBuilderVersion">4514</string>
<string key="IBDocument.AppKitVersion">1265</string>
<string key="IBDocument.HIToolboxVersion">696.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">2083</string>
<string key="NS.object.0">3747</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBNSLayoutConstraint</string>
@@ -34,7 +34,7 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="774585933">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUITextView" id="176994284">
@@ -42,7 +42,8 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {280, 141}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSNextKeyView" ref="546385578"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="634862110"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor" id="621995359">
<int key="NSColorSpace">1</int>
@@ -60,8 +61,8 @@
<int key="type">1</int>
<double key="pointSize">14</double>
</object>
<object class="NSFont" key="IBUIFont" id="371333696">
<string key="NSName">Helvetica</string>
<object class="NSFont" key="IBUIFont" id="144501234">
<string key="NSName">HelveticaNeue</string>
<double key="NSSize">14</double>
<int key="NSfFlags">16</int>
</object>
@@ -71,7 +72,8 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 180}, {280, 30}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSNextKeyView" ref="634862110"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="261050959"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -95,13 +97,15 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="166497611"/>
<reference key="IBUIFont" ref="371333696"/>
<reference key="IBUIFont" ref="144501234"/>
</object>
<object class="IBUITextView" id="634862110">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">-2147483356</int>
<string key="NSFrame">{{20, 20}, {280, 508}}</string>
<string key="NSFrame">{{20, 20}, {280, 190}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="546385578"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<reference key="IBUIBackgroundColor" ref="621995359"/>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -114,10 +118,26 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="166497611"/>
<reference key="IBUIFont" ref="371333696"/>
<reference key="IBUIFont" ref="144501234"/>
</object>
<object class="IBUIView" id="261050959">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">-2147483356</int>
<string key="NSFrame">{{20, 228}, {280, 300}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 548}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="176994284"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
@@ -140,7 +160,7 @@
</array>
</object>
<string key="IBUITargetRuntime">IBCocoaTouchFramework</string>
<string key="IBUIDisplayName">Retina 4 Full Screen</string>
<string key="IBUIDisplayName">Retina 4-inch Full Screen</string>
<int key="IBUIType">2</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -180,6 +200,14 @@
</object>
<int key="connectionID">138</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">blackView</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="261050959"/>
</object>
<int key="connectionID">151</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -204,6 +232,74 @@
<int key="objectID">6</int>
<reference key="object" ref="774585933"/>
<array class="NSMutableArray" key="children">
<object class="IBNSLayoutConstraint" id="933872207">
<reference key="firstItem" ref="774585933"/>
<int key="firstAttribute">4</int>
<int key="relation">0</int>
<reference key="secondItem" ref="261050959"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">20</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">23</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="863471211">
<reference key="firstItem" ref="261050959"/>
<int key="firstAttribute">3</int>
<int key="relation">0</int>
<reference key="secondItem" ref="774585933"/>
<int key="secondAttribute">3</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">228</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">3</int>
<float key="scoringTypeFloat">9</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="590654550">
<reference key="firstItem" ref="546385578"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="261050959"/>
<int key="secondAttribute">5</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">2</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="734153049">
<reference key="firstItem" ref="546385578"/>
<int key="firstAttribute">6</int>
<int key="relation">0</int>
<reference key="secondItem" ref="261050959"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">2</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="117610664">
<reference key="firstItem" ref="774585933"/>
<int key="firstAttribute">6</int>
@@ -216,25 +312,10 @@
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<int key="scoringType">0</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="555801739">
<reference key="firstItem" ref="546385578"/>
<int key="firstAttribute">3</int>
<int key="relation">0</int>
<reference key="secondItem" ref="774585933"/>
<int key="secondAttribute">3</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">180</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">3</int>
<float key="scoringTypeFloat">9</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="860801955">
<reference key="firstItem" ref="546385578"/>
@@ -248,9 +329,27 @@
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<int key="scoringType">0</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="544488581">
<reference key="firstItem" ref="634862110"/>
<int key="firstAttribute">4</int>
<int key="relation">0</int>
<reference key="secondItem" ref="546385578"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">2</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="19985792">
<reference key="firstItem" ref="634862110"/>
@@ -264,9 +363,10 @@
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<int key="scoringType">0</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="1001701893">
<reference key="firstItem" ref="774585933"/>
@@ -280,25 +380,10 @@
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="914503793">
<reference key="firstItem" ref="774585933"/>
<int key="firstAttribute">4</int>
<int key="relation">0</int>
<reference key="secondItem" ref="634862110"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">20</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<int key="scoringType">0</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="858545289">
<reference key="firstItem" ref="634862110"/>
@@ -312,9 +397,10 @@
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<int key="scoringType">0</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="1039342825">
<reference key="firstItem" ref="774585933"/>
@@ -328,9 +414,10 @@
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<int key="scoringType">0</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="663764352">
<reference key="firstItem" ref="176994284"/>
@@ -344,9 +431,10 @@
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<int key="scoringType">0</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<object class="IBNSLayoutConstraint" id="46028745">
<reference key="firstItem" ref="176994284"/>
@@ -360,13 +448,15 @@
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="774585933"/>
<int key="scoringType">8</int>
<int key="scoringType">0</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<bool key="placeholder">NO</bool>
</object>
<reference ref="176994284"/>
<reference ref="546385578"/>
<reference ref="634862110"/>
<reference ref="261050959"/>
</array>
<reference key="parent" ref="0"/>
</object>
@@ -389,6 +479,7 @@
<int key="scoringType">3</int>
<float key="scoringTypeFloat">9</float>
<int key="contentType">1</int>
<bool key="placeholder">NO</bool>
</object>
</array>
<reference key="parent" ref="774585933"/>
@@ -424,11 +515,6 @@
<reference key="object" ref="234302232"/>
<reference key="parent" ref="176994284"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">124</int>
<reference key="object" ref="555801739"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">126</int>
<reference key="object" ref="117610664"/>
@@ -437,7 +523,25 @@
<object class="IBObjectRecord">
<int key="objectID">128</int>
<reference key="object" ref="634862110"/>
<array class="NSMutableArray" key="children"/>
<array class="NSMutableArray" key="children">
<object class="IBNSLayoutConstraint" id="988159807">
<reference key="firstItem" ref="634862110"/>
<int key="firstAttribute">8</int>
<int key="relation">0</int>
<nil key="secondItem"/>
<int key="secondAttribute">0</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">190</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="634862110"/>
<int key="scoringType">3</int>
<float key="scoringTypeFloat">9</float>
<int key="contentType">1</int>
<bool key="placeholder">NO</bool>
</object>
</array>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
@@ -445,11 +549,6 @@
<reference key="object" ref="858545289"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">136</int>
<reference key="object" ref="914503793"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">137</int>
<reference key="object" ref="1001701893"/>
@@ -460,6 +559,41 @@
<reference key="object" ref="19985792"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">141</int>
<reference key="object" ref="988159807"/>
<reference key="parent" ref="634862110"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">142</int>
<reference key="object" ref="261050959"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">148</int>
<reference key="object" ref="734153049"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">149</int>
<reference key="object" ref="590654550"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">153</int>
<reference key="object" ref="863471211"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">154</int>
<reference key="object" ref="933872207"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">155</int>
<reference key="object" ref="544488581"/>
<reference key="parent" ref="774585933"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -471,31 +605,43 @@
<boolean value="NO" key="104.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="107.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="123.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="124.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="126.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="128.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<array key="128.IBViewMetadataConstraints">
<reference ref="988159807"/>
</array>
<boolean value="NO" key="128.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="133.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="136.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="137.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="139.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="141.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="142.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<boolean value="NO" key="142.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="148.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="149.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="153.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="154.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="155.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="57.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<array class="NSMutableArray" key="57.IBViewMetadataConstraints">
<reference ref="234302232"/>
</array>
<boolean value="NO" key="57.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<array key="6.IBViewMetadataConstraints">
<array class="NSMutableArray" key="6.IBViewMetadataConstraints">
<reference ref="46028745"/>
<reference ref="663764352"/>
<reference ref="1039342825"/>
<reference ref="858545289"/>
<reference ref="914503793"/>
<reference ref="1001701893"/>
<reference ref="19985792"/>
<reference ref="544488581"/>
<reference ref="860801955"/>
<reference ref="555801739"/>
<reference ref="117610664"/>
<reference ref="734153049"/>
<reference ref="590654550"/>
<reference ref="863471211"/>
<reference ref="933872207"/>
</array>
<string key="62.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="63.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -505,10 +651,42 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">139</int>
<int key="maxID">155</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">APPRTCViewController</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="blackView">UIView</string>
<string key="textField">UITextField</string>
<string key="textInstructions">UITextView</string>
<string key="textOutput">UITextView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="blackView">
<string key="name">blackView</string>
<string key="candidateClassName">UIView</string>
</object>
<object class="IBToOneOutletInfo" key="textField">
<string key="name">textField</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo" key="textInstructions">
<string key="name">textInstructions</string>
<string key="candidateClassName">UITextView</string>
</object>
<object class="IBToOneOutletInfo" key="textOutput">
<string key="name">textOutput</string>
<string key="candidateClassName">UITextView</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/APPRTCViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSLayoutConstraint</string>
<string key="superclassName">NSObject</string>
@@ -521,9 +699,18 @@
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1536" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="4600" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<bool key="IBDocument.UseAutolayout">YES</bool>
<string key="IBCocoaTouchPluginVersion">2083</string>
<string key="IBCocoaTouchPluginVersion">3747</string>
</data>
</archive>

View File

@@ -251,12 +251,15 @@
'examples/ios/AppRTCDemo/AppRTCDemo-Prefix.pch',
'examples/ios/AppRTCDemo/GAEChannelClient.h',
'examples/ios/AppRTCDemo/GAEChannelClient.m',
'examples/ios/AppRTCDemo/VideoView.h',
'examples/ios/AppRTCDemo/VideoView.m',
'examples/ios/AppRTCDemo/main.m',
],
'xcode_settings': {
'CLANG_ENABLE_OBJC_ARC': 'YES',
'INFOPLIST_FILE': 'examples/ios/AppRTCDemo/Info.plist',
'OTHER_LDFLAGS': [
'-framework CoreGraphics',
'-framework Foundation',
'-framework UIKit',
],

View File

@@ -39,8 +39,6 @@
#include "talk/media/devices/filevideocapturer.h"
#include "talk/media/devices/yuvframescapturer.h"
#if !defined(IOS)
#if defined(HAVE_WEBRTC_VIDEO)
#include "talk/media/webrtc/webrtcvideocapturer.h"
#endif
@@ -51,8 +49,6 @@
#endif
#endif
namespace {
bool StringMatchWithWildcard(
@@ -216,10 +212,6 @@ void DeviceManager::ClearVideoCaptureDeviceMaxFormat(
}
VideoCapturer* DeviceManager::CreateVideoCapturer(const Device& device) const {
#if defined(IOS)
LOG_F(LS_ERROR) << " should never be called!";
return NULL;
#else
VideoCapturer* capturer = ConstructFakeVideoCapturer(device);
if (capturer) {
return capturer;
@@ -237,7 +229,6 @@ VideoCapturer* DeviceManager::CreateVideoCapturer(const Device& device) const {
capturer->ConstrainSupportedFormats(video_format);
}
return capturer;
#endif
}
VideoCapturer* DeviceManager::ConstructFakeVideoCapturer(

View File

@@ -190,11 +190,15 @@ bool WebRtcVideoCapturer::Init(const Device& device) {
}
}
factory_->DestroyDeviceInfo(info);
// TODO(fischman): Remove the following check
// when capabilities for iOS are implemented
// https://code.google.com/p/webrtc/issues/detail?id=2968
#if !defined(IOS)
if (supported.empty()) {
LOG(LS_ERROR) << "Failed to find usable formats for id: " << device.id;
return false;
}
#endif
module_ = factory_->Create(0, vcm_id);
if (!module_) {
LOG(LS_ERROR) << "Failed to create capturer for id: " << device.id;