OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
fbarchard1
2011/01/06 20:34:29
update to 2011
| |
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 "chrome/browser/renderer_host/audio_renderer_host.h" | 5 #include "chrome/browser/renderer_host/audio_renderer_host.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/process.h" | 8 #include "base/process.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "chrome/browser/renderer_host/audio_sync_reader.h" | 10 #include "chrome/browser/renderer_host/audio_sync_reader.h" |
11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 double volume) { | 361 double volume) { |
362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
363 | 363 |
364 AudioEntry* entry = LookupById(msg.routing_id(), stream_id); | 364 AudioEntry* entry = LookupById(msg.routing_id(), stream_id); |
365 if (!entry) { | 365 if (!entry) { |
366 SendErrorMessage(msg.routing_id(), stream_id); | 366 SendErrorMessage(msg.routing_id(), stream_id); |
367 return; | 367 return; |
368 } | 368 } |
369 | 369 |
370 // Make sure the volume is valid. | 370 // Make sure the volume is valid. |
371 CHECK(volume >= 0 && volume <= 1.0); | 371 if (volume < 0 || volume > 1.0) |
372 return; | |
372 entry->controller->SetVolume(volume); | 373 entry->controller->SetVolume(volume); |
373 } | 374 } |
374 | 375 |
375 void AudioRendererHost::OnGetVolume(const IPC::Message& msg, int stream_id) { | 376 void AudioRendererHost::OnGetVolume(const IPC::Message& msg, int stream_id) { |
376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
377 NOTREACHED() << "This message shouldn't be received"; | 378 NOTREACHED() << "This message shouldn't be received"; |
378 } | 379 } |
379 | 380 |
380 void AudioRendererHost::OnNotifyPacketReady( | 381 void AudioRendererHost::OnNotifyPacketReady( |
381 const IPC::Message& msg, int stream_id, uint32 packet_size) { | 382 const IPC::Message& msg, int stream_id, uint32 packet_size) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 | 471 |
471 // Iterate the map of entries. | 472 // Iterate the map of entries. |
472 // TODO(hclam): Implement a faster look up method. | 473 // TODO(hclam): Implement a faster look up method. |
473 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 474 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
474 i != audio_entries_.end(); ++i) { | 475 i != audio_entries_.end(); ++i) { |
475 if (controller == i->second->controller.get()) | 476 if (controller == i->second->controller.get()) |
476 return i->second; | 477 return i->second; |
477 } | 478 } |
478 return NULL; | 479 return NULL; |
479 } | 480 } |
OLD | NEW |