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

Side by Side Diff: media/audio/audio_output_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: 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
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_device.h" 5 #include "media/audio/audio_output_device.h"
6 6
7 #include "base/threading/thread_restrictions.h" 7 #include "base/threading/thread_restrictions.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "media/audio/audio_output_controller.h" 10 #include "media/audio/audio_output_controller.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 audio_callback_.reset(); 172 audio_callback_.reset();
173 stopping_hack_ = false; 173 stopping_hack_ = false;
174 } 174 }
175 175
176 void AudioOutputDevice::SetVolumeOnIOThread(double volume) { 176 void AudioOutputDevice::SetVolumeOnIOThread(double volume) {
177 DCHECK(task_runner()->BelongsToCurrentThread()); 177 DCHECK(task_runner()->BelongsToCurrentThread());
178 if (state_ >= CREATING_STREAM) 178 if (state_ >= CREATING_STREAM)
179 ipc_->SetVolume(volume); 179 ipc_->SetVolume(volume);
180 } 180 }
181 181
182 void AudioOutputDevice::OnStateChanged(AudioOutputIPCDelegate::State state) { 182 void AudioOutputDevice::OnStateChanged(AudioOutputIPCDelegateState state) {
183 DCHECK(task_runner()->BelongsToCurrentThread()); 183 DCHECK(task_runner()->BelongsToCurrentThread());
184 184
185 // Do nothing if the stream has been closed. 185 // Do nothing if the stream has been closed.
186 if (state_ < CREATING_STREAM) 186 if (state_ < CREATING_STREAM)
187 return; 187 return;
188 188
189 // TODO(miu): Clean-up inconsistent and incomplete handling here. 189 // TODO(miu): Clean-up inconsistent and incomplete handling here.
190 // http://crbug.com/180640 190 // http://crbug.com/180640
191 switch (state) { 191 switch (state) {
192 case AudioOutputIPCDelegate::kPlaying: 192 case AUDIO_OUTPUT_IPC_DELEGATE_STATE_PLAYING:
193 case AudioOutputIPCDelegate::kPaused: 193 case AUDIO_OUTPUT_IPC_DELEGATE_STATE_PAUSED:
194 break; 194 break;
195 case AudioOutputIPCDelegate::kError: 195 case AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR:
196 DLOG(WARNING) << "AudioOutputDevice::OnStateChanged(kError)"; 196 DLOG(WARNING) << "AudioOutputDevice::OnStateChanged(ERROR)";
197 // Don't dereference the callback object if the audio thread 197 // Don't dereference the callback object if the audio thread
198 // is stopped or stopping. That could mean that the callback 198 // is stopped or stopping. That could mean that the callback
199 // object has been deleted. 199 // object has been deleted.
200 // TODO(tommi): Add an explicit contract for clearing the callback 200 // TODO(tommi): Add an explicit contract for clearing the callback
201 // object. Possibly require calling Initialize again or provide 201 // object. Possibly require calling Initialize again or provide
202 // a callback object via Start() and clear it in Stop(). 202 // a callback object via Start() and clear it in Stop().
203 if (!audio_thread_.IsStopped()) 203 if (!audio_thread_.IsStopped())
204 callback_->OnRenderError(); 204 callback_->OnRenderError();
205 break; 205 break;
206 default: 206 default:
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 TRACE_EVENT_ASYNC_END0("audio", "StartingPlayback", this); 304 TRACE_EVENT_ASYNC_END0("audio", "StartingPlayback", this);
305 } 305 }
306 306
307 // Update the audio-delay measurement then ask client to render audio. Since 307 // Update the audio-delay measurement then ask client to render audio. Since
308 // |output_bus_| is wrapping the shared memory the Render() call is writing 308 // |output_bus_| is wrapping the shared memory the Render() call is writing
309 // directly into the shared memory. 309 // directly into the shared memory.
310 render_callback_->Render(output_bus_.get(), audio_delay_milliseconds); 310 render_callback_->Render(output_bus_.get(), audio_delay_milliseconds);
311 } 311 }
312 312
313 } // namespace media. 313 } // namespace media.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698