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 "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "ipc/ipc_platform_file.h" | 10 #include "ipc/ipc_platform_file.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 // The shared memory represents AudioInputBufferParameters and the actual data | 248 // The shared memory represents AudioInputBufferParameters and the actual data |
249 // buffer stored as an audio bus. | 249 // buffer stored as an audio bus. |
250 media::AudioInputBuffer* buffer = | 250 media::AudioInputBuffer* buffer = |
251 static_cast<media::AudioInputBuffer*>(shared_memory_->memory()); | 251 static_cast<media::AudioInputBuffer*>(shared_memory_->memory()); |
252 const uint32_t audio_bus_size_bytes = | 252 const uint32_t audio_bus_size_bytes = |
253 base::checked_cast<uint32_t>(shared_memory_size_ - | 253 base::checked_cast<uint32_t>(shared_memory_size_ - |
254 sizeof(media::AudioInputBufferParameters)); | 254 sizeof(media::AudioInputBufferParameters)); |
255 | 255 |
256 // This is a constantly increasing counter that is used to verify on the | 256 // This is a constantly increasing counter that is used to verify on the |
257 // browser side that buffers are in sync. | 257 // browser side that buffers are in sync. |
258 uint32 buffer_index = 0; | 258 uint32_t buffer_index = 0; |
259 | 259 |
260 while (true) { | 260 while (true) { |
261 int pending_data = 0; | 261 int pending_data = 0; |
262 size_t bytes_read = socket_->Receive(&pending_data, sizeof(pending_data)); | 262 size_t bytes_read = socket_->Receive(&pending_data, sizeof(pending_data)); |
263 if (bytes_read != sizeof(pending_data)) { | 263 if (bytes_read != sizeof(pending_data)) { |
264 DCHECK_EQ(bytes_read, 0U); | 264 DCHECK_EQ(bytes_read, 0U); |
265 break; | 265 break; |
266 } | 266 } |
267 if (pending_data < 0) | 267 if (pending_data < 0) |
268 break; | 268 break; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 device_id, enter_config.object()->GetSampleRate(), | 343 device_id, enter_config.object()->GetSampleRate(), |
344 enter_config.object()->GetSampleFrameCount()); | 344 enter_config.object()->GetSampleFrameCount()); |
345 Call<PpapiPluginMsg_AudioInput_OpenReply>( | 345 Call<PpapiPluginMsg_AudioInput_OpenReply>( |
346 RENDERER, msg, | 346 RENDERER, msg, |
347 base::Bind(&AudioInputResource::OnPluginMsgOpenReply, | 347 base::Bind(&AudioInputResource::OnPluginMsgOpenReply, |
348 base::Unretained(this))); | 348 base::Unretained(this))); |
349 return PP_OK_COMPLETIONPENDING; | 349 return PP_OK_COMPLETIONPENDING; |
350 } | 350 } |
351 } // namespace proxy | 351 } // namespace proxy |
352 } // namespace ppapi | 352 } // namespace ppapi |
OLD | NEW |