| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 14 matching lines...) Expand all Loading... |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #if !defined(__has_feature) || !__has_feature(objc_arc) | 28 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 29 #error "This file requires ARC support." | 29 #error "This file requires ARC support." |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 #import "RTCEnumConverter.h" | 32 #import "RTCEnumConverter.h" |
| 33 #import "RTCMediaStreamTrack+Internal.h" | 33 #import "RTCMediaStreamTrack+Internal.h" |
| 34 | 34 |
| 35 #include <memory> |
| 36 |
| 35 namespace webrtc { | 37 namespace webrtc { |
| 36 | 38 |
| 37 class RTCMediaStreamTrackObserver : public ObserverInterface { | 39 class RTCMediaStreamTrackObserver : public ObserverInterface { |
| 38 public: | 40 public: |
| 39 RTCMediaStreamTrackObserver(RTCMediaStreamTrack* track) { _track = track; } | 41 RTCMediaStreamTrackObserver(RTCMediaStreamTrack* track) { _track = track; } |
| 40 | 42 |
| 41 void OnChanged() override { | 43 void OnChanged() override { |
| 42 [_track.delegate mediaStreamTrackDidChange:_track]; | 44 [_track.delegate mediaStreamTrackDidChange:_track]; |
| 43 } | 45 } |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 __weak RTCMediaStreamTrack* _track; | 48 __weak RTCMediaStreamTrack* _track; |
| 47 }; | 49 }; |
| 48 } | 50 } |
| 49 | 51 |
| 50 @implementation RTCMediaStreamTrack { | 52 @implementation RTCMediaStreamTrack { |
| 51 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> _mediaTrack; | 53 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> _mediaTrack; |
| 52 rtc::scoped_ptr<webrtc::RTCMediaStreamTrackObserver> _observer; | 54 std::unique_ptr<webrtc::RTCMediaStreamTrackObserver> _observer; |
| 53 } | 55 } |
| 54 | 56 |
| 55 @synthesize label; | 57 @synthesize label; |
| 56 | 58 |
| 57 - (BOOL)isEqual:(id)other { | 59 - (BOOL)isEqual:(id)other { |
| 58 // Equality is purely based on the label just like the C++ implementation. | 60 // Equality is purely based on the label just like the C++ implementation. |
| 59 if (self == other) | 61 if (self == other) |
| 60 return YES; | 62 return YES; |
| 61 if (![other isKindOfClass:[self class]] || | 63 if (![other isKindOfClass:[self class]] || |
| 62 ![self isKindOfClass:[other class]]) { | 64 ![self isKindOfClass:[other class]]) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 120 |
| 119 - (void)dealloc { | 121 - (void)dealloc { |
| 120 _mediaTrack->UnregisterObserver(_observer.get()); | 122 _mediaTrack->UnregisterObserver(_observer.get()); |
| 121 } | 123 } |
| 122 | 124 |
| 123 - (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)mediaTrack { | 125 - (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)mediaTrack { |
| 124 return _mediaTrack; | 126 return _mediaTrack; |
| 125 } | 127 } |
| 126 | 128 |
| 127 @end | 129 @end |
| OLD | NEW |