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

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

Issue 14234023: Remove unused flush operation from Chromium audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/process.h" 10 #include "base/process.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // IPC Messages handler 254 // IPC Messages handler
255 bool AudioRendererHost::OnMessageReceived(const IPC::Message& message, 255 bool AudioRendererHost::OnMessageReceived(const IPC::Message& message,
256 bool* message_was_ok) { 256 bool* message_was_ok) {
257 bool handled = true; 257 bool handled = true;
258 IPC_BEGIN_MESSAGE_MAP_EX(AudioRendererHost, message, *message_was_ok) 258 IPC_BEGIN_MESSAGE_MAP_EX(AudioRendererHost, message, *message_was_ok)
259 IPC_MESSAGE_HANDLER(AudioHostMsg_CreateStream, OnCreateStream) 259 IPC_MESSAGE_HANDLER(AudioHostMsg_CreateStream, OnCreateStream)
260 IPC_MESSAGE_HANDLER(AudioHostMsg_AssociateStreamWithProducer, 260 IPC_MESSAGE_HANDLER(AudioHostMsg_AssociateStreamWithProducer,
261 OnAssociateStreamWithProducer) 261 OnAssociateStreamWithProducer)
262 IPC_MESSAGE_HANDLER(AudioHostMsg_PlayStream, OnPlayStream) 262 IPC_MESSAGE_HANDLER(AudioHostMsg_PlayStream, OnPlayStream)
263 IPC_MESSAGE_HANDLER(AudioHostMsg_PauseStream, OnPauseStream) 263 IPC_MESSAGE_HANDLER(AudioHostMsg_PauseStream, OnPauseStream)
264 IPC_MESSAGE_HANDLER(AudioHostMsg_FlushStream, OnFlushStream)
265 IPC_MESSAGE_HANDLER(AudioHostMsg_CloseStream, OnCloseStream) 264 IPC_MESSAGE_HANDLER(AudioHostMsg_CloseStream, OnCloseStream)
266 IPC_MESSAGE_HANDLER(AudioHostMsg_SetVolume, OnSetVolume) 265 IPC_MESSAGE_HANDLER(AudioHostMsg_SetVolume, OnSetVolume)
267 IPC_MESSAGE_UNHANDLED(handled = false) 266 IPC_MESSAGE_UNHANDLED(handled = false)
268 IPC_END_MESSAGE_MAP_EX() 267 IPC_END_MESSAGE_MAP_EX()
269 268
270 return handled; 269 return handled;
271 } 270 }
272 271
273 void AudioRendererHost::OnCreateStream( 272 void AudioRendererHost::OnCreateStream(
274 int stream_id, const media::AudioParameters& params) { 273 int stream_id, const media::AudioParameters& params) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 if (!entry) { 366 if (!entry) {
368 SendErrorMessage(stream_id); 367 SendErrorMessage(stream_id);
369 return; 368 return;
370 } 369 }
371 370
372 entry->controller()->Pause(); 371 entry->controller()->Pause();
373 if (media_internals_) 372 if (media_internals_)
374 media_internals_->OnSetAudioStreamPlaying(this, stream_id, false); 373 media_internals_->OnSetAudioStreamPlaying(this, stream_id, false);
375 } 374 }
376 375
377 void AudioRendererHost::OnFlushStream(int stream_id) {
378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
379
380 AudioEntry* entry = LookupById(stream_id);
381 if (!entry) {
382 SendErrorMessage(stream_id);
383 return;
384 }
385
386 entry->controller()->Flush();
387 if (media_internals_)
388 media_internals_->OnSetAudioStreamStatus(this, stream_id, "flushed");
389 }
390
391 void AudioRendererHost::OnSetVolume(int stream_id, double volume) { 376 void AudioRendererHost::OnSetVolume(int stream_id, double volume) {
392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
393 378
394 AudioEntry* entry = LookupById(stream_id); 379 AudioEntry* entry = LookupById(stream_id);
395 if (!entry) { 380 if (!entry) {
396 SendErrorMessage(stream_id); 381 SendErrorMessage(stream_id);
397 return; 382 return;
398 } 383 }
399 384
400 // Make sure the volume is valid. 385 // Make sure the volume is valid.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 454 }
470 455
471 AudioRendererHost::AudioEntry* AudioRendererHost::LookupById(int stream_id) { 456 AudioRendererHost::AudioEntry* AudioRendererHost::LookupById(int stream_id) {
472 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 457 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
473 458
474 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); 459 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id);
475 return i != audio_entries_.end() ? i->second : NULL; 460 return i != audio_entries_.end() ? i->second : NULL;
476 } 461 }
477 462
478 } // namespace content 463 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698