| 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 "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/ppb_audio.h" | 10 #include "ppapi/c/ppb_audio.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 PP_Resource Audio::GetCurrentConfig() { | 89 PP_Resource Audio::GetCurrentConfig() { |
| 90 // AddRef for the caller. | 90 // AddRef for the caller. |
| 91 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); | 91 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); |
| 92 return config_; | 92 return config_; |
| 93 } | 93 } |
| 94 | 94 |
| 95 PP_Bool Audio::StartPlayback() { | 95 PP_Bool Audio::StartPlayback() { |
| 96 if (playing()) | 96 if (playing()) |
| 97 return PP_TRUE; | 97 return PP_TRUE; |
| 98 SetStartPlaybackState(); | 98 if (!SetStartPlaybackState()) |
| 99 return PP_FALSE; |
| 99 PluginDispatcher::GetForResource(this)->Send( | 100 PluginDispatcher::GetForResource(this)->Send( |
| 100 new PpapiHostMsg_PPBAudio_StartOrStop( | 101 new PpapiHostMsg_PPBAudio_StartOrStop( |
| 101 API_ID_PPB_AUDIO, host_resource(), true)); | 102 API_ID_PPB_AUDIO, host_resource(), true)); |
| 102 return PP_TRUE; | 103 return PP_TRUE; |
| 103 } | 104 } |
| 104 | 105 |
| 105 PP_Bool Audio::StopPlayback() { | 106 PP_Bool Audio::StopPlayback() { |
| 106 if (!playing()) | 107 if (!playing()) |
| 107 return PP_TRUE; | 108 return PP_TRUE; |
| 108 PluginDispatcher::GetForResource(this)->Send( | 109 PluginDispatcher::GetForResource(this)->Send( |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 static_cast<Audio*>(enter.object())->SetStreamInfo( | 328 static_cast<Audio*>(enter.object())->SetStreamInfo( |
| 328 enter.resource()->pp_instance(), handle.shmem(), handle.size(), | 329 enter.resource()->pp_instance(), handle.shmem(), handle.size(), |
| 329 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), | 330 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), |
| 330 config.object()->GetSampleRate(), | 331 config.object()->GetSampleRate(), |
| 331 config.object()->GetSampleFrameCount()); | 332 config.object()->GetSampleFrameCount()); |
| 332 } | 333 } |
| 333 } | 334 } |
| 334 | 335 |
| 335 } // namespace proxy | 336 } // namespace proxy |
| 336 } // namespace ppapi | 337 } // namespace ppapi |
| OLD | NEW |