xref: /aosp_15_r20/external/webrtc/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1/*
2 *  Copyright 2018 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
11#import "RTCRtpHeaderExtension+Private.h"
12
13#import "helpers/NSString+StdString.h"
14
15@implementation RTC_OBJC_TYPE (RTCRtpHeaderExtension)
16
17@synthesize uri = _uri;
18@synthesize id = _id;
19@synthesize encrypted = _encrypted;
20
21- (instancetype)init {
22  webrtc::RtpExtension nativeExtension;
23  return [self initWithNativeParameters:nativeExtension];
24}
25
26- (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters {
27  if (self = [super init]) {
28    _uri = [NSString stringForStdString:nativeParameters.uri];
29    _id = nativeParameters.id;
30    _encrypted = nativeParameters.encrypt;
31  }
32  return self;
33}
34
35- (webrtc::RtpExtension)nativeParameters {
36  webrtc::RtpExtension extension;
37  extension.uri = [NSString stdStringForString:_uri];
38  extension.id = _id;
39  extension.encrypt = _encrypted;
40  return extension;
41}
42
43@end
44