Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: content/renderer/pepper/pepper_platform_audio_output_impl.cc

Issue 9691001: Audio software mixer. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/pepper_platform_audio_output_impl.h" 5 #include "content/renderer/pepper/pepper_platform_audio_output_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Use the low latency back end if the client request is compatible, and 88 // Use the low latency back end if the client request is compatible, and
89 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. 89 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY.
90 if (sample_rate == audio_hardware::GetOutputSampleRate() && 90 if (sample_rate == audio_hardware::GetOutputSampleRate() &&
91 frames_per_buffer <= kMaxFramesForLowLatency && 91 frames_per_buffer <= kMaxFramesForLowLatency &&
92 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { 92 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) {
93 format = AudioParameters::AUDIO_PCM_LOW_LATENCY; 93 format = AudioParameters::AUDIO_PCM_LOW_LATENCY;
94 } else { 94 } else {
95 format = AudioParameters::AUDIO_PCM_LINEAR; 95 format = AudioParameters::AUDIO_PCM_LINEAR;
96 } 96 }
97 97
98 AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 98 AudioParameters params(format, false, CHANNEL_LAYOUT_STEREO, sample_rate,
99 16, frames_per_buffer); 99 16, frames_per_buffer);
100 100
101 ChildProcess::current()->io_message_loop()->PostTask( 101 ChildProcess::current()->io_message_loop()->PostTask(
102 FROM_HERE, 102 FROM_HERE,
103 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread, 103 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread,
104 this, params)); 104 this, params));
105 return true; 105 return true;
106 } 106 }
107 107
108 void PepperPlatformAudioOutputImpl::InitializeOnIOThread( 108 void PepperPlatformAudioOutputImpl::InitializeOnIOThread(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // Must dereference the client only on the main thread. Shutdown may have 154 // Must dereference the client only on the main thread. Shutdown may have
155 // occurred while the request was in-flight, so we need to NULL check. 155 // occurred while the request was in-flight, so we need to NULL check.
156 if (client_) 156 if (client_)
157 client_->StreamCreated(handle, length, socket_handle); 157 client_->StreamCreated(handle, length, socket_handle);
158 } else { 158 } else {
159 main_message_loop_proxy_->PostTask(FROM_HERE, 159 main_message_loop_proxy_->PostTask(FROM_HERE,
160 base::Bind(&PepperPlatformAudioOutputImpl::OnStreamCreated, this, 160 base::Bind(&PepperPlatformAudioOutputImpl::OnStreamCreated, this,
161 handle, socket_handle, length)); 161 handle, socket_handle, length));
162 } 162 }
163 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698