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

Side by Side Diff: content/renderer/media/audio_input_device.cc

Issue 7157001: Implements AudioMessageFilter as member in RenderThread (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Refactored major parts of the failing unit test Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/renderer/media/audio_input_device.h" 5 #include "content/renderer/media/audio_input_device.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "content/common/child_process.h" 9 #include "content/common/child_process.h"
10 #include "content/common/media/audio_messages.h" 10 #include "content/common/media/audio_messages.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 126 }
127 127
128 bool AudioInputDevice::GetVolume(double* volume) { 128 bool AudioInputDevice::GetVolume(double* volume) {
129 NOTIMPLEMENTED(); 129 NOTIMPLEMENTED();
130 return false; 130 return false;
131 } 131 }
132 132
133 void AudioInputDevice::InitializeOnIOThread(const AudioParameters& params) { 133 void AudioInputDevice::InitializeOnIOThread(const AudioParameters& params) {
134 stream_id_ = filter_->AddDelegate(this); 134 stream_id_ = filter_->AddDelegate(this);
135 filter_->Send( 135 filter_->Send(
136 new AudioInputHostMsg_CreateStream(0, stream_id_, params, true)); 136 new AudioInputHostMsg_CreateStream(stream_id_, params, true));
137 } 137 }
138 138
139 void AudioInputDevice::StartOnIOThread() { 139 void AudioInputDevice::StartOnIOThread() {
140 if (stream_id_) 140 if (stream_id_)
141 filter_->Send(new AudioInputHostMsg_RecordStream(0, stream_id_)); 141 filter_->Send(new AudioInputHostMsg_RecordStream(stream_id_));
142 } 142 }
143 143
144 void AudioInputDevice::ShutDownOnIOThread() { 144 void AudioInputDevice::ShutDownOnIOThread() {
145 // Make sure we don't call shutdown more than once. 145 // Make sure we don't call shutdown more than once.
146 if (!stream_id_) 146 if (!stream_id_)
147 return; 147 return;
148 148
149 filter_->Send(new AudioInputHostMsg_CloseStream(0, stream_id_)); 149 filter_->Send(new AudioInputHostMsg_CloseStream(stream_id_));
150 filter_->RemoveDelegate(stream_id_); 150 filter_->RemoveDelegate(stream_id_);
151 stream_id_ = 0; 151 stream_id_ = 0;
152 } 152 }
153 153
154 void AudioInputDevice::SetVolumeOnIOThread(double volume) { 154 void AudioInputDevice::SetVolumeOnIOThread(double volume) {
155 if (stream_id_) 155 if (stream_id_)
156 filter_->Send(new AudioInputHostMsg_SetVolume(0, stream_id_, volume)); 156 filter_->Send(new AudioInputHostMsg_SetVolume(stream_id_, volume));
157 } 157 }
158 158
159 void AudioInputDevice::OnLowLatencyCreated( 159 void AudioInputDevice::OnLowLatencyCreated(
160 base::SharedMemoryHandle handle, 160 base::SharedMemoryHandle handle,
161 base::SyncSocket::Handle socket_handle, 161 base::SyncSocket::Handle socket_handle,
162 uint32 length) { 162 uint32 length) {
163 #if defined(OS_WIN) 163 #if defined(OS_WIN)
164 DCHECK(handle); 164 DCHECK(handle);
165 DCHECK(socket_handle); 165 DCHECK(socket_handle);
166 #else 166 #else
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 bytes_per_sample, 232 bytes_per_sample,
233 number_of_frames); 233 number_of_frames);
234 } 234 }
235 235
236 // Deliver captured data to the client in floating point format 236 // Deliver captured data to the client in floating point format
237 // and update the audio-delay measurement. 237 // and update the audio-delay measurement.
238 callback_->Capture(audio_data_, 238 callback_->Capture(audio_data_,
239 number_of_frames, 239 number_of_frames,
240 audio_delay_milliseconds_); 240 audio_delay_milliseconds_);
241 } 241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698