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

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: Added constants for Audio and Video 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 {
26 NSParameterAssert(nativeRtpSender);
24 if (self = [super init]) { 27 if (self = [super init]) {
25 _nativeRtpSender = nativeRtpSender; 28 _nativeRtpSender = nativeRtpSender;
29 RTCLogInfo(@"RTCRtpSender(%p): created sender: %@", self, self.description);
26 } 30 }
27 return self; 31 return self;
28 } 32 }
29 33
34 - (NSString *)senderId {
35 return [NSString stringForStdString:_nativeRtpSender->id()];
36 }
37
30 - (RTCRtpParameters *)parameters { 38 - (RTCRtpParameters *)parameters {
31 return [[RTCRtpParameters alloc] 39 return [[RTCRtpParameters alloc]
32 initWithNativeParameters:_nativeRtpSender->GetParameters()]; 40 initWithNativeParameters:_nativeRtpSender->GetParameters()];
33 } 41 }
34 42
35 - (BOOL)setParameters:(RTCRtpParameters *)parameters { 43 - (void)setParameters:(RTCRtpParameters *)parameters {
36 return _nativeRtpSender->SetParameters(parameters.nativeParameters); 44 if (!_nativeRtpSender->SetParameters(parameters.nativeParameters)) {
45 RTCLogError(@"RTCRtpSender(%p): Failed to set parameters: %@", self,
46 parameters);
47 }
37 } 48 }
38 49
39 - (RTCMediaStreamTrack *)track { 50 - (RTCMediaStreamTrack *)track {
40 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack( 51 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack(
41 _nativeRtpSender->track()); 52 _nativeRtpSender->track());
42 if (nativeTrack) { 53 if (nativeTrack) {
43 return [[RTCMediaStreamTrack alloc] initWithNativeTrack:nativeTrack]; 54 return [[RTCMediaStreamTrack alloc] initWithNativeTrack:nativeTrack];
44 } 55 }
45 return nil; 56 return nil;
46 } 57 }
47 58
59 - (void)setTrack:(RTCMediaStreamTrack *)track {
60 if (!_nativeRtpSender->SetTrack(track.nativeTrack)) {
61 RTCLogError(@"RTCRtpSender(%p): Failed to set track %@", self, track);
62 }
63 }
64
65 - (NSString *)description {
66 return [NSString stringWithFormat:@"RTCRtpSender {\n senderId: %@\n}",
67 self.senderId];
68 }
69
48 @end 70 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698