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 "webkit/plugins/ppapi/ppb_audio_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_audio_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/audio/audio_output_controller.h" | 8 #include "media/audio/audio_output_controller.h" |
9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
10 #include "ppapi/c/ppb_audio.h" | 10 #include "ppapi/c/ppb_audio.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 // static | 48 // static |
49 PP_Resource PPB_Audio_Impl::Create(PP_Instance instance, | 49 PP_Resource PPB_Audio_Impl::Create(PP_Instance instance, |
50 PP_Resource config, | 50 PP_Resource config, |
51 PPB_Audio_Callback audio_callback, | 51 PPB_Audio_Callback audio_callback, |
52 void* user_data) { | 52 void* user_data) { |
53 scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance)); | 53 scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance)); |
54 if (!audio->Init(config, audio_callback, user_data)) | 54 if (!audio->Init(config, audio_callback, user_data)) |
55 return 0; | 55 return 0; |
56 CHECK(media::AudioOutputController::kPauseMark == | |
57 ::ppapi::PPB_Audio_Shared::kPauseMark); | |
58 return audio->GetReference(); | 56 return audio->GetReference(); |
59 } | 57 } |
60 | 58 |
61 PPB_Audio_API* PPB_Audio_Impl::AsPPB_Audio_API() { | 59 PPB_Audio_API* PPB_Audio_Impl::AsPPB_Audio_API() { |
62 return this; | 60 return this; |
63 } | 61 } |
64 | 62 |
65 bool PPB_Audio_Impl::Init(PP_Resource config, | 63 bool PPB_Audio_Impl::Init(PP_Resource config, |
66 PPB_Audio_Callback callback, void* user_data) { | 64 PPB_Audio_Callback callback, void* user_data) { |
67 // Validate the config and keep a reference to it. | 65 // Validate the config and keep a reference to it. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 void PPB_Audio_Impl::OnSetStreamInfo( | 151 void PPB_Audio_Impl::OnSetStreamInfo( |
154 base::SharedMemoryHandle shared_memory_handle, | 152 base::SharedMemoryHandle shared_memory_handle, |
155 size_t shared_memory_size, | 153 size_t shared_memory_size, |
156 base::SyncSocket::Handle socket_handle) { | 154 base::SyncSocket::Handle socket_handle) { |
157 SetStreamInfo(pp_instance(), shared_memory_handle, shared_memory_size, | 155 SetStreamInfo(pp_instance(), shared_memory_handle, shared_memory_size, |
158 socket_handle); | 156 socket_handle); |
159 } | 157 } |
160 | 158 |
161 } // namespace ppapi | 159 } // namespace ppapi |
162 } // namespace webkit | 160 } // namespace webkit |
OLD | NEW |