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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( |
100 ssrc, std::move(rtc::scoped_ptr<AudioSinkInterface>(new Sink(this)))); | 100 ssrc, rtc::scoped_ptr<AudioSinkInterface>(new Sink(this))); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 MediaSourceInterface::SourceState RemoteAudioSource::state() const { | 104 MediaSourceInterface::SourceState RemoteAudioSource::state() const { |
105 RTC_DCHECK(main_thread_->IsCurrent()); | 105 RTC_DCHECK(main_thread_->IsCurrent()); |
106 return state_; | 106 return state_; |
107 } | 107 } |
108 | 108 |
109 void RemoteAudioSource::SetVolume(double volume) { | 109 void RemoteAudioSource::SetVolume(double volume) { |
110 RTC_DCHECK(volume >= 0 && volume <= 10); | 110 RTC_DCHECK(volume >= 0 && volume <= 10); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 void RemoteAudioSource::OnMessage(rtc::Message* msg) { | 164 void RemoteAudioSource::OnMessage(rtc::Message* msg) { |
165 RTC_DCHECK(main_thread_->IsCurrent()); | 165 RTC_DCHECK(main_thread_->IsCurrent()); |
166 sinks_.clear(); | 166 sinks_.clear(); |
167 state_ = MediaSourceInterface::kEnded; | 167 state_ = MediaSourceInterface::kEnded; |
168 FireOnChanged(); | 168 FireOnChanged(); |
169 } | 169 } |
170 | 170 |
171 } // namespace webrtc | 171 } // namespace webrtc |
OLD | NEW |