| 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_manager_base.h" | 5 #include "media/audio/audio_manager_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // processing task queue at this point. So even if tasks to close the | 317 // processing task queue at this point. So even if tasks to close the |
| 318 // streams are enqueued, they would not run leading to CHECKs getting hit | 318 // streams are enqueued, they would not run leading to CHECKs getting hit |
| 319 // in the destructor about open streams. Close them explicitly here. | 319 // in the destructor about open streams. Close them explicitly here. |
| 320 // crbug.com/608049. | 320 // crbug.com/608049. |
| 321 for (auto iter = input_streams_.begin(); iter != input_streams_.end();) { | 321 for (auto iter = input_streams_.begin(); iter != input_streams_.end();) { |
| 322 // Note: Closing the stream will invalidate the iterator. | 322 // Note: Closing the stream will invalidate the iterator. |
| 323 // Increment the iterator before closing the stream. | 323 // Increment the iterator before closing the stream. |
| 324 AudioInputStream* stream = *iter++; | 324 AudioInputStream* stream = *iter++; |
| 325 stream->Close(); | 325 stream->Close(); |
| 326 } | 326 } |
| 327 CHECK(input_streams_.empty()); |
| 327 #endif // OS_MACOSX | 328 #endif // OS_MACOSX |
| 328 } | 329 } |
| 329 | 330 |
| 330 void AudioManagerBase::AddOutputDeviceChangeListener( | 331 void AudioManagerBase::AddOutputDeviceChangeListener( |
| 331 AudioDeviceListener* listener) { | 332 AudioDeviceListener* listener) { |
| 332 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 333 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
| 333 output_listeners_.AddObserver(listener); | 334 output_listeners_.AddObserver(listener); |
| 334 } | 335 } |
| 335 | 336 |
| 336 void AudioManagerBase::RemoveOutputDeviceChangeListener( | 337 void AudioManagerBase::RemoveOutputDeviceChangeListener( |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 | 405 |
| 405 return 0; | 406 return 0; |
| 406 } | 407 } |
| 407 | 408 |
| 408 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( | 409 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( |
| 409 AudioLogFactory::AudioComponent component) { | 410 AudioLogFactory::AudioComponent component) { |
| 410 return audio_log_factory_->CreateAudioLog(component); | 411 return audio_log_factory_->CreateAudioLog(component); |
| 411 } | 412 } |
| 412 | 413 |
| 413 } // namespace media | 414 } // namespace media |
| OLD | NEW |