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 if (!PPB_Audio_Shared::IsThreadFunctionReady()) |
| 99 return PP_FALSE; |
98 SetStartPlaybackState(); | 100 SetStartPlaybackState(); |
99 PluginDispatcher::GetForResource(this)->Send( | 101 PluginDispatcher::GetForResource(this)->Send( |
100 new PpapiHostMsg_PPBAudio_StartOrStop( | 102 new PpapiHostMsg_PPBAudio_StartOrStop( |
101 API_ID_PPB_AUDIO, host_resource(), true)); | 103 API_ID_PPB_AUDIO, host_resource(), true)); |
102 return PP_TRUE; | 104 return PP_TRUE; |
103 } | 105 } |
104 | 106 |
105 PP_Bool Audio::StopPlayback() { | 107 PP_Bool Audio::StopPlayback() { |
106 if (!playing()) | 108 if (!playing()) |
107 return PP_TRUE; | 109 return PP_TRUE; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 static_cast<Audio*>(enter.object())->SetStreamInfo( | 329 static_cast<Audio*>(enter.object())->SetStreamInfo( |
328 enter.resource()->pp_instance(), handle.shmem(), handle.size(), | 330 enter.resource()->pp_instance(), handle.shmem(), handle.size(), |
329 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), | 331 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), |
330 config.object()->GetSampleRate(), | 332 config.object()->GetSampleRate(), |
331 config.object()->GetSampleFrameCount()); | 333 config.object()->GetSampleFrameCount()); |
332 } | 334 } |
333 } | 335 } |
334 | 336 |
335 } // namespace proxy | 337 } // namespace proxy |
336 } // namespace ppapi | 338 } // namespace ppapi |
OLD | NEW |