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

Side by Side Diff: content/renderer/media/webrtc/peer_connection_dependency_factory.cc

Issue 1071063005: Fix heap-use-after-free issue with WebAudioCapturerSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add thread check to WebAudioCapturerSourcer destructor Created 5 years, 8 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
« no previous file with comments | « content/renderer/media/webaudio_capturer_source.cc ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/peer_connection_dependency_factory.h" 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // it is the first audio track connecting to the capturer. 497 // it is the first audio track connecting to the capturer.
498 audio_track->Start(); 498 audio_track->Start();
499 } 499 }
500 500
501 scoped_refptr<WebAudioCapturerSource> 501 scoped_refptr<WebAudioCapturerSource>
502 PeerConnectionDependencyFactory::CreateWebAudioSource( 502 PeerConnectionDependencyFactory::CreateWebAudioSource(
503 blink::WebMediaStreamSource* source) { 503 blink::WebMediaStreamSource* source) {
504 DVLOG(1) << "PeerConnectionDependencyFactory::CreateWebAudioSource()"; 504 DVLOG(1) << "PeerConnectionDependencyFactory::CreateWebAudioSource()";
505 505
506 scoped_refptr<WebAudioCapturerSource> 506 scoped_refptr<WebAudioCapturerSource>
507 webaudio_capturer_source(new WebAudioCapturerSource()); 507 webaudio_capturer_source(new WebAudioCapturerSource(*source));
508 MediaStreamAudioSource* source_data = new MediaStreamAudioSource(); 508 MediaStreamAudioSource* source_data = new MediaStreamAudioSource();
509 509
510 // Use the current default capturer for the WebAudio track so that the 510 // Use the current default capturer for the WebAudio track so that the
511 // WebAudio track can pass a valid delay value and |need_audio_processing| 511 // WebAudio track can pass a valid delay value and |need_audio_processing|
512 // flag to PeerConnection. 512 // flag to PeerConnection.
513 // TODO(xians): Remove this after moving APM to Chrome. 513 // TODO(xians): Remove this after moving APM to Chrome.
514 if (GetWebRtcAudioDevice()) { 514 if (GetWebRtcAudioDevice()) {
515 source_data->SetAudioCapturer( 515 source_data->SetAudioCapturer(
516 GetWebRtcAudioDevice()->GetDefaultCapturer()); 516 GetWebRtcAudioDevice()->GetDefaultCapturer());
517 } 517 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 644
645 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { 645 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
646 if (audio_device_.get()) 646 if (audio_device_.get())
647 return; 647 return;
648 648
649 audio_device_ = new WebRtcAudioDeviceImpl(); 649 audio_device_ = new WebRtcAudioDeviceImpl();
650 } 650 }
651 651
652 } // namespace content 652 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webaudio_capturer_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698