| OLD | NEW | 
|    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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  245     IPC_MESSAGE_HANDLER(AudioHostMsg_FlushStream, OnFlushStream) |  245     IPC_MESSAGE_HANDLER(AudioHostMsg_FlushStream, OnFlushStream) | 
|  246     IPC_MESSAGE_HANDLER(AudioHostMsg_CloseStream, OnCloseStream) |  246     IPC_MESSAGE_HANDLER(AudioHostMsg_CloseStream, OnCloseStream) | 
|  247     IPC_MESSAGE_HANDLER(AudioHostMsg_SetVolume, OnSetVolume) |  247     IPC_MESSAGE_HANDLER(AudioHostMsg_SetVolume, OnSetVolume) | 
|  248     IPC_MESSAGE_UNHANDLED(handled = false) |  248     IPC_MESSAGE_UNHANDLED(handled = false) | 
|  249   IPC_END_MESSAGE_MAP_EX() |  249   IPC_END_MESSAGE_MAP_EX() | 
|  250  |  250  | 
|  251   return handled; |  251   return handled; | 
|  252 } |  252 } | 
|  253  |  253  | 
|  254 void AudioRendererHost::OnCreateStream( |  254 void AudioRendererHost::OnCreateStream( | 
|  255     int stream_id, const media::AudioParameters& params, int input_channels) { |  255     int stream_id, const media::AudioParameters& params) { | 
|  256   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |  256   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 
|  257   // media::AudioParameters is validated in the deserializer. |  257   // media::AudioParameters is validated in the deserializer. | 
 |  258   int input_channels = params.input_channels(); | 
|  258   if (input_channels < 0 || |  259   if (input_channels < 0 || | 
|  259       input_channels > media::limits::kMaxChannels || |  260       input_channels > media::limits::kMaxChannels || | 
|  260       LookupById(stream_id) != NULL) { |  261       LookupById(stream_id) != NULL) { | 
|  261     SendErrorMessage(stream_id); |  262     SendErrorMessage(stream_id); | 
|  262     return; |  263     return; | 
|  263   } |  264   } | 
|  264  |  265  | 
|  265   media::AudioParameters audio_params(params); |  266   media::AudioParameters audio_params(params); | 
|  266  |  267  | 
|  267   // Calculate output and input memory size. |  268   // Calculate output and input memory size. | 
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  490   return NULL; |  491   return NULL; | 
|  491 } |  492 } | 
|  492  |  493  | 
|  493 media::AudioOutputController* AudioRendererHost::LookupControllerByIdForTesting( |  494 media::AudioOutputController* AudioRendererHost::LookupControllerByIdForTesting( | 
|  494     int stream_id) { |  495     int stream_id) { | 
|  495   AudioEntry* const entry = LookupById(stream_id); |  496   AudioEntry* const entry = LookupById(stream_id); | 
|  496   return entry ? entry->controller : NULL; |  497   return entry ? entry->controller : NULL; | 
|  497 } |  498 } | 
|  498  |  499  | 
|  499 }  // namespace content |  500 }  // namespace content | 
| OLD | NEW |