You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright 2016 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #import "RTCMetricsSampleInfo+Private.h"
  11. #import "helpers/NSString+StdString.h"
  12. @implementation RTCMetricsSampleInfo
  13. @synthesize name = _name;
  14. @synthesize min = _min;
  15. @synthesize max = _max;
  16. @synthesize bucketCount = _bucketCount;
  17. @synthesize samples = _samples;
  18. #pragma mark - Private
  19. - (instancetype)initWithNativeSampleInfo:
  20. (const webrtc::metrics::SampleInfo &)info {
  21. if (self = [super init]) {
  22. _name = [NSString stringForStdString:info.name];
  23. _min = info.min;
  24. _max = info.max;
  25. _bucketCount = info.bucket_count;
  26. NSMutableDictionary *samples =
  27. [NSMutableDictionary dictionaryWithCapacity:info.samples.size()];
  28. for (auto const &sample : info.samples) {
  29. [samples setObject:@(sample.second) forKey:@(sample.first)];
  30. }
  31. _samples = samples;
  32. }
  33. return self;
  34. }
  35. @end