Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 Stop(); | 147 Stop(); |
| 148 channel_proxy_->DeRegisterExternalTransport(); | 148 channel_proxy_->DeRegisterExternalTransport(); |
| 149 channel_proxy_->ResetCongestionControlObjects(); | 149 channel_proxy_->ResetCongestionControlObjects(); |
| 150 channel_proxy_->SetRtcEventLog(nullptr); | 150 channel_proxy_->SetRtcEventLog(nullptr); |
| 151 if (remote_bitrate_estimator_) { | 151 if (remote_bitrate_estimator_) { |
| 152 remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc); | 152 remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 void AudioReceiveStream::Start() { | 156 void AudioReceiveStream::Start() { |
| 157 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 157 RTC_DCHECK_RUN_ON(&thread_checker_); |
|
the sun
2016/10/27 10:06:45
This is nice, but should all thread checking in th
aleloi
2016/11/01 15:17:34
I added an ACCESS_ON annotation on playout_. Now e
| |
| 158 if (playing_) { | |
|
ossu
2016/10/25 14:13:33
Is this fine or does it indicate a usage error?
I.
the sun
2016/10/27 10:06:45
Since this is going to be part of the public API I
aleloi
2016/11/01 15:17:34
webrtcvoiceengine runs Stop on everything in SetPl
| |
| 159 return; | |
| 160 } | |
| 161 | |
| 158 ScopedVoEInterface<VoEBase> base(voice_engine()); | 162 ScopedVoEInterface<VoEBase> base(voice_engine()); |
| 159 int error = base->StartPlayout(config_.voe_channel_id); | 163 int error = base->StartPlayout(config_.voe_channel_id); |
| 160 if (error != 0) { | 164 if (error != 0) { |
| 161 LOG(LS_ERROR) << "AudioReceiveStream::Start failed with error: " << error; | 165 LOG(LS_ERROR) << "AudioReceiveStream::Start failed with error: " << error; |
| 166 return; | |
| 167 } | |
| 168 | |
| 169 playing_ = true; | |
| 170 | |
| 171 auto* const audio_state = | |
|
the sun
2016/10/27 10:06:45
Make a class private method internal::AudioState*
aleloi
2016/11/01 15:17:34
That's a design tip from Scott Meyers! I read that
| |
| 172 static_cast<internal::AudioState*>(audio_state_.get()); | |
|
ossu
2016/10/25 14:13:33
I wonder about the cast here. I see it's being don
the sun
2016/10/27 10:06:45
AudioState is intended as (for clients of the Call
| |
| 173 | |
| 174 if (!audio_state->mixer()->AddSource(this)) { | |
| 175 LOG(LS_ERROR) << "Failed to add source to mixer."; | |
|
the sun
2016/10/27 10:06:45
Does that mean we're not actually playing and we s
aleloi
2016/11/01 15:17:35
Thanks! It's an error that is never supposed to ha
| |
| 162 } | 176 } |
| 163 } | 177 } |
| 164 | 178 |
| 165 void AudioReceiveStream::Stop() { | 179 void AudioReceiveStream::Stop() { |
| 166 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 180 RTC_DCHECK_RUN_ON(&thread_checker_); |
| 181 | |
| 182 if (!playing_) { | |
| 183 return; | |
| 184 } | |
| 185 playing_ = false; | |
| 186 | |
| 187 auto* const audio_state = | |
| 188 static_cast<internal::AudioState*>(audio_state_.get()); | |
| 189 if (!audio_state->mixer()->RemoveSource(this)) { | |
|
the sun
2016/10/27 10:06:45
Uhm, sorry, I missed there was a return code for R
aleloi
2016/11/01 15:17:35
It's not too late to change! But why? Isn't it the
| |
| 190 LOG(LS_ERROR) << "Failed to remove stream from mixer."; | |
| 191 } | |
| 192 | |
| 167 ScopedVoEInterface<VoEBase> base(voice_engine()); | 193 ScopedVoEInterface<VoEBase> base(voice_engine()); |
| 168 base->StopPlayout(config_.voe_channel_id); | 194 base->StopPlayout(config_.voe_channel_id); |
| 169 } | 195 } |
| 170 | 196 |
| 171 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { | 197 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { |
| 172 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 198 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 173 webrtc::AudioReceiveStream::Stats stats; | 199 webrtc::AudioReceiveStream::Stats stats; |
| 174 stats.remote_ssrc = config_.rtp.remote_ssrc; | 200 stats.remote_ssrc = config_.rtp.remote_ssrc; |
| 175 ScopedVoEInterface<VoECodec> codec(voice_engine()); | 201 ScopedVoEInterface<VoECodec> codec(voice_engine()); |
| 176 | 202 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 | 310 |
| 285 VoiceEngine* AudioReceiveStream::voice_engine() const { | 311 VoiceEngine* AudioReceiveStream::voice_engine() const { |
| 286 internal::AudioState* audio_state = | 312 internal::AudioState* audio_state = |
| 287 static_cast<internal::AudioState*>(audio_state_.get()); | 313 static_cast<internal::AudioState*>(audio_state_.get()); |
| 288 VoiceEngine* voice_engine = audio_state->voice_engine(); | 314 VoiceEngine* voice_engine = audio_state->voice_engine(); |
| 289 RTC_DCHECK(voice_engine); | 315 RTC_DCHECK(voice_engine); |
| 290 return voice_engine; | 316 return voice_engine; |
| 291 } | 317 } |
| 292 } // namespace internal | 318 } // namespace internal |
| 293 } // namespace webrtc | 319 } // namespace webrtc |
| OLD | NEW |