| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 PP_Resource config_id, | 67 PP_Resource config_id, |
| 68 PPB_Audio_Callback callback, | 68 PPB_Audio_Callback callback, |
| 69 void* user_data) | 69 void* user_data) |
| 70 : Resource(OBJECT_IS_PROXY, audio_id), | 70 : Resource(OBJECT_IS_PROXY, audio_id), |
| 71 config_(config_id) { | 71 config_(config_id) { |
| 72 SetCallback(callback, user_data); | 72 SetCallback(callback, user_data); |
| 73 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); | 73 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); |
| 74 } | 74 } |
| 75 | 75 |
| 76 Audio::~Audio() { | 76 Audio::~Audio() { |
| 77 #if defined(OS_NACL) |
| 78 // Invoke StopPlayback() to ensure audio back-end has a chance to send the |
| 79 // escape value over the sync socket, which will terminate the client side |
| 80 // audio callback loop. This is required for NaCl Plugins that can't escape |
| 81 // by shutting down the sync_socket. |
| 82 StopPlayback(); |
| 83 #endif |
| 77 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(config_); | 84 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(config_); |
| 78 } | 85 } |
| 79 | 86 |
| 80 PPB_Audio_API* Audio::AsPPB_Audio_API() { | 87 PPB_Audio_API* Audio::AsPPB_Audio_API() { |
| 81 return this; | 88 return this; |
| 82 } | 89 } |
| 83 | 90 |
| 84 PP_Resource Audio::GetCurrentConfig() { | 91 PP_Resource Audio::GetCurrentConfig() { |
| 85 // AddRef for the caller. | 92 // AddRef for the caller. |
| 86 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); | 93 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 static_cast<Audio*>(enter.object())->SetStreamInfo( | 339 static_cast<Audio*>(enter.object())->SetStreamInfo( |
| 333 enter.resource()->pp_instance(), handle.shmem(), | 340 enter.resource()->pp_instance(), handle.shmem(), |
| 334 media::PacketSizeInBytes(handle.size()), | 341 media::PacketSizeInBytes(handle.size()), |
| 335 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), | 342 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), |
| 336 config.object()->GetSampleFrameCount()); | 343 config.object()->GetSampleFrameCount()); |
| 337 } | 344 } |
| 338 } | 345 } |
| 339 | 346 |
| 340 } // namespace proxy | 347 } // namespace proxy |
| 341 } // namespace ppapi | 348 } // namespace ppapi |
| OLD | NEW |