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

Side by Side Diff: media/audio/audio_input_controller.cc

Issue 2958003002: Expose Timer::AbandonAndStop, so it can safely be destroyed on another thread. (Closed)
Patch Set: Expose AbandonAndStop and use it in AudioInputController. Created 3 years, 5 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 | « base/timer/timer.h ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/audio/audio_input_controller.h" 5 #include "media/audio/audio_input_controller.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 stream_->Start(audio_callback_.get()); 390 stream_->Start(audio_callback_.get());
391 } 391 }
392 392
393 void AudioInputController::DoClose() { 393 void AudioInputController::DoClose() {
394 DCHECK(task_runner_->BelongsToCurrentThread()); 394 DCHECK(task_runner_->BelongsToCurrentThread());
395 SCOPED_UMA_HISTOGRAM_TIMER("Media.AudioInputController.CloseTime"); 395 SCOPED_UMA_HISTOGRAM_TIMER("Media.AudioInputController.CloseTime");
396 396
397 if (!stream_) 397 if (!stream_)
398 return; 398 return;
399 399
400 check_muted_state_timer_.Stop(); 400 check_muted_state_timer_.AbandonAndStop();
401 401
402 std::string log_string; 402 std::string log_string;
403 static const char kLogStringPrefix[] = "AIC::DoClose:"; 403 static const char kLogStringPrefix[] = "AIC::DoClose:";
404 404
405 // Allow calling unconditionally and bail if we don't have a stream to close. 405 // Allow calling unconditionally and bail if we don't have a stream to close.
406 if (audio_callback_) { 406 if (audio_callback_) {
407 stream_->Stop(); 407 stream_->Stop();
408 408
409 // Sometimes a stream (and accompanying audio track) is created and 409 // Sometimes a stream (and accompanying audio track) is created and
410 // immediately closed or discarded. In this case they are registered as 410 // immediately closed or discarded. In this case they are registered as
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 case AudioParameters::Format::AUDIO_PCM_LOW_LATENCY: 698 case AudioParameters::Format::AUDIO_PCM_LOW_LATENCY:
699 return AudioInputController::StreamType::LOW_LATENCY; 699 return AudioInputController::StreamType::LOW_LATENCY;
700 default: 700 default:
701 // Currently, the remaining supported type is fake. Reconsider if other 701 // Currently, the remaining supported type is fake. Reconsider if other
702 // formats become supported. 702 // formats become supported.
703 return AudioInputController::StreamType::FAKE; 703 return AudioInputController::StreamType::FAKE;
704 } 704 }
705 } 705 }
706 706
707 } // namespace media 707 } // namespace media
OLDNEW
« no previous file with comments | « base/timer/timer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698