| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ppapi/cpp/audio_buffer.h" | 12 #include "ppapi/cpp/audio_buffer.h" |
| 13 #include "ppapi/cpp/dev/var_resource_dev.h" | |
| 14 #include "ppapi/cpp/graphics_2d.h" | 13 #include "ppapi/cpp/graphics_2d.h" |
| 15 #include "ppapi/cpp/image_data.h" | 14 #include "ppapi/cpp/image_data.h" |
| 16 #include "ppapi/cpp/instance.h" | 15 #include "ppapi/cpp/instance.h" |
| 17 #include "ppapi/cpp/logging.h" | 16 #include "ppapi/cpp/logging.h" |
| 18 #include "ppapi/cpp/media_stream_audio_track.h" | 17 #include "ppapi/cpp/media_stream_audio_track.h" |
| 19 #include "ppapi/cpp/module.h" | 18 #include "ppapi/cpp/module.h" |
| 20 #include "ppapi/cpp/rect.h" | 19 #include "ppapi/cpp/rect.h" |
| 21 #include "ppapi/cpp/size.h" | 20 #include "ppapi/cpp/size.h" |
| 22 #include "ppapi/utility/completion_callback_factory.h" | 21 #include "ppapi/utility/completion_callback_factory.h" |
| 23 | 22 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 66 } |
| 68 | 67 |
| 69 virtual void HandleMessage(const pp::Var& var_message) { | 68 virtual void HandleMessage(const pp::Var& var_message) { |
| 70 if (!var_message.is_dictionary()) | 69 if (!var_message.is_dictionary()) |
| 71 return; | 70 return; |
| 72 pp::VarDictionary var_dictionary_message(var_message); | 71 pp::VarDictionary var_dictionary_message(var_message); |
| 73 pp::Var var_track = var_dictionary_message.Get("track"); | 72 pp::Var var_track = var_dictionary_message.Get("track"); |
| 74 if (!var_track.is_resource()) | 73 if (!var_track.is_resource()) |
| 75 return; | 74 return; |
| 76 | 75 |
| 77 pp::Resource resource_track = pp::VarResource_Dev(var_track).AsResource(); | 76 pp::Resource resource_track = var_track.AsResource(); |
| 78 audio_track_ = pp::MediaStreamAudioTrack(resource_track); | 77 audio_track_ = pp::MediaStreamAudioTrack(resource_track); |
| 79 audio_track_.GetBuffer(callback_factory_.NewCallbackWithOutput( | 78 audio_track_.GetBuffer(callback_factory_.NewCallbackWithOutput( |
| 80 &MediaStreamAudioInstance::OnGetBuffer)); | 79 &MediaStreamAudioInstance::OnGetBuffer)); |
| 81 } | 80 } |
| 82 | 81 |
| 83 private: | 82 private: |
| 84 void ScheduleNextTimer() { | 83 void ScheduleNextTimer() { |
| 85 PP_DCHECK(timer_interval_ > 0); | 84 PP_DCHECK(timer_interval_ > 0); |
| 86 pp::Module::Get()->core()->CallOnMainThread( | 85 pp::Module::Get()->core()->CallOnMainThread( |
| 87 timer_interval_, | 86 timer_interval_, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } // namespace | 214 } // namespace |
| 216 | 215 |
| 217 namespace pp { | 216 namespace pp { |
| 218 | 217 |
| 219 // Factory function for your specialization of the Module object. | 218 // Factory function for your specialization of the Module object. |
| 220 Module* CreateModule() { | 219 Module* CreateModule() { |
| 221 return new MediaStreamAudioModule(); | 220 return new MediaStreamAudioModule(); |
| 222 } | 221 } |
| 223 | 222 |
| 224 } // namespace pp | 223 } // namespace pp |
| OLD | NEW |