aboutsummaryrefslogtreecommitdiff
path: root/sdk
diff options
context:
space:
mode:
authorDanilo Bargen <danilo.bargen@threema.ch>2020-05-14 12:41:53 +0000
committerCommit Bot <commit-bot@chromium.org>2020-05-14 13:26:01 +0000
commit87a6e5ab4d8f0baf4e2a9b7752b43d825f9c0ce1 (patch)
tree1c0b82e135db14ce7b679cdd6d4d50695910f163 /sdk
parent475006d4a30f8bc47f82eb540a6a066da2829095 (diff)
downloadwebrtc-87a6e5ab4d8f0baf4e2a9b7752b43d825f9c0ce1.tar.gz
objc: Export RTCStatistics and RTCStatisticsReport
These two types need to be exported in order to access the stats report from an ObjC / Swift codebase. Bug: webrtc:11158 Change-Id: Ibb2f81f289b56f824f02df70971c28accd5a1350 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174900 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31257}
Diffstat (limited to 'sdk')
-rw-r--r--sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm3
-rw-r--r--sdk/objc/api/peerconnection/RTCPeerConnection.h4
-rw-r--r--sdk/objc/api/peerconnection/RTCStatisticsReport+Private.h4
-rw-r--r--sdk/objc/api/peerconnection/RTCStatisticsReport.h12
-rw-r--r--sdk/objc/api/peerconnection/RTCStatisticsReport.mm11
5 files changed, 20 insertions, 14 deletions
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm b/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm
index 46a6e3c780..8ded55200e 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm
+++ b/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm
@@ -28,7 +28,8 @@ class StatsCollectorCallbackAdapter : public RTCStatsCollectorCallback {
void OnStatsDelivered(const rtc::scoped_refptr<const RTCStatsReport> &report) override {
RTC_DCHECK(completion_handler_);
- RTCStatisticsReport *statisticsReport = [[RTCStatisticsReport alloc] initWithReport:*report];
+ RTC_OBJC_TYPE(RTCStatisticsReport) *statisticsReport =
+ [[RTC_OBJC_TYPE(RTCStatisticsReport) alloc] initWithReport:*report];
completion_handler_(statisticsReport);
completion_handler_ = nil;
}
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection.h b/sdk/objc/api/peerconnection/RTCPeerConnection.h
index cfc0a3d824..bb8d87bc2d 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnection.h
+++ b/sdk/objc/api/peerconnection/RTCPeerConnection.h
@@ -25,7 +25,7 @@
@class RTC_OBJC_TYPE(RTCRtpTransceiver);
@class RTC_OBJC_TYPE(RTCRtpTransceiverInit);
@class RTC_OBJC_TYPE(RTCSessionDescription);
-@class RTCStatisticsReport;
+@class RTC_OBJC_TYPE(RTCStatisticsReport);
@class RTC_OBJC_TYPE(RTCLegacyStatsReport);
typedef NS_ENUM(NSInteger, RTCRtpMediaType);
@@ -341,7 +341,7 @@ RTC_OBJC_EXPORT
@end
-typedef void (^RTCStatisticsCompletionHandler)(RTCStatisticsReport *);
+typedef void (^RTCStatisticsCompletionHandler)(RTC_OBJC_TYPE(RTCStatisticsReport) *);
@interface RTC_OBJC_TYPE (RTCPeerConnection)
(Stats)
diff --git a/sdk/objc/api/peerconnection/RTCStatisticsReport+Private.h b/sdk/objc/api/peerconnection/RTCStatisticsReport+Private.h
index 0220d186b7..47c5241d51 100644
--- a/sdk/objc/api/peerconnection/RTCStatisticsReport+Private.h
+++ b/sdk/objc/api/peerconnection/RTCStatisticsReport+Private.h
@@ -12,8 +12,8 @@
#include "api/stats/rtc_stats_report.h"
-@interface RTCStatisticsReport (Private)
+@interface RTC_OBJC_TYPE (RTCStatisticsReport) (Private)
-- (instancetype)initWithReport:(const webrtc::RTCStatsReport &)report;
+- (instancetype)initWithReport : (const webrtc::RTCStatsReport &)report;
@end
diff --git a/sdk/objc/api/peerconnection/RTCStatisticsReport.h b/sdk/objc/api/peerconnection/RTCStatisticsReport.h
index 6fbd59b112..38d93e8771 100644
--- a/sdk/objc/api/peerconnection/RTCStatisticsReport.h
+++ b/sdk/objc/api/peerconnection/RTCStatisticsReport.h
@@ -10,25 +10,29 @@
#import <Foundation/Foundation.h>
-@class RTCStatistics;
+#import "RTCMacros.h"
+
+@class RTC_OBJC_TYPE(RTCStatistics);
NS_ASSUME_NONNULL_BEGIN
/** A statistics report. Encapsulates a number of RTCStatistics objects. */
-@interface RTCStatisticsReport : NSObject
+RTC_OBJC_EXPORT
+@interface RTC_OBJC_TYPE (RTCStatisticsReport) : NSObject
/** The timestamp of the report in microseconds since 1970-01-01T00:00:00Z. */
@property(nonatomic, readonly) CFTimeInterval timestamp_us;
/** RTCStatistics objects by id. */
-@property(nonatomic, readonly) NSDictionary<NSString *, RTCStatistics *> *statistics;
+@property(nonatomic, readonly) NSDictionary<NSString *, RTC_OBJC_TYPE(RTCStatistics) *> *statistics;
- (instancetype)init NS_UNAVAILABLE;
@end
/** A part of a report (a subreport) covering a certain area. */
-@interface RTCStatistics : NSObject
+RTC_OBJC_EXPORT
+@interface RTC_OBJC_TYPE (RTCStatistics) : NSObject
/** The id of this subreport, e.g. "RTCMediaStreamTrack_receiver_2". */
@property(nonatomic, readonly) NSString *id;
diff --git a/sdk/objc/api/peerconnection/RTCStatisticsReport.mm b/sdk/objc/api/peerconnection/RTCStatisticsReport.mm
index 526976707d..ab8006d9bd 100644
--- a/sdk/objc/api/peerconnection/RTCStatisticsReport.mm
+++ b/sdk/objc/api/peerconnection/RTCStatisticsReport.mm
@@ -100,7 +100,7 @@ NSObject *ValueFromStatsMember(const RTCStatsMemberInterface *member) {
}
} // namespace webrtc
-@implementation RTCStatistics
+@implementation RTC_OBJC_TYPE (RTCStatistics)
@synthesize id = _id;
@synthesize timestamp_us = _timestamp_us;
@@ -139,7 +139,7 @@ NSObject *ValueFromStatsMember(const RTCStatsMemberInterface *member) {
@end
-@implementation RTCStatisticsReport
+@implementation RTC_OBJC_TYPE (RTCStatisticsReport)
@synthesize timestamp_us = _timestamp_us;
@synthesize statistics = _statistics;
@@ -151,16 +151,17 @@ NSObject *ValueFromStatsMember(const RTCStatsMemberInterface *member) {
@end
-@implementation RTCStatisticsReport (Private)
+@implementation RTC_OBJC_TYPE (RTCStatisticsReport) (Private)
-- (instancetype)initWithReport:(const webrtc::RTCStatsReport &)report {
+- (instancetype)initWithReport : (const webrtc::RTCStatsReport &)report {
if (self = [super init]) {
_timestamp_us = report.timestamp_us();
NSMutableDictionary *statisticsById =
[NSMutableDictionary dictionaryWithCapacity:report.size()];
for (const auto &stat : report) {
- RTCStatistics *statistics = [[RTCStatistics alloc] initWithStatistics:stat];
+ RTC_OBJC_TYPE(RTCStatistics) *statistics =
+ [[RTC_OBJC_TYPE(RTCStatistics) alloc] initWithStatistics:stat];
statisticsById[statistics.id] = statistics;
}
_statistics = [statisticsById copy];