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

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: addressed the offline comments. 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
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.
Henrik Grunell 2014/05/30 11:24:39 What is the case when this can happen? Add it to t
no longer working on chromium 2014/06/02 08:34:14 Done.
529 if (aec_dump_file_.IsValid())
530 aec_dump_file_.Close();
531
528 aec_dump_file_ = aec_dump_file.Pass(); 532 aec_dump_file_ = aec_dump_file.Pass();
529 MaybeStartAecDump(); 533 MaybeStartAecDump();
530 } 534 }
531 535
532 void WebRtcAudioDeviceImpl::DisableAecDump() { 536 void WebRtcAudioDeviceImpl::DisableAecDump() {
533 DCHECK(thread_checker_.CalledOnValidThread()); 537 DCHECK(thread_checker_.CalledOnValidThread());
534 // Simply invalidate the |aec_dump_file_| if we have not pass the ownership 538 // Simply invalidate the |aec_dump_file_| if we have not pass the ownership
535 // to WebRtc. 539 // to WebRtc.
536 if (aec_dump_file_.IsValid()) { 540 if (aec_dump_file_.IsValid()) {
537 aec_dump_file_.Close(); 541 aec_dump_file_.Close();
(...skipping 14 matching lines...) Expand all
552 556
553 // Start the Aec dump on the current default capturer. 557 // Start the Aec dump on the current default capturer.
554 scoped_refptr<WebRtcAudioCapturer> default_capturer(GetDefaultCapturer()); 558 scoped_refptr<WebRtcAudioCapturer> default_capturer(GetDefaultCapturer());
555 if (!default_capturer) 559 if (!default_capturer)
556 return; 560 return;
557 561
558 default_capturer->StartAecDump(aec_dump_file_.Pass()); 562 default_capturer->StartAecDump(aec_dump_file_.Pass());
559 } 563 }
560 564
561 } // namespace content 565 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698