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

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

Issue 314713002: Modifies AudioInputCallback::OnData and use media::AudioBus instead of plain byte vector (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now uses AudioBus::WrapMemory instead of From/ToInterleaved Created 6 years, 6 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
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/fake_audio_input_stream.h" 5 #include "media/audio/fake_audio_input_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "media/audio/audio_manager_base.h" 9 #include "media/audio/audio_manager_base.h"
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 memset(buffer_.get() + position, 128, high_bytes); 134 memset(buffer_.get() + position, 128, high_bytes);
135 // Then leave low values in the buffer with |high_bytes|. 135 // Then leave low values in the buffer with |high_bytes|.
136 position += high_bytes * 2; 136 position += high_bytes * 2;
137 } 137 }
138 138
139 ++beep_generated_in_buffers_; 139 ++beep_generated_in_buffers_;
140 if (beep_generated_in_buffers_ >= beep_duration_in_buffers_) 140 if (beep_generated_in_buffers_ >= beep_duration_in_buffers_)
141 beep_generated_in_buffers_ = 0; 141 beep_generated_in_buffers_ = 0;
142 } 142 }
143 143
144 callback_->OnData(this, buffer_.get(), buffer_size_, buffer_size_, 1.0); 144 /* TODO(henrika)
145 callback_->OnData(this, buffer_.get(), buffer_size_, buffer_size_, 1.0); */
145 frames_elapsed_ += params_.frames_per_buffer(); 146 frames_elapsed_ += params_.frames_per_buffer();
146 147
147 thread_.message_loop()->PostDelayedTask( 148 thread_.message_loop()->PostDelayedTask(
148 FROM_HERE, 149 FROM_HERE,
149 base::Bind(&FakeAudioInputStream::DoCallback, base::Unretained(this)), 150 base::Bind(&FakeAudioInputStream::DoCallback, base::Unretained(this)),
150 next_callback_time); 151 next_callback_time);
151 } 152 }
152 153
153 void FakeAudioInputStream::Stop() { 154 void FakeAudioInputStream::Stop() {
154 thread_.Stop(); 155 thread_.Stop();
(...skipping 23 matching lines...) Expand all
178 179
179 // static 180 // static
180 void FakeAudioInputStream::BeepOnce() { 181 void FakeAudioInputStream::BeepOnce() {
181 BeepContext* beep_context = g_beep_context.Pointer(); 182 BeepContext* beep_context = g_beep_context.Pointer();
182 base::AutoLock auto_lock(beep_context->beep_lock); 183 base::AutoLock auto_lock(beep_context->beep_lock);
183 beep_context->beep_once = true; 184 beep_context->beep_once = true;
184 beep_context->automatic = false; 185 beep_context->automatic = false;
185 } 186 }
186 187
187 } // namespace media 188 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698