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

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: Rebased to the new directory structure 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]) {
25 _nativeRtpSender = nativeRtpSender; 27 _nativeRtpSender = nativeRtpSender;
26 } 28 }
27 return self; 29 return self;
28 } 30 }
29 31
32 - (NSString *)senderId {
33 return [NSString stringForStdString:_nativeRtpSender->id()];
34 }
35
30 - (RTCRtpParameters *)parameters { 36 - (RTCRtpParameters *)parameters {
31 return [[RTCRtpParameters alloc] 37 return [[RTCRtpParameters alloc]
32 initWithNativeParameters:_nativeRtpSender->GetParameters()]; 38 initWithNativeParameters:_nativeRtpSender->GetParameters()];
33 } 39 }
34 40
35 - (BOOL)setParameters:(RTCRtpParameters *)parameters { 41 - (void)setParameters:(RTCRtpParameters *)parameters {
36 return _nativeRtpSender->SetParameters(parameters.nativeParameters); 42 if (!_nativeRtpSender->SetParameters(parameters.nativeParameters)) {
43 RTCLogError(@"Failed to set parameters %@ for %@", parameters, self);
tkchin_webrtc 2016/04/27 20:22:20 maybe what we want here is the pointer? e.g RTCRtp
skvlad 2016/04/27 23:00:58 I've made it print the pointer here, and the descr
tkchin_webrtc 2016/04/27 23:13:43 Yes, after self is available it's safe to access p
44 }
37 } 45 }
38 46
39 - (RTCMediaStreamTrack *)track { 47 - (RTCMediaStreamTrack *)track {
40 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack( 48 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack(
41 _nativeRtpSender->track()); 49 _nativeRtpSender->track());
42 if (nativeTrack) { 50 if (nativeTrack) {
43 return [[RTCMediaStreamTrack alloc] initWithNativeTrack:nativeTrack]; 51 return [[RTCMediaStreamTrack alloc] initWithNativeTrack:nativeTrack];
44 } 52 }
45 return nil; 53 return nil;
46 } 54 }
47 55
56 - (void)setTrack:(RTCMediaStreamTrack *)track {
57 if (!_nativeRtpSender->SetTrack(track.nativeTrack)) {
58 RTCLogError(@"Failed to set track %@ for %@", track, self);
59 }
60 }
61
62 - (NSString *)description {
63 return [NSString stringWithFormat:@"RTCRtpSender:%@", self.senderId];
tkchin_webrtc 2016/04/27 20:22:20 nit: I've been trying to make our descriptions loo
skvlad 2016/04/27 23:00:58 All the descriptions I've found are formatted like
tkchin_webrtc 2016/04/27 23:13:43 Acknowledged.
64 }
65
48 @end 66 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698