summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authortkchin@webrtc.org <tkchin@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-04-22 21:05:38 +0000
committertkchin@webrtc.org <tkchin@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-04-22 21:05:38 +0000
commit664ec031431b37eade6e400dadfd1709e7494fc1 (patch)
tree96b92ea892e82fcc2d204cd4d031ffcc7f0fe792 /examples
parentaf6b980518ad509b79581f816cead6a7b9ade220 (diff)
downloadtalk-664ec031431b37eade6e400dadfd1709e7494fc1.tar.gz
Provide GetStats method in RTCPeerConnection
BUG=3144 R=fischman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12069006 git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@5960 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'examples')
-rw-r--r--examples/ios/AppRTCDemo/APPRTCAppDelegate.m35
1 files changed, 33 insertions, 2 deletions
diff --git a/examples/ios/AppRTCDemo/APPRTCAppDelegate.m b/examples/ios/AppRTCDemo/APPRTCAppDelegate.m
index e6add76..2ed8ff2 100644
--- a/examples/ios/AppRTCDemo/APPRTCAppDelegate.m
+++ b/examples/ios/AppRTCDemo/APPRTCAppDelegate.m
@@ -39,6 +39,7 @@
#import "RTCPeerConnectionDelegate.h"
#import "RTCPeerConnectionFactory.h"
#import "RTCSessionDescription.h"
+#import "RTCStatsDelegate.h"
#import "RTCVideoRenderer.h"
#import "RTCVideoCapturer.h"
#import "RTCVideoTrack.h"
@@ -63,6 +64,8 @@
return self;
}
+#pragma mark - RTCPeerConnectionDelegate
+
- (void)peerConnectionOnError:(RTCPeerConnection*)peerConnection {
dispatch_async(dispatch_get_main_queue(), ^(void) {
NSLog(@"PCO onError.");
@@ -147,13 +150,15 @@
});
}
+#pragma mark - Private
+
- (void)displayLogMessage:(NSString*)message {
[_delegate displayLogMessage:message];
}
@end
-@interface APPRTCAppDelegate ()
+@interface APPRTCAppDelegate () <RTCStatsDelegate>
@property(nonatomic, strong) APPRTCAppClient* client;
@property(nonatomic, strong) PCObserver* pcObserver;
@@ -163,7 +168,9 @@
@end
-@implementation APPRTCAppDelegate
+@implementation APPRTCAppDelegate {
+ NSTimer* _statsTimer;
+}
#pragma mark - UIApplicationDelegate methods
@@ -175,6 +182,12 @@
[[APPRTCViewController alloc] initWithNibName:@"APPRTCViewController"
bundle:nil];
self.window.rootViewController = self.viewController;
+ _statsTimer =
+ [NSTimer scheduledTimerWithTimeInterval:10
+ target:self
+ selector:@selector(didFireStatsTimer:)
+ userInfo:nil
+ repeats:YES];
[self.window makeKeyAndVisible];
return YES;
}
@@ -488,6 +501,16 @@
});
}
+#pragma mark - RTCStatsDelegate methods
+
+- (void)peerConnection:(RTCPeerConnection*)peerConnection
+ didGetStats:(NSArray*)stats {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSString* message = [NSString stringWithFormat:@"Stats:\n %@", stats];
+ [self displayLogMessage:message];
+ });
+}
+
#pragma mark - internal methods
- (void)disconnect {
@@ -531,6 +554,14 @@
return removeBackslash;
}
+- (void)didFireStatsTimer:(NSTimer *)timer {
+ if (self.peerConnection) {
+ [self.peerConnection getStatsWithDelegate:self
+ mediaStreamTrack:nil
+ statsOutputLevel:RTCStatsOutputLevelDebug];
+ }
+}
+
#pragma mark - public methods
- (void)closeVideoUI {