| 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 "content/renderer/pepper/ppb_audio_impl.h" | 5 #include "content/renderer/pepper/ppb_audio_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/pepper/pepper_platform_audio_output.h" | 8 #include "content/renderer/pepper/pepper_platform_audio_output.h" |
| 9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 10 #include "content/renderer/pepper/pepper_plugin_instance_throttler.h" | 10 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" |
| 11 #include "content/renderer/render_frame_impl.h" | 11 #include "content/renderer/render_frame_impl.h" |
| 12 #include "content/renderer/render_view_impl.h" | 12 #include "content/renderer/render_view_impl.h" |
| 13 #include "media/audio/audio_output_controller.h" | 13 #include "media/audio/audio_output_controller.h" |
| 14 #include "ppapi/c/pp_completion_callback.h" | 14 #include "ppapi/c/pp_completion_callback.h" |
| 15 #include "ppapi/c/ppb_audio.h" | 15 #include "ppapi/c/ppb_audio.h" |
| 16 #include "ppapi/c/ppb_audio_config.h" | 16 #include "ppapi/c/ppb_audio_config.h" |
| 17 #include "ppapi/shared_impl/resource_tracker.h" | 17 #include "ppapi/shared_impl/resource_tracker.h" |
| 18 #include "ppapi/thunk/enter.h" | 18 #include "ppapi/thunk/enter.h" |
| 19 #include "ppapi/thunk/ppb_audio_config_api.h" | 19 #include "ppapi/thunk/ppb_audio_config_api.h" |
| 20 #include "ppapi/thunk/thunk.h" | 20 #include "ppapi/thunk/thunk.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 PepperPluginInstanceImpl* instance = static_cast<PepperPluginInstanceImpl*>( | 83 PepperPluginInstanceImpl* instance = static_cast<PepperPluginInstanceImpl*>( |
| 84 PepperPluginInstance::Get(pp_instance())); | 84 PepperPluginInstance::Get(pp_instance())); |
| 85 if (!instance) | 85 if (!instance) |
| 86 return PP_ERROR_FAILED; | 86 return PP_ERROR_FAILED; |
| 87 | 87 |
| 88 // Prevent any throttling since we are playing audio. This stopgap prevents | 88 // Prevent any throttling since we are playing audio. This stopgap prevents |
| 89 // video from appearing 'frozen' while the audio track plays. | 89 // video from appearing 'frozen' while the audio track plays. |
| 90 if (instance->throttler() && instance->throttler()->power_saver_enabled()) { | 90 if (instance->throttler() && instance->throttler()->power_saver_enabled()) { |
| 91 instance->throttler()->DisablePowerSaver( | 91 instance->throttler()->DisablePowerSaver( |
| 92 PepperPluginInstanceThrottler::UNTHROTTLE_METHOD_BY_AUDIO); | 92 PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_AUDIO); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // When the stream is created, we'll get called back on StreamCreated(). | 95 // When the stream is created, we'll get called back on StreamCreated(). |
| 96 DCHECK(!audio_); | 96 DCHECK(!audio_); |
| 97 audio_ = PepperPlatformAudioOutput::Create( | 97 audio_ = PepperPlatformAudioOutput::Create( |
| 98 static_cast<int>(enter.object()->GetSampleRate()), | 98 static_cast<int>(enter.object()->GetSampleRate()), |
| 99 static_cast<int>(enter.object()->GetSampleFrameCount()), | 99 static_cast<int>(enter.object()->GetSampleFrameCount()), |
| 100 instance->GetRenderView()->GetRoutingID(), | 100 instance->GetRenderView()->GetRoutingID(), |
| 101 instance->render_frame()->GetRoutingID(), | 101 instance->render_frame()->GetRoutingID(), |
| 102 this); | 102 this); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 126 EnterResourceNoLock<PPB_AudioConfig_API> enter(config_, true); | 126 EnterResourceNoLock<PPB_AudioConfig_API> enter(config_, true); |
| 127 SetStreamInfo(pp_instance(), | 127 SetStreamInfo(pp_instance(), |
| 128 shared_memory_handle, | 128 shared_memory_handle, |
| 129 shared_memory_size, | 129 shared_memory_size, |
| 130 socket_handle, | 130 socket_handle, |
| 131 enter.object()->GetSampleRate(), | 131 enter.object()->GetSampleRate(), |
| 132 enter.object()->GetSampleFrameCount()); | 132 enter.object()->GetSampleFrameCount()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace content | 135 } // namespace content |
| OLD | NEW |