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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 RTC_DCHECK(audio_observers_.empty()); | 89 RTC_DCHECK(audio_observers_.empty()); |
90 RTC_DCHECK(sinks_.empty()); | 90 RTC_DCHECK(sinks_.empty()); |
91 } | 91 } |
92 | 92 |
93 void RemoteAudioSource::Initialize(uint32_t ssrc, | 93 void RemoteAudioSource::Initialize(uint32_t ssrc, |
94 AudioProviderInterface* provider) { | 94 AudioProviderInterface* provider) { |
95 RTC_DCHECK(main_thread_->IsCurrent()); | 95 RTC_DCHECK(main_thread_->IsCurrent()); |
96 // To make sure we always get notified when the provider goes out of scope, | 96 // To make sure we always get notified when the provider goes out of scope, |
97 // we register for callbacks here and not on demand in AddSink. | 97 // we register for callbacks here and not on demand in AddSink. |
98 if (provider) { // May be null in tests. | 98 if (provider) { // May be null in tests. |
99 provider->SetRawAudioSink(ssrc, new rtc::RefCountedObject<Sink>(this)); | 99 provider->SetRawAudioSink( |
| 100 ssrc, rtc::scoped_ptr<AudioSinkInterface>(new Sink(this))); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 MediaSourceInterface::SourceState RemoteAudioSource::state() const { | 104 MediaSourceInterface::SourceState RemoteAudioSource::state() const { |
104 RTC_DCHECK(main_thread_->IsCurrent()); | 105 RTC_DCHECK(main_thread_->IsCurrent()); |
105 return state_; | 106 return state_; |
106 } | 107 } |
107 | 108 |
108 bool RemoteAudioSource::remote() const { | 109 bool RemoteAudioSource::remote() const { |
109 RTC_DCHECK(main_thread_->IsCurrent()); | 110 RTC_DCHECK(main_thread_->IsCurrent()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 167 } |
167 | 168 |
168 void RemoteAudioSource::OnMessage(rtc::Message* msg) { | 169 void RemoteAudioSource::OnMessage(rtc::Message* msg) { |
169 RTC_DCHECK(main_thread_->IsCurrent()); | 170 RTC_DCHECK(main_thread_->IsCurrent()); |
170 sinks_.clear(); | 171 sinks_.clear(); |
171 state_ = MediaSourceInterface::kEnded; | 172 state_ = MediaSourceInterface::kEnded; |
172 FireOnChanged(); | 173 FireOnChanged(); |
173 } | 174 } |
174 | 175 |
175 } // namespace webrtc | 176 } // namespace webrtc |
OLD | NEW |