OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |