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

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

Issue 1175003004: Change audio IPC enums from kConstantStyle to MACRO_STYLE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 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
« no previous file with comments | « media/audio/audio_input_device.h ('k') | media/audio/audio_input_ipc.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_input_device.h" 5 #include "media/audio/audio_input_device.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 state_ = RECORDING; 145 state_ = RECORDING;
146 ipc_->RecordStream(); 146 ipc_->RecordStream();
147 } 147 }
148 148
149 void AudioInputDevice::OnVolume(double volume) { 149 void AudioInputDevice::OnVolume(double volume) {
150 NOTIMPLEMENTED(); 150 NOTIMPLEMENTED();
151 } 151 }
152 152
153 void AudioInputDevice::OnStateChanged( 153 void AudioInputDevice::OnStateChanged(
154 AudioInputIPCDelegate::State state) { 154 AudioInputIPCDelegateState state) {
155 DCHECK(task_runner()->BelongsToCurrentThread()); 155 DCHECK(task_runner()->BelongsToCurrentThread());
156 156
157 // Do nothing if the stream has been closed. 157 // Do nothing if the stream has been closed.
158 if (state_ < CREATING_STREAM) 158 if (state_ < CREATING_STREAM)
159 return; 159 return;
160 160
161 // TODO(miu): Clean-up inconsistent and incomplete handling here. 161 // TODO(miu): Clean-up inconsistent and incomplete handling here.
162 // http://crbug.com/180640 162 // http://crbug.com/180640
163 switch (state) { 163 switch (state) {
164 case AudioInputIPCDelegate::kStopped: 164 case AUDIO_INPUT_IPC_DELEGATE_STATE_STOPPED:
165 ShutDownOnIOThread(); 165 ShutDownOnIOThread();
166 break; 166 break;
167 case AudioInputIPCDelegate::kRecording: 167 case AUDIO_INPUT_IPC_DELEGATE_STATE_RECORDING:
168 NOTIMPLEMENTED(); 168 NOTIMPLEMENTED();
169 break; 169 break;
170 case AudioInputIPCDelegate::kError: 170 case AUDIO_INPUT_IPC_DELEGATE_STATE_ERROR:
171 DLOG(WARNING) << "AudioInputDevice::OnStateChanged(kError)"; 171 DLOG(WARNING) << "AudioInputDevice::OnStateChanged(ERROR)";
172 // Don't dereference the callback object if the audio thread 172 // Don't dereference the callback object if the audio thread
173 // is stopped or stopping. That could mean that the callback 173 // is stopped or stopping. That could mean that the callback
174 // object has been deleted. 174 // object has been deleted.
175 // TODO(tommi): Add an explicit contract for clearing the callback 175 // TODO(tommi): Add an explicit contract for clearing the callback
176 // object. Possibly require calling Initialize again or provide 176 // object. Possibly require calling Initialize again or provide
177 // a callback object via Start() and clear it in Stop(). 177 // a callback object via Start() and clear it in Stop().
178 if (!audio_thread_.IsStopped()) 178 if (!audio_thread_.IsStopped())
179 callback_->OnCaptureError(); 179 callback_->OnCaptureError();
180 break; 180 break;
181 default: 181 default:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // and update the audio-delay measurement. 314 // and update the audio-delay measurement.
315 int audio_delay_milliseconds = pending_data / bytes_per_ms_; 315 int audio_delay_milliseconds = pending_data / bytes_per_ms_;
316 capture_callback_->Capture( 316 capture_callback_->Capture(
317 audio_bus, audio_delay_milliseconds, volume, key_pressed); 317 audio_bus, audio_delay_milliseconds, volume, key_pressed);
318 318
319 if (++current_segment_id_ >= total_segments_) 319 if (++current_segment_id_ >= total_segments_)
320 current_segment_id_ = 0; 320 current_segment_id_ = 0;
321 } 321 }
322 322
323 } // namespace media 323 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_device.h ('k') | media/audio/audio_input_ipc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698