Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: content/renderer/pepper/pepper_audio_input_host.cc

Issue 22886005: Switch audio synchronization from sleep() based to select() based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/renderer/pepper/pepper_audio_input_host.h" 5 #include "content/renderer/pepper/pepper_audio_input_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/renderer/pepper/pepper_media_device_manager.h" 9 #include "content/renderer/pepper/pepper_media_device_manager.h"
10 #include "content/renderer/pepper/pepper_platform_audio_input.h" 10 #include "content/renderer/pepper/pepper_platform_audio_input.h"
11 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 11 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
12 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" 12 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
13 #include "content/renderer/render_view_impl.h" 13 #include "content/renderer/render_view_impl.h"
14 #include "ipc/ipc_message.h" 14 #include "ipc/ipc_message.h"
15 #include "media/audio/shared_memory_util.h"
16 #include "ppapi/c/pp_errors.h" 15 #include "ppapi/c/pp_errors.h"
17 #include "ppapi/host/dispatch_host_message.h" 16 #include "ppapi/host/dispatch_host_message.h"
18 #include "ppapi/host/ppapi_host.h" 17 #include "ppapi/host/ppapi_host.h"
19 #include "ppapi/proxy/ppapi_messages.h" 18 #include "ppapi/proxy/ppapi_messages.h"
20 #include "ppapi/proxy/serialized_structs.h" 19 #include "ppapi/proxy/serialized_structs.h"
21 #include "third_party/WebKit/public/web/WebDocument.h" 20 #include "third_party/WebKit/public/web/WebDocument.h"
22 #include "third_party/WebKit/public/web/WebElement.h" 21 #include "third_party/WebKit/public/web/WebElement.h"
23 #include "third_party/WebKit/public/web/WebPluginContainer.h" 22 #include "third_party/WebKit/public/web/WebPluginContainer.h"
24 23
25 namespace content { 24 namespace content {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 ppapi::proxy::SerializedHandle::SHARED_MEMORY); 161 ppapi::proxy::SerializedHandle::SHARED_MEMORY);
163 162
164 if (result == PP_OK) { 163 if (result == PP_OK) {
165 IPC::PlatformFileForTransit temp_socket = 164 IPC::PlatformFileForTransit temp_socket =
166 IPC::InvalidPlatformFileForTransit(); 165 IPC::InvalidPlatformFileForTransit();
167 base::SharedMemoryHandle temp_shmem = base::SharedMemory::NULLHandle(); 166 base::SharedMemoryHandle temp_shmem = base::SharedMemory::NULLHandle();
168 result = GetRemoteHandles( 167 result = GetRemoteHandles(
169 scoped_socket, scoped_shared_memory, &temp_socket, &temp_shmem); 168 scoped_socket, scoped_shared_memory, &temp_socket, &temp_shmem);
170 169
171 serialized_socket_handle.set_socket(temp_socket); 170 serialized_socket_handle.set_socket(temp_socket);
172 // Note that we must call TotalSharedMemorySizeInBytes() because extra space 171 serialized_shared_memory_handle.set_shmem(temp_shmem, shared_memory_size);
173 // in shared memory is allocated for book-keeping, so the actual size of the
174 // shared memory buffer is larger than |shared_memory_size|. When sending to
175 // NaCl, NaClIPCAdapter expects this size to match the size of the full
176 // shared memory buffer.
177 serialized_shared_memory_handle.set_shmem(
178 temp_shmem, media::TotalSharedMemorySizeInBytes(shared_memory_size));
179 } 172 }
180 173
181 // Send all the values, even on error. This simplifies some of our cleanup 174 // Send all the values, even on error. This simplifies some of our cleanup
182 // code since the handles will be in the other process and could be 175 // code since the handles will be in the other process and could be
183 // inconvenient to clean up. Our IPC code will automatically handle this for 176 // inconvenient to clean up. Our IPC code will automatically handle this for
184 // us, as long as the remote side always closes the handles it receives, even 177 // us, as long as the remote side always closes the handles it receives, even
185 // in the failure case. 178 // in the failure case.
186 open_context_->params.set_result(result); 179 open_context_->params.set_result(result);
187 open_context_->params.AppendHandle(serialized_socket_handle); 180 open_context_->params.AppendHandle(serialized_socket_handle);
188 open_context_->params.AppendHandle(serialized_shared_memory_handle); 181 open_context_->params.AppendHandle(serialized_shared_memory_handle);
(...skipping 29 matching lines...) Expand all
218 211
219 if (open_context_) { 212 if (open_context_) {
220 open_context_->params.set_result(PP_ERROR_ABORTED); 213 open_context_->params.set_result(PP_ERROR_ABORTED);
221 host()->SendReply(*open_context_, PpapiPluginMsg_AudioInput_OpenReply()); 214 host()->SendReply(*open_context_, PpapiPluginMsg_AudioInput_OpenReply());
222 open_context_.reset(); 215 open_context_.reset();
223 } 216 }
224 } 217 }
225 218
226 } // namespace content 219 } // namespace content
227 220
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.cc ('k') | media/audio/audio_device_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698