Adding GetStats APIs for senders/receivers.
Bug: webrtc:10345 Change-Id: Id9c10db91d94323ffe8b9e4e540411837d56aaa4 Reviewed-on: https://webrtc-review.googlesource.com/c/124493 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Peter Hanspers <peterhanspers@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26867}
This commit is contained in:

committed by
Commit Bot

parent
7b3f4a2035
commit
e12a1c7644
@ -12,6 +12,8 @@
|
||||
|
||||
#import "RTCLegacyStatsReport+Private.h"
|
||||
#import "RTCMediaStreamTrack+Private.h"
|
||||
#import "RTCRtpReceiver+Private.h"
|
||||
#import "RTCRtpSender+Private.h"
|
||||
#import "RTCStatisticsReport+Private.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@ -63,6 +65,20 @@ class StatsObserverAdapter : public StatsObserver {
|
||||
|
||||
@implementation RTCPeerConnection (Stats)
|
||||
|
||||
- (void)statisticsForSender:(RTCRtpSender *)sender
|
||||
completionHandler:(RTCStatisticsCompletionHandler)completionHandler {
|
||||
rtc::scoped_refptr<webrtc::StatsCollectorCallbackAdapter> collector(
|
||||
new rtc::RefCountedObject<webrtc::StatsCollectorCallbackAdapter>(completionHandler));
|
||||
self.nativePeerConnection->GetStats(sender.nativeRtpSender, collector);
|
||||
}
|
||||
|
||||
- (void)statisticsForReceiver:(RTCRtpReceiver *)receiver
|
||||
completionHandler:(RTCStatisticsCompletionHandler)completionHandler {
|
||||
rtc::scoped_refptr<webrtc::StatsCollectorCallbackAdapter> collector(
|
||||
new rtc::RefCountedObject<webrtc::StatsCollectorCallbackAdapter>(completionHandler));
|
||||
self.nativePeerConnection->GetStats(receiver.nativeRtpReceiver, collector);
|
||||
}
|
||||
|
||||
- (void)statisticsWithCompletionHandler:(RTCStatisticsCompletionHandler)completionHandler {
|
||||
rtc::scoped_refptr<webrtc::StatsCollectorCallbackAdapter> collector(
|
||||
new rtc::RefCountedObject<webrtc::StatsCollectorCallbackAdapter>(completionHandler));
|
||||
|
@ -331,6 +331,18 @@ typedef void (^RTCStatisticsCompletionHandler)(RTCStatisticsReport *);
|
||||
/** Gather statistic through the v2 statistics API. */
|
||||
- (void)statisticsWithCompletionHandler:(RTCStatisticsCompletionHandler)completionHandler;
|
||||
|
||||
/** Spec-compliant getStats() performing the stats selection algorithm with the
|
||||
* sender.
|
||||
*/
|
||||
- (void)statisticsForSender:(RTCRtpSender *)sender
|
||||
completionHandler:(RTCStatisticsCompletionHandler)completionHandler;
|
||||
|
||||
/** Spec-compliant getStats() performing the stats selection algorithm with the
|
||||
* receiver.
|
||||
*/
|
||||
- (void)statisticsForReceiver:(RTCRtpReceiver *)receiver
|
||||
completionHandler:(RTCStatisticsCompletionHandler)completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
Reference in New Issue
Block a user