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/common.h" | |
9 #include "content/renderer/pepper/pepper_platform_audio_output.h" | 8 #include "content/renderer/pepper/pepper_platform_audio_output.h" |
10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
11 #include "content/renderer/render_frame_impl.h" | 10 #include "content/renderer/render_frame_impl.h" |
12 #include "content/renderer/render_view_impl.h" | 11 #include "content/renderer/render_view_impl.h" |
13 #include "media/audio/audio_output_controller.h" | 12 #include "media/audio/audio_output_controller.h" |
14 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
15 #include "ppapi/c/ppb_audio.h" | 14 #include "ppapi/c/ppb_audio.h" |
16 #include "ppapi/c/ppb_audio_config.h" | 15 #include "ppapi/c/ppb_audio_config.h" |
17 #include "ppapi/shared_impl/resource_tracker.h" | 16 #include "ppapi/shared_impl/resource_tracker.h" |
18 #include "ppapi/thunk/enter.h" | 17 #include "ppapi/thunk/enter.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); | 50 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); |
52 return config_; | 51 return config_; |
53 } | 52 } |
54 | 53 |
55 PP_Bool PPB_Audio_Impl::StartPlayback() { | 54 PP_Bool PPB_Audio_Impl::StartPlayback() { |
56 if (!audio_) | 55 if (!audio_) |
57 return PP_FALSE; | 56 return PP_FALSE; |
58 if (playing()) | 57 if (playing()) |
59 return PP_TRUE; | 58 return PP_TRUE; |
60 SetStartPlaybackState(); | 59 SetStartPlaybackState(); |
61 return BoolToPPBool(audio_->StartPlayback()); | 60 return PP_FromBool(audio_->StartPlayback()); |
62 } | 61 } |
63 | 62 |
64 PP_Bool PPB_Audio_Impl::StopPlayback() { | 63 PP_Bool PPB_Audio_Impl::StopPlayback() { |
65 if (!audio_) | 64 if (!audio_) |
66 return PP_FALSE; | 65 return PP_FALSE; |
67 if (!playing()) | 66 if (!playing()) |
68 return PP_TRUE; | 67 return PP_TRUE; |
69 if (!audio_->StopPlayback()) | 68 if (!audio_->StopPlayback()) |
70 return PP_FALSE; | 69 return PP_FALSE; |
71 SetStopPlaybackState(); | 70 SetStopPlaybackState(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 EnterResourceNoLock<PPB_AudioConfig_API> enter(config_, true); | 118 EnterResourceNoLock<PPB_AudioConfig_API> enter(config_, true); |
120 SetStreamInfo(pp_instance(), | 119 SetStreamInfo(pp_instance(), |
121 shared_memory_handle, | 120 shared_memory_handle, |
122 shared_memory_size, | 121 shared_memory_size, |
123 socket_handle, | 122 socket_handle, |
124 enter.object()->GetSampleRate(), | 123 enter.object()->GetSampleRate(), |
125 enter.object()->GetSampleFrameCount()); | 124 enter.object()->GetSampleFrameCount()); |
126 } | 125 } |
127 | 126 |
128 } // namespace content | 127 } // namespace content |
OLD | NEW |