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

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

Issue 1888633002: Added the API to create an RTCRtpSender to the Objective C wrapper. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Code review feedback Created 4 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
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import "RTCRtpSender+Private.h" 11 #import "RTCRtpSender+Private.h"
12 12
13 #import "NSString+StdString.h"
13 #import "RTCMediaStreamTrack+Private.h" 14 #import "RTCMediaStreamTrack+Private.h"
14 #import "RTCRtpParameters+Private.h" 15 #import "RTCRtpParameters+Private.h"
16 #import "WebRTC/RTCLogging.h"
15 17
16 #include "webrtc/api/mediastreaminterface.h" 18 #include "webrtc/api/mediastreaminterface.h"
17 19
18 @implementation RTCRtpSender { 20 @implementation RTCRtpSender {
19 rtc::scoped_refptr<webrtc::RtpSenderInterface> _nativeRtpSender; 21 rtc::scoped_refptr<webrtc::RtpSenderInterface> _nativeRtpSender;
20 } 22 }
21 23
22 - (instancetype)initWithNativeRtpSender: 24 - (instancetype)initWithNativeRtpSender:
23 (rtc::scoped_refptr<webrtc::RtpSenderInterface>)nativeRtpSender { 25 (rtc::scoped_refptr<webrtc::RtpSenderInterface>)nativeRtpSender {
24 if (self = [super init]) { 26 if (self = [super init]) {
tkchin_webrtc 2016/04/27 23:13:43 nit: assert nativeRtpSender not nil
25 _nativeRtpSender = nativeRtpSender; 27 _nativeRtpSender = nativeRtpSender;
28 RTCLogInfo(@"RTCRtpSender(%p): created sender: %@", self, self.description);
26 } 29 }
27 return self; 30 return self;
28 } 31 }
29 32
33 - (NSString *)senderId {
34 return [NSString stringForStdString:_nativeRtpSender->id()];
35 }
36
30 - (RTCRtpParameters *)parameters { 37 - (RTCRtpParameters *)parameters {
31 return [[RTCRtpParameters alloc] 38 return [[RTCRtpParameters alloc]
32 initWithNativeParameters:_nativeRtpSender->GetParameters()]; 39 initWithNativeParameters:_nativeRtpSender->GetParameters()];
33 } 40 }
34 41
35 - (BOOL)setParameters:(RTCRtpParameters *)parameters { 42 - (void)setParameters:(RTCRtpParameters *)parameters {
36 return _nativeRtpSender->SetParameters(parameters.nativeParameters); 43 if (!_nativeRtpSender->SetParameters(parameters.nativeParameters)) {
44 RTCLogError(@"RTCRtpSender(%p): Failed to set parameters: %@", self,
45 parameters);
46 }
37 } 47 }
38 48
39 - (RTCMediaStreamTrack *)track { 49 - (RTCMediaStreamTrack *)track {
40 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack( 50 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack(
41 _nativeRtpSender->track()); 51 _nativeRtpSender->track());
42 if (nativeTrack) { 52 if (nativeTrack) {
43 return [[RTCMediaStreamTrack alloc] initWithNativeTrack:nativeTrack]; 53 return [[RTCMediaStreamTrack alloc] initWithNativeTrack:nativeTrack];
44 } 54 }
45 return nil; 55 return nil;
46 } 56 }
47 57
58 - (void)setTrack:(RTCMediaStreamTrack *)track {
59 if (!_nativeRtpSender->SetTrack(track.nativeTrack)) {
60 RTCLogError(@"RTCRtpSender(%p): Failed to set track %@", self, track);
61 }
62 }
63
64 - (NSString *)description {
65 return [NSString stringWithFormat:@"RTCRtpSender {\n senderId: %@\n}",
66 self.senderId];
67 }
68
48 @end 69 @end
OLDNEW
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm ('k') | webrtc/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698