Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: content/renderer/media/webrtc_audio_device_impl.cc

Issue 15732021: swap the renderer_ reference to local before calling Stop() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed Tommi's comment. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Grab a local reference while we call Stop(), which will trigger a call to
263 renderer_ = NULL; 263 // RemoveAudioRenderer that clears our reference to the audio renderer.
264 scoped_refptr<WebRtcAudioRenderer> local_renderer(renderer_);
265 local_renderer->Stop();
266 DCHECK(!renderer_);
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698