Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCRtpSender.mm

Issue 2890513002: Revert of Split iOS sdk in to separate targets (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
11 #import "RTCRtpSender+Private.h"
12
13 #import "NSString+StdString.h"
14 #import "RTCMediaStreamTrack+Private.h"
15 #import "RTCRtpParameters+Private.h"
16 #import "WebRTC/RTCLogging.h"
17
18 #include "webrtc/api/mediastreaminterface.h"
19
20 @implementation RTCRtpSender {
21 rtc::scoped_refptr<webrtc::RtpSenderInterface> _nativeRtpSender;
22 }
23
24 - (NSString *)senderId {
25 return [NSString stringForStdString:_nativeRtpSender->id()];
26 }
27
28 - (RTCRtpParameters *)parameters {
29 return [[RTCRtpParameters alloc]
30 initWithNativeParameters:_nativeRtpSender->GetParameters()];
31 }
32
33 - (void)setParameters:(RTCRtpParameters *)parameters {
34 if (!_nativeRtpSender->SetParameters(parameters.nativeParameters)) {
35 RTCLogError(@"RTCRtpSender(%p): Failed to set parameters: %@", self,
36 parameters);
37 }
38 }
39
40 - (RTCMediaStreamTrack *)track {
41 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack(
42 _nativeRtpSender->track());
43 if (nativeTrack) {
44 return [[RTCMediaStreamTrack alloc] initWithNativeTrack:nativeTrack];
45 }
46 return nil;
47 }
48
49 - (void)setTrack:(RTCMediaStreamTrack *)track {
50 if (!_nativeRtpSender->SetTrack(track.nativeTrack)) {
51 RTCLogError(@"RTCRtpSender(%p): Failed to set track %@", self, track);
52 }
53 }
54
55 - (NSString *)description {
56 return [NSString stringWithFormat:@"RTCRtpSender {\n senderId: %@\n}",
57 self.senderId];
58 }
59
60 - (BOOL)isEqual:(id)object {
61 if (self == object) {
62 return YES;
63 }
64 if (object == nil) {
65 return NO;
66 }
67 if (![object isMemberOfClass:[self class]]) {
68 return NO;
69 }
70 RTCRtpSender *sender = (RTCRtpSender *)object;
71 return _nativeRtpSender == sender.nativeRtpSender;
72 }
73
74 - (NSUInteger)hash {
75 return (NSUInteger)_nativeRtpSender.get();
76 }
77
78 #pragma mark - Private
79
80 - (rtc::scoped_refptr<webrtc::RtpSenderInterface>)nativeRtpSender {
81 return _nativeRtpSender;
82 }
83
84 - (instancetype)initWithNativeRtpSender:
85 (rtc::scoped_refptr<webrtc::RtpSenderInterface>)nativeRtpSender {
86 NSParameterAssert(nativeRtpSender);
87 if (self = [super init]) {
88 _nativeRtpSender = nativeRtpSender;
89 RTCLogInfo(@"RTCRtpSender(%p): created sender: %@", self, self.description);
90 }
91 return self;
92 }
93
94 @end
OLDNEW
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCRtpReceiver+Private.h ('k') | webrtc/sdk/objc/Framework/Classes/RTCRtpSender+Private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698