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/ppb_audio_proxy.h" | 5 #include "ppapi/proxy/ppb_audio_proxy.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/threading/simple_thread.h" | 8 #include "base/threading/simple_thread.h" |
9 #include "media/audio/shared_memory_util.h" | 9 #include "media/audio/shared_memory_util.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 CHECK(handle.is_shmem()); | 315 CHECK(handle.is_shmem()); |
316 EnterPluginFromHostResource<PPB_Audio_API> enter(audio_id); | 316 EnterPluginFromHostResource<PPB_Audio_API> enter(audio_id); |
317 if (enter.failed() || result_code != PP_OK) { | 317 if (enter.failed() || result_code != PP_OK) { |
318 // The caller may still have given us these handles in the failure case. | 318 // The caller may still have given us these handles in the failure case. |
319 // The easiest way to clean these up is to just put them in the objects | 319 // The easiest way to clean these up is to just put them in the objects |
320 // and then close them. This failure case is not performance critical. | 320 // and then close them. This failure case is not performance critical. |
321 base::SyncSocket temp_socket( | 321 base::SyncSocket temp_socket( |
322 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor())); | 322 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor())); |
323 base::SharedMemory temp_mem(handle.shmem(), false); | 323 base::SharedMemory temp_mem(handle.shmem(), false); |
324 } else { | 324 } else { |
| 325 EnterResourceNoLock<PPB_AudioConfig_API> config( |
| 326 static_cast<Audio*>(enter.object())->GetCurrentConfig(), true); |
325 // See the comment above about how we must call | 327 // See the comment above about how we must call |
326 // TotalSharedMemorySizeInBytes to get the actual size of the buffer. Here, | 328 // TotalSharedMemorySizeInBytes to get the actual size of the buffer. Here, |
327 // we must call PacketSizeInBytes to get back the size of the audio buffer, | 329 // we must call PacketSizeInBytes to get back the size of the audio buffer, |
328 // excluding the bytes that audio uses for book-keeping. | 330 // excluding the bytes that audio uses for book-keeping. |
329 static_cast<Audio*>(enter.object())->SetStreamInfo( | 331 static_cast<Audio*>(enter.object())->SetStreamInfo( |
330 enter.resource()->pp_instance(), handle.shmem(), | 332 enter.resource()->pp_instance(), handle.shmem(), |
331 media::PacketSizeInBytes(handle.size()), | 333 media::PacketSizeInBytes(handle.size()), |
332 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor())); | 334 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), |
| 335 config.object()->GetSampleFrameCount()); |
333 } | 336 } |
334 } | 337 } |
335 | 338 |
336 } // namespace proxy | 339 } // namespace proxy |
337 } // namespace ppapi | 340 } // namespace ppapi |
OLD | NEW |