OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 RTCDataBuffer* dataBuffer = | 50 RTCDataBuffer* dataBuffer = |
51 [[RTCDataBuffer alloc] initWithDataBuffer:buffer]; | 51 [[RTCDataBuffer alloc] initWithDataBuffer:buffer]; |
52 [_channel.delegate channel:_channel didReceiveMessageWithBuffer:dataBuffer]; | 52 [_channel.delegate channel:_channel didReceiveMessageWithBuffer:dataBuffer]; |
53 } | 53 } |
54 | 54 |
55 private: | 55 private: |
56 __weak RTCDataChannel* _channel; | 56 __weak RTCDataChannel* _channel; |
57 }; | 57 }; |
58 } | 58 } |
59 | 59 |
60 // TODO(tkchin): move to shared location | 60 // TODO(henrika): move to shared location. |
| 61 // See https://code.google.com/p/webrtc/issues/detail?id=4773 for details. |
61 NSString* NSStringFromStdString(const std::string& stdString) { | 62 NSString* NSStringFromStdString(const std::string& stdString) { |
62 // std::string may contain null termination character so we construct | 63 // std::string may contain null termination character so we construct |
63 // using length. | 64 // using length. |
64 return [[NSString alloc] initWithBytes:stdString.data() | 65 return [[NSString alloc] initWithBytes:stdString.data() |
65 length:stdString.length() | 66 length:stdString.length() |
66 encoding:NSUTF8StringEncoding]; | 67 encoding:NSUTF8StringEncoding]; |
67 } | 68 } |
68 | 69 |
69 std::string StdStringFromNSString(NSString* nsString) { | 70 std::string StdStringFromNSString(NSString* nsString) { |
70 NSData* charData = [nsString dataUsingEncoding:NSUTF8StringEncoding]; | 71 NSData* charData = [nsString dataUsingEncoding:NSUTF8StringEncoding]; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 _observer.reset(new webrtc::RTCDataChannelObserver(self)); | 272 _observer.reset(new webrtc::RTCDataChannelObserver(self)); |
272 } | 273 } |
273 return self; | 274 return self; |
274 } | 275 } |
275 | 276 |
276 - (rtc::scoped_refptr<webrtc::DataChannelInterface>)dataChannel { | 277 - (rtc::scoped_refptr<webrtc::DataChannelInterface>)dataChannel { |
277 return _dataChannel; | 278 return _dataChannel; |
278 } | 279 } |
279 | 280 |
280 @end | 281 @end |
OLD | NEW |