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( | 99 provider->SetRawAudioSink(ssrc, new rtc::RefCountedObject<Sink>(this)); |
100 ssrc, rtc::scoped_ptr<AudioSinkInterface>(new Sink(this))); | |
101 } | 100 } |
102 } | 101 } |
103 | 102 |
104 MediaSourceInterface::SourceState RemoteAudioSource::state() const { | 103 MediaSourceInterface::SourceState RemoteAudioSource::state() const { |
105 RTC_DCHECK(main_thread_->IsCurrent()); | 104 RTC_DCHECK(main_thread_->IsCurrent()); |
106 return state_; | 105 return state_; |
107 } | 106 } |
108 | 107 |
109 bool RemoteAudioSource::remote() const { | 108 bool RemoteAudioSource::remote() const { |
110 RTC_DCHECK(main_thread_->IsCurrent()); | 109 RTC_DCHECK(main_thread_->IsCurrent()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 166 } |
168 | 167 |
169 void RemoteAudioSource::OnMessage(rtc::Message* msg) { | 168 void RemoteAudioSource::OnMessage(rtc::Message* msg) { |
170 RTC_DCHECK(main_thread_->IsCurrent()); | 169 RTC_DCHECK(main_thread_->IsCurrent()); |
171 sinks_.clear(); | 170 sinks_.clear(); |
172 state_ = MediaSourceInterface::kEnded; | 171 state_ = MediaSourceInterface::kEnded; |
173 FireOnChanged(); | 172 FireOnChanged(); |
174 } | 173 } |
175 | 174 |
176 } // namespace webrtc | 175 } // namespace webrtc |
OLD | NEW |