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

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

Issue 310463002: Fix the aec dump crash when users disable aec dump without closing the "Save File" overlay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the bots Created 6 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 | « content/renderer/media/webrtc/peer_connection_dependency_factory.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 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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 if (capturers_.empty() || capturers_.size() > 1) 517 if (capturers_.empty() || capturers_.size() > 1)
518 return false; 518 return false;
519 519
520 return GetDefaultCapturer()->GetPairedOutputParameters( 520 return GetDefaultCapturer()->GetPairedOutputParameters(
521 session_id, output_sample_rate, output_frames_per_buffer); 521 session_id, output_sample_rate, output_frames_per_buffer);
522 } 522 }
523 523
524 void WebRtcAudioDeviceImpl::EnableAecDump(base::File aec_dump_file) { 524 void WebRtcAudioDeviceImpl::EnableAecDump(base::File aec_dump_file) {
525 DCHECK(thread_checker_.CalledOnValidThread()); 525 DCHECK(thread_checker_.CalledOnValidThread());
526 DCHECK(aec_dump_file.IsValid()); 526 DCHECK(aec_dump_file.IsValid());
527 DCHECK(!aec_dump_file_.IsValid()); 527
528 // Close the previous AEC dump file description if it has not been consumed.
529 // This can happen if no getUserMedia has been made yet.
530 // TODO(xians): DCHECK(!aec_dump_file_.IsValid()) after the browser
531 // guarantees it won't call EnableAecDump() more than once in a row.
532 if (aec_dump_file_.IsValid())
533 aec_dump_file_.Close();
534
528 aec_dump_file_ = aec_dump_file.Pass(); 535 aec_dump_file_ = aec_dump_file.Pass();
529 MaybeStartAecDump(); 536 MaybeStartAecDump();
530 } 537 }
531 538
532 void WebRtcAudioDeviceImpl::DisableAecDump() { 539 void WebRtcAudioDeviceImpl::DisableAecDump() {
533 DCHECK(thread_checker_.CalledOnValidThread()); 540 DCHECK(thread_checker_.CalledOnValidThread());
534 // Simply invalidate the |aec_dump_file_| if we have not pass the ownership 541 // Simply invalidate the |aec_dump_file_| if we have not pass the ownership
535 // to WebRtc. 542 // to WebRtc.
536 if (aec_dump_file_.IsValid()) { 543 if (aec_dump_file_.IsValid()) {
537 aec_dump_file_.Close(); 544 aec_dump_file_.Close();
(...skipping 14 matching lines...) Expand all
552 559
553 // Start the Aec dump on the current default capturer. 560 // Start the Aec dump on the current default capturer.
554 scoped_refptr<WebRtcAudioCapturer> default_capturer(GetDefaultCapturer()); 561 scoped_refptr<WebRtcAudioCapturer> default_capturer(GetDefaultCapturer());
555 if (!default_capturer) 562 if (!default_capturer)
556 return; 563 return;
557 564
558 default_capturer->StartAecDump(aec_dump_file_.Pass()); 565 default_capturer->StartAecDump(aec_dump_file_.Pass());
559 } 566 }
560 567
561 } // namespace content 568 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/peer_connection_dependency_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698