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 "ppapi/proxy/audio_input_resource.h" | 5 #include "ppapi/proxy/audio_input_resource.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ipc/ipc_platform_file.h" | 9 #include "ipc/ipc_platform_file.h" |
10 #include "media/audio/audio_parameters.h" | 10 #include "media/audio/audio_parameters.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 void AudioInputResource::SetStreamInfo( | 211 void AudioInputResource::SetStreamInfo( |
212 base::SharedMemoryHandle shared_memory_handle, | 212 base::SharedMemoryHandle shared_memory_handle, |
213 size_t shared_memory_size, | 213 size_t shared_memory_size, |
214 base::SyncSocket::Handle socket_handle) { | 214 base::SyncSocket::Handle socket_handle) { |
215 socket_.reset(new base::CancelableSyncSocket(socket_handle)); | 215 socket_.reset(new base::CancelableSyncSocket(socket_handle)); |
216 shared_memory_.reset(new base::SharedMemory(shared_memory_handle, false)); | 216 shared_memory_.reset(new base::SharedMemory(shared_memory_handle, false)); |
217 shared_memory_size_ = shared_memory_size; | 217 shared_memory_size_ = shared_memory_size; |
218 | 218 |
219 if (!shared_memory_->Map(shared_memory_size_)) { | 219 if (!shared_memory_->Map(shared_memory_size_)) { |
220 PpapiGlobals::Get()->LogWithSource(pp_instance(), PP_LOGLEVEL_WARNING, "", | 220 PpapiGlobals::Get()->LogWithSource( |
| 221 pp_instance(), |
| 222 PP_LOGLEVEL_WARNING, |
| 223 std::string(), |
221 "Failed to map shared memory for PPB_AudioInput_Shared."); | 224 "Failed to map shared memory for PPB_AudioInput_Shared."); |
222 } | 225 } |
223 | 226 |
224 // There is a pending capture request before SetStreamInfo(). | 227 // There is a pending capture request before SetStreamInfo(). |
225 if (capturing_) { | 228 if (capturing_) { |
226 // Set |capturing_| to false so that the state looks consistent to | 229 // Set |capturing_| to false so that the state looks consistent to |
227 // StartCapture(), which will reset it to true. | 230 // StartCapture(), which will reset it to true. |
228 capturing_ = false; | 231 capturing_ = false; |
229 StartCapture(); | 232 StartCapture(); |
230 } | 233 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // While closing the stream, we may receive buffers whose size is different | 270 // While closing the stream, we may receive buffers whose size is different |
268 // from |data_buffer_size|. | 271 // from |data_buffer_size|. |
269 CHECK_LE(buffer->params.size, data_buffer_size); | 272 CHECK_LE(buffer->params.size, data_buffer_size); |
270 if (buffer->params.size > 0) | 273 if (buffer->params.size > 0) |
271 audio_input_callback_(&buffer->audio[0], buffer->params.size, user_data_); | 274 audio_input_callback_(&buffer->audio[0], buffer->params.size, user_data_); |
272 } | 275 } |
273 } | 276 } |
274 | 277 |
275 } // namespace proxy | 278 } // namespace proxy |
276 } // namespace ppapi | 279 } // namespace ppapi |
OLD | NEW |