| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2014 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 #include "webrtc/api/remoteaudiosource.h" | 11 #include "webrtc/api/remoteaudiosource.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <functional> | 14 #include <functional> |
| 15 #include <memory> |
| 15 #include <utility> | 16 #include <utility> |
| 16 | 17 |
| 17 #include "webrtc/api/mediastreamprovider.h" | 18 #include "webrtc/api/mediastreamprovider.h" |
| 18 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
| 20 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/thread.h" | 22 #include "webrtc/base/thread.h" |
| 22 | 23 |
| 23 namespace webrtc { | 24 namespace webrtc { |
| 24 | 25 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 RTC_DCHECK(sinks_.empty()); | 75 RTC_DCHECK(sinks_.empty()); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void RemoteAudioSource::Initialize(uint32_t ssrc, | 78 void RemoteAudioSource::Initialize(uint32_t ssrc, |
| 78 AudioProviderInterface* provider) { | 79 AudioProviderInterface* provider) { |
| 79 RTC_DCHECK(main_thread_->IsCurrent()); | 80 RTC_DCHECK(main_thread_->IsCurrent()); |
| 80 // To make sure we always get notified when the provider goes out of scope, | 81 // To make sure we always get notified when the provider goes out of scope, |
| 81 // we register for callbacks here and not on demand in AddSink. | 82 // we register for callbacks here and not on demand in AddSink. |
| 82 if (provider) { // May be null in tests. | 83 if (provider) { // May be null in tests. |
| 83 provider->SetRawAudioSink( | 84 provider->SetRawAudioSink( |
| 84 ssrc, rtc::scoped_ptr<AudioSinkInterface>(new Sink(this))); | 85 ssrc, std::unique_ptr<AudioSinkInterface>(new Sink(this))); |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 | 88 |
| 88 MediaSourceInterface::SourceState RemoteAudioSource::state() const { | 89 MediaSourceInterface::SourceState RemoteAudioSource::state() const { |
| 89 RTC_DCHECK(main_thread_->IsCurrent()); | 90 RTC_DCHECK(main_thread_->IsCurrent()); |
| 90 return state_; | 91 return state_; |
| 91 } | 92 } |
| 92 | 93 |
| 93 bool RemoteAudioSource::remote() const { | 94 bool RemoteAudioSource::remote() const { |
| 94 RTC_DCHECK(main_thread_->IsCurrent()); | 95 RTC_DCHECK(main_thread_->IsCurrent()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 152 } |
| 152 | 153 |
| 153 void RemoteAudioSource::OnMessage(rtc::Message* msg) { | 154 void RemoteAudioSource::OnMessage(rtc::Message* msg) { |
| 154 RTC_DCHECK(main_thread_->IsCurrent()); | 155 RTC_DCHECK(main_thread_->IsCurrent()); |
| 155 sinks_.clear(); | 156 sinks_.clear(); |
| 156 state_ = MediaSourceInterface::kEnded; | 157 state_ = MediaSourceInterface::kEnded; |
| 157 FireOnChanged(); | 158 FireOnChanged(); |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace webrtc | 161 } // namespace webrtc |
| OLD | NEW |