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

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

Issue 9655018: Make AudioParameters a class instead of a struct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright years Created 8 years, 9 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.cc ('k') | media/audio/audio_parameters.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_output_dispatcher.h" 5 #include "media/audio/audio_output_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "media/audio/audio_io.h" 11 #include "media/audio/audio_io.h"
12 12
13 AudioOutputDispatcher::AudioOutputDispatcher( 13 AudioOutputDispatcher::AudioOutputDispatcher(
14 AudioManager* audio_manager, const AudioParameters& params, 14 AudioManager* audio_manager, const AudioParameters& params,
15 base::TimeDelta close_delay) 15 base::TimeDelta close_delay)
16 : audio_manager_(audio_manager), 16 : audio_manager_(audio_manager),
17 message_loop_(MessageLoop::current()), 17 message_loop_(MessageLoop::current()),
18 params_(params), 18 params_(params),
19 pause_delay_(base::TimeDelta::FromMilliseconds( 19 pause_delay_(base::TimeDelta::FromMilliseconds(
20 2 * params.samples_per_packet * 20 2 * params.frames_per_buffer() *
21 base::Time::kMillisecondsPerSecond / params.sample_rate)), 21 base::Time::kMillisecondsPerSecond / params.sample_rate())),
22 paused_proxies_(0), 22 paused_proxies_(0),
23 ALLOW_THIS_IN_INITIALIZER_LIST(weak_this_(this)), 23 ALLOW_THIS_IN_INITIALIZER_LIST(weak_this_(this)),
24 close_timer_(FROM_HERE, 24 close_timer_(FROM_HERE,
25 close_delay, 25 close_delay,
26 weak_this_.GetWeakPtr(), 26 weak_this_.GetWeakPtr(),
27 &AudioOutputDispatcher::ClosePendingStreams) { 27 &AudioOutputDispatcher::ClosePendingStreams) {
28 // We expect to be instantiated on the audio thread. Otherwise the 28 // We expect to be instantiated on the audio thread. Otherwise the
29 // message_loop_ member will point to the wrong message loop! 29 // message_loop_ member will point to the wrong message loop!
30 DCHECK(audio_manager->GetMessageLoop()->BelongsToCurrentThread()); 30 DCHECK(audio_manager->GetMessageLoop()->BelongsToCurrentThread());
31 } 31 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 // This method is called by |close_timer_|. 162 // This method is called by |close_timer_|.
163 void AudioOutputDispatcher::ClosePendingStreams() { 163 void AudioOutputDispatcher::ClosePendingStreams() {
164 DCHECK_EQ(MessageLoop::current(), message_loop_); 164 DCHECK_EQ(MessageLoop::current(), message_loop_);
165 165
166 while (!idle_streams_.empty()) { 166 while (!idle_streams_.empty()) {
167 idle_streams_.back()->Close(); 167 idle_streams_.back()->Close();
168 idle_streams_.pop_back(); 168 idle_streams_.pop_back();
169 } 169 }
170 } 170 }
OLDNEW
« no previous file with comments | « media/audio/audio_manager_base.cc ('k') | media/audio/audio_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698