| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/audio_renderer_host.h" | 5 #include "chrome/browser/renderer_host/audio_renderer_host.h" |
| 6 | 6 |
| 7 #include "base/lock.h" | |
| 8 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 9 #include "base/process.h" | 8 #include "base/process.h" |
| 10 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
| 11 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| 12 #include "chrome/browser/renderer_host/audio_sync_reader.h" | 11 #include "chrome/browser/renderer_host/audio_sync_reader.h" |
| 13 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
| 14 #include "chrome/common/render_messages_params.h" | 13 #include "chrome/common/render_messages_params.h" |
| 15 #include "ipc/ipc_logging.h" | 14 #include "ipc/ipc_logging.h" |
| 16 | 15 |
| 17 // The minimum number of samples in a hardware packet. | 16 // The minimum number of samples in a hardware packet. |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 if (!entry->controller) { | 389 if (!entry->controller) { |
| 391 SendErrorMessage(msg.routing_id(), stream_id); | 390 SendErrorMessage(msg.routing_id(), stream_id); |
| 392 return; | 391 return; |
| 393 } | 392 } |
| 394 | 393 |
| 395 // If we have created the controller successfully create a entry and add it | 394 // If we have created the controller successfully create a entry and add it |
| 396 // to the map. | 395 // to the map. |
| 397 entry->render_view_id = msg.routing_id(); | 396 entry->render_view_id = msg.routing_id(); |
| 398 entry->stream_id = stream_id; | 397 entry->stream_id = stream_id; |
| 399 | 398 |
| 400 audio_entries_.insert(std::make_pair( | 399 audio_entries_.insert(std::make_pair( |
| 401 AudioEntryId(msg.routing_id(), stream_id), | 400 AudioEntryId(msg.routing_id(), stream_id), |
| 402 entry.release())); | 401 entry.release())); |
| 403 } | 402 } |
| 404 | 403 |
| 405 void AudioRendererHost::OnPlayStream(const IPC::Message& msg, int stream_id) { | 404 void AudioRendererHost::OnPlayStream(const IPC::Message& msg, int stream_id) { |
| 406 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 407 | 406 |
| 408 AudioEntry* entry = LookupById(msg.routing_id(), stream_id); | 407 AudioEntry* entry = LookupById(msg.routing_id(), stream_id); |
| 409 if (!entry) { | 408 if (!entry) { |
| 410 SendErrorMessage(msg.routing_id(), stream_id); | 409 SendErrorMessage(msg.routing_id(), stream_id); |
| 411 return; | 410 return; |
| 412 } | 411 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 | 580 |
| 582 // Iterate the map of entries. | 581 // Iterate the map of entries. |
| 583 // TODO(hclam): Implement a faster look up method. | 582 // TODO(hclam): Implement a faster look up method. |
| 584 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 583 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
| 585 i != audio_entries_.end(); ++i) { | 584 i != audio_entries_.end(); ++i) { |
| 586 if (controller == i->second->controller.get()) | 585 if (controller == i->second->controller.get()) |
| 587 return i->second; | 586 return i->second; |
| 588 } | 587 } |
| 589 return NULL; | 588 return NULL; |
| 590 } | 589 } |
| OLD | NEW |