blob: 71030029adf4005792f535e89d679fe20c591c06 [file] [log] [blame]
skvlad79b4b872016-04-08 17:28:55 -07001/*
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
tkchin9eeb6242016-04-27 01:54:20 -070011#import "RTCRtpSender+Private.h"
skvlad79b4b872016-04-08 17:28:55 -070012
tkchin9eeb6242016-04-27 01:54:20 -070013#import "RTCMediaStreamTrack+Private.h"
14#import "RTCRtpParameters+Private.h"
skvlad79b4b872016-04-08 17:28:55 -070015
16#include "webrtc/api/mediastreaminterface.h"
skvlad79b4b872016-04-08 17:28:55 -070017
18@implementation RTCRtpSender {
19 rtc::scoped_refptr<webrtc::RtpSenderInterface> _nativeRtpSender;
20}
21
22- (instancetype)initWithNativeRtpSender:
23 (rtc::scoped_refptr<webrtc::RtpSenderInterface>)nativeRtpSender {
24 if (self = [super init]) {
25 _nativeRtpSender = nativeRtpSender;
26 }
27 return self;
28}
29
30- (RTCRtpParameters *)parameters {
31 return [[RTCRtpParameters alloc]
32 initWithNativeParameters:_nativeRtpSender->GetParameters()];
33}
34
35- (BOOL)setParameters:(RTCRtpParameters *)parameters {
36 return _nativeRtpSender->SetParameters(parameters.nativeParameters);
37}
38
39- (RTCMediaStreamTrack *)track {
40 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack(
41 _nativeRtpSender->track());
42 if (nativeTrack) {
43 return [[RTCMediaStreamTrack alloc] initWithNativeTrack:nativeTrack];
44 }
45 return nil;
46}
47
48@end