Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/webrtc_audio_device_impl.h" | 5 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 | 252 |
| 253 // Calling Terminate() multiple times in a row is OK. | 253 // Calling Terminate() multiple times in a row is OK. |
| 254 if (!initialized_) | 254 if (!initialized_) |
| 255 return 0; | 255 return 0; |
| 256 | 256 |
| 257 StopRecording(); | 257 StopRecording(); |
| 258 StopPlayout(); | 258 StopPlayout(); |
| 259 | 259 |
| 260 // It is necessary to stop the |renderer_| before going away. | 260 // It is necessary to stop the |renderer_| before going away. |
| 261 if (renderer_) { | 261 if (renderer_) { |
| 262 renderer_->Stop(); | 262 // WebRtcAudioRenderer::Stop() will trigger RemoveAudioRenderer(), so we |
|
henrika (OOO until Aug 14)
2013/05/27 10:06:00
I am stupid, but the example says:
{
// scope
henrika (OOO until Aug 14)
2013/05/27 10:11:21
OK, checking the swap implementation it looks like
| |
| 263 renderer_ = NULL; | 263 // have to swap the member reference to a local reference here. |
| 264 scoped_refptr<WebRtcAudioRenderer> renderer; | |
| 265 renderer_.swap(renderer); | |
|
tommi (sloooow) - chröme
2013/05/27 10:48:13
I don't think swap() is the right thing here becau
no longer working on chromium
2013/05/27 11:15:41
Done.
| |
| 266 renderer->Stop(); | |
| 264 } | 267 } |
| 265 | 268 |
| 266 if (capturer_) { | 269 if (capturer_) { |
| 267 // |capturer_| is stopped by the media stream, so do not need to | 270 // |capturer_| is stopped by the media stream, so do not need to |
| 268 // call Stop() here. | 271 // call Stop() here. |
| 269 capturer_->RemoveSink(this); | 272 capturer_->RemoveSink(this); |
| 270 capturer_ = NULL; | 273 capturer_ = NULL; |
| 271 } | 274 } |
| 272 | 275 |
| 273 initialized_ = false; | 276 initialized_ = false; |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 496 return false; | 499 return false; |
| 497 | 500 |
| 498 if (!renderer->Initialize(this)) | 501 if (!renderer->Initialize(this)) |
| 499 return false; | 502 return false; |
| 500 | 503 |
| 501 renderer_ = renderer; | 504 renderer_ = renderer; |
| 502 return true; | 505 return true; |
| 503 } | 506 } |
| 504 | 507 |
| 505 } // namespace content | 508 } // namespace content |
| OLD | NEW |