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