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

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host.cc

Issue 10790121: First step towards moving AudioDevice from content/ to media/audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary #include Created 8 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) 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 "content/browser/renderer_host/media/audio_renderer_host.h" 5 #include "content/browser/renderer_host/media/audio_renderer_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 void AudioRendererHost::DoSendPlayingMessage( 141 void AudioRendererHost::DoSendPlayingMessage(
142 media::AudioOutputController* controller) { 142 media::AudioOutputController* controller) {
143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
144 144
145 AudioEntry* entry = LookupByController(controller); 145 AudioEntry* entry = LookupByController(controller);
146 if (!entry) 146 if (!entry)
147 return; 147 return;
148 148
149 Send(new AudioMsg_NotifyStreamStateChanged( 149 Send(new AudioMsg_NotifyStreamStateChanged(
150 entry->stream_id, kAudioStreamPlaying)); 150 entry->stream_id, media::kAudioStreamPlaying));
151 } 151 }
152 152
153 void AudioRendererHost::DoSendPausedMessage( 153 void AudioRendererHost::DoSendPausedMessage(
154 media::AudioOutputController* controller) { 154 media::AudioOutputController* controller) {
155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
156 156
157 AudioEntry* entry = LookupByController(controller); 157 AudioEntry* entry = LookupByController(controller);
158 if (!entry) 158 if (!entry)
159 return; 159 return;
160 160
161 Send(new AudioMsg_NotifyStreamStateChanged( 161 Send(new AudioMsg_NotifyStreamStateChanged(
162 entry->stream_id, kAudioStreamPaused)); 162 entry->stream_id, media::kAudioStreamPaused));
163 } 163 }
164 164
165 void AudioRendererHost::DoHandleError(media::AudioOutputController* controller, 165 void AudioRendererHost::DoHandleError(media::AudioOutputController* controller,
166 int error_code) { 166 int error_code) {
167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
168 168
169 AudioEntry* entry = LookupByController(controller); 169 AudioEntry* entry = LookupByController(controller);
170 if (!entry) 170 if (!entry)
171 return; 171 return;
172 172
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 // Make sure the volume is valid. 306 // Make sure the volume is valid.
307 if (volume < 0 || volume > 1.0) 307 if (volume < 0 || volume > 1.0)
308 return; 308 return;
309 entry->controller->SetVolume(volume); 309 entry->controller->SetVolume(volume);
310 if (media_observer_) 310 if (media_observer_)
311 media_observer_->OnSetAudioStreamVolume(this, stream_id, volume); 311 media_observer_->OnSetAudioStreamVolume(this, stream_id, volume);
312 } 312 }
313 313
314 void AudioRendererHost::SendErrorMessage(int32 stream_id) { 314 void AudioRendererHost::SendErrorMessage(int32 stream_id) {
315 Send(new AudioMsg_NotifyStreamStateChanged(stream_id, kAudioStreamError)); 315 Send(new AudioMsg_NotifyStreamStateChanged(stream_id,
scherkus (not reviewing) 2012/07/23 22:57:51 fix indent (drop stream_id to next line?)
tommi (sloooow) - chröme 2012/07/24 09:49:44 I can fix this but I thought this was in line with
scherkus (not reviewing) 2012/07/24 17:57:48 Hmm!! I've always done either ThisIsARatherLongFu
316 media::kAudioStreamError));
316 } 317 }
317 318
318 void AudioRendererHost::DeleteEntries() { 319 void AudioRendererHost::DeleteEntries() {
319 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 320 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
320 321
321 for (AudioEntryMap::iterator i = audio_entries_.begin(); 322 for (AudioEntryMap::iterator i = audio_entries_.begin();
322 i != audio_entries_.end(); ++i) { 323 i != audio_entries_.end(); ++i) {
323 CloseAndDeleteStream(i->second); 324 CloseAndDeleteStream(i->second);
324 } 325 }
325 } 326 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 376
376 // Iterate the map of entries. 377 // Iterate the map of entries.
377 // TODO(hclam): Implement a faster look up method. 378 // TODO(hclam): Implement a faster look up method.
378 for (AudioEntryMap::iterator i = audio_entries_.begin(); 379 for (AudioEntryMap::iterator i = audio_entries_.begin();
379 i != audio_entries_.end(); ++i) { 380 i != audio_entries_.end(); ++i) {
380 if (!i->second->pending_close && controller == i->second->controller.get()) 381 if (!i->second->pending_close && controller == i->second->controller.get())
381 return i->second; 382 return i->second;
382 } 383 }
383 return NULL; 384 return NULL;
384 } 385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698