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

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

Issue 11260002: Fix invalid bind usage during AudioManagerBase construction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gotta catch'em all. Created 8 years, 2 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 | « media/audio/audio_manager_base.h ('k') | media/audio/mock_audio_manager.h » ('j') | 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_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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 max_num_output_streams_(kDefaultMaxOutputStreams), 44 max_num_output_streams_(kDefaultMaxOutputStreams),
45 max_num_input_streams_(kDefaultMaxInputStreams), 45 max_num_input_streams_(kDefaultMaxInputStreams),
46 num_output_streams_(0), 46 num_output_streams_(0),
47 num_input_streams_(0), 47 num_input_streams_(0),
48 audio_thread_(new base::Thread("AudioThread")) { 48 audio_thread_(new base::Thread("AudioThread")) {
49 #if defined(OS_WIN) 49 #if defined(OS_WIN)
50 audio_thread_->init_com_with_mta(true); 50 audio_thread_->init_com_with_mta(true);
51 #endif 51 #endif
52 CHECK(audio_thread_->Start()); 52 CHECK(audio_thread_->Start());
53 message_loop_ = audio_thread_->message_loop_proxy(); 53 message_loop_ = audio_thread_->message_loop_proxy();
54 message_loop_->PostTask(FROM_HERE, base::Bind(
55 &AudioManagerBase::InitializeOnAudioThread, base::Unretained(this)));
56 } 54 }
57 55
58 AudioManagerBase::~AudioManagerBase() { 56 AudioManagerBase::~AudioManagerBase() {
59 // The platform specific AudioManager implementation must have already 57 // The platform specific AudioManager implementation must have already
60 // stopped the audio thread. Otherwise, we may destroy audio streams before 58 // stopped the audio thread. Otherwise, we may destroy audio streams before
61 // stopping the thread, resulting an unexpected behavior. 59 // stopping the thread, resulting an unexpected behavior.
62 // This way we make sure activities of the audio streams are all stopped 60 // This way we make sure activities of the audio streams are all stopped
63 // before we destroy them. 61 // before we destroy them.
64 CHECK(!audio_thread_.get()); 62 CHECK(!audio_thread_.get());
65 // All the output streams should have been deleted. 63 // All the output streams should have been deleted.
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 output_listeners_.RemoveObserver(listener); 335 output_listeners_.RemoveObserver(listener);
338 } 336 }
339 337
340 void AudioManagerBase::NotifyAllOutputDeviceChangeListeners() { 338 void AudioManagerBase::NotifyAllOutputDeviceChangeListeners() {
341 DCHECK(message_loop_->BelongsToCurrentThread()); 339 DCHECK(message_loop_->BelongsToCurrentThread());
342 DVLOG(1) << "Firing OnDeviceChange() notifications."; 340 DVLOG(1) << "Firing OnDeviceChange() notifications.";
343 FOR_EACH_OBSERVER(AudioDeviceListener, output_listeners_, OnDeviceChange()); 341 FOR_EACH_OBSERVER(AudioDeviceListener, output_listeners_, OnDeviceChange());
344 } 342 }
345 343
346 } // namespace media 344 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/mock_audio_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698