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

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

Issue 9826028: Rename AudioRendererBase and AudioRendererAlgorithmBase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit tests were somehow unadded Created 8 years, 8 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 | « content/renderer/render_view_impl.cc ('k') | media/filters/audio_renderer_algorithm.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/null_audio_sink.h" 5 #include "media/audio/null_audio_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 9
10 namespace media { 10 namespace media {
11 11
12 NullAudioSink::NullAudioSink() 12 NullAudioSink::NullAudioSink()
13 : initialized_(false), 13 : initialized_(false),
14 playback_rate_(0.0), 14 playback_rate_(0.0),
15 playing_(false), 15 playing_(false),
16 callback_(NULL), 16 callback_(NULL),
17 thread_("NullAudioThread") { 17 thread_("NullAudioThread") {
18 } 18 }
19 19
20 NullAudioSink::~NullAudioSink() { 20 NullAudioSink::~NullAudioSink() {
21 DCHECK(!thread_.IsRunning()); 21 DCHECK(!thread_.IsRunning());
22 for (size_t i = 0; i < audio_data_.size(); ++i) 22 for (size_t i = 0; i < audio_data_.size(); ++i)
23 delete [] audio_data_[i]; 23 delete [] audio_data_[i];
24 } 24 }
25 25
26
27 void NullAudioSink::Start() { 26 void NullAudioSink::Start() {
28 if (!thread_.Start()) 27 if (!thread_.Start())
29 return; 28 return;
30 29
31 thread_.message_loop()->PostTask(FROM_HERE, base::Bind( 30 thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
32 &NullAudioSink::FillBufferTask, this)); 31 &NullAudioSink::FillBufferTask, this));
33 } 32 }
34 33
35 void NullAudioSink::Stop() { 34 void NullAudioSink::Stop() {
36 SetPlaying(false); 35 SetPlaying(false);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 100 }
102 101
103 // Sleep for at least one millisecond so we don't spin the CPU. 102 // Sleep for at least one millisecond so we don't spin the CPU.
104 MessageLoop::current()->PostDelayedTask( 103 MessageLoop::current()->PostDelayedTask(
105 FROM_HERE, 104 FROM_HERE,
106 base::Bind(&NullAudioSink::FillBufferTask, this), 105 base::Bind(&NullAudioSink::FillBufferTask, this),
107 std::max(delay, base::TimeDelta::FromMilliseconds(1))); 106 std::max(delay, base::TimeDelta::FromMilliseconds(1)));
108 } 107 }
109 108
110 } // namespace media 109 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | media/filters/audio_renderer_algorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698