| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/pepper_devices.h" | 5 #include "chrome/renderer/pepper_devices.h" |
| 6 #include "chrome/renderer/webplugin_delegate_pepper.h" | 6 #include "chrome/renderer/webplugin_delegate_pepper.h" |
| 7 #include "skia/ext/platform_canvas.h" | 7 #include "skia/ext/platform_canvas.h" |
| 8 #include "webkit/glue/plugins/plugin_instance.h" | 8 #include "webkit/glue/plugins/plugin_instance.h" |
| 9 #include "webkit/glue/webplugin.h" | 9 #include "webkit/glue/webplugin.h" |
| 10 | 10 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 * (params.bits_per_sample >> 3); | 166 * (params.bits_per_sample >> 3); |
| 167 | 167 |
| 168 // TODO(neb): figure out if this number is grounded in reality | 168 // TODO(neb): figure out if this number is grounded in reality |
| 169 params.buffer_capacity = params.packet_size * 3; | 169 params.buffer_capacity = params.packet_size * 3; |
| 170 | 170 |
| 171 LOG(INFO) << "Initializing Pepper Audio Context (" << | 171 LOG(INFO) << "Initializing Pepper Audio Context (" << |
| 172 config->sampleFrameCount << "Hz, " << params.bits_per_sample << | 172 config->sampleFrameCount << "Hz, " << params.bits_per_sample << |
| 173 " bits, " << config->outputChannelMap << "channels"; | 173 " bits, " << config->outputChannelMap << "channels"; |
| 174 | 174 |
| 175 stream_id_ = filter_->AddDelegate(this); | 175 stream_id_ = filter_->AddDelegate(this); |
| 176 filter->Send(new ViewHostMsg_CreateAudioStream(0, stream_id_, params)); | 176 filter->Send(new ViewHostMsg_CreateAudioStream(0, stream_id_, params, true)); |
| 177 return NPERR_NO_ERROR; | 177 return NPERR_NO_ERROR; |
| 178 } | 178 } |
| 179 | 179 |
| 180 void AudioDeviceContext::OnDestroy() { | 180 void AudioDeviceContext::OnDestroy() { |
| 181 // Make sure we don't call destroy more than once. | 181 // Make sure we don't call destroy more than once. |
| 182 DCHECK_NE(0, stream_id_); | 182 DCHECK_NE(0, stream_id_); |
| 183 filter_->RemoveDelegate(stream_id_); | 183 filter_->RemoveDelegate(stream_id_); |
| 184 filter_->Send(new ViewHostMsg_CloseAudioStream(0, stream_id_)); | 184 filter_->Send(new ViewHostMsg_CloseAudioStream(0, stream_id_)); |
| 185 stream_id_ = 0; | 185 stream_id_ = 0; |
| 186 if (audio_thread_.get()) { | 186 if (audio_thread_.get()) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 void AudioDeviceContext::Run() { | 254 void AudioDeviceContext::Run() { |
| 255 int pending_data; | 255 int pending_data; |
| 256 while (sizeof(pending_data) == socket_->Receive(&pending_data, | 256 while (sizeof(pending_data) == socket_->Receive(&pending_data, |
| 257 sizeof(pending_data)) && | 257 sizeof(pending_data)) && |
| 258 pending_data >= 0) { | 258 pending_data >= 0) { |
| 259 FireAudioCallback(); | 259 FireAudioCallback(); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| OLD | NEW |