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 "media/audio/audio_output_controller.h" | 5 #include "media/audio/audio_output_controller.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 | 8 |
9 // Signal a pause in low-latency mode. | 9 // Signal a pause in low-latency mode. |
10 static const int kPauseMark = -1; | 10 static const int kPauseMark = -1; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 void AudioOutputController::DoCreate(AudioParameters params) { | 137 void AudioOutputController::DoCreate(AudioParameters params) { |
138 DCHECK_EQ(message_loop_, MessageLoop::current()); | 138 DCHECK_EQ(message_loop_, MessageLoop::current()); |
139 | 139 |
140 // Close() can be called before DoCreate() is executed. | 140 // Close() can be called before DoCreate() is executed. |
141 if (state_ == kClosed) | 141 if (state_ == kClosed) |
142 return; | 142 return; |
143 DCHECK(state_ == kEmpty); | 143 DCHECK(state_ == kEmpty); |
144 | 144 |
145 stream_ = AudioManager::GetAudioManager()->MakeAudioOutputStream(params); | 145 stream_ = AudioManager::GetAudioManager()->MakeAudioOutputStreamProxy(params); |
146 if (!stream_) { | 146 if (!stream_) { |
147 // TODO(hclam): Define error types. | 147 // TODO(hclam): Define error types. |
148 handler_->OnError(this, 0); | 148 handler_->OnError(this, 0); |
149 return; | 149 return; |
150 } | 150 } |
151 | 151 |
152 if (!stream_->Open()) { | 152 if (!stream_->Open()) { |
153 stream_->Close(); | 153 stream_->Close(); |
154 stream_ = NULL; | 154 stream_ = NULL; |
155 | 155 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 buffers_state.pending_bytes += buffer_.forward_bytes(); | 314 buffers_state.pending_bytes += buffer_.forward_bytes(); |
315 | 315 |
316 // If we need more data then call the event handler to ask for more data. | 316 // If we need more data then call the event handler to ask for more data. |
317 // It is okay that we don't lock in this block because the parameters are | 317 // It is okay that we don't lock in this block because the parameters are |
318 // correct and in the worst case we are just asking more data than needed. | 318 // correct and in the worst case we are just asking more data than needed. |
319 AutoUnlock auto_unlock(lock_); | 319 AutoUnlock auto_unlock(lock_); |
320 handler_->OnMoreData(this, buffers_state); | 320 handler_->OnMoreData(this, buffers_state); |
321 } | 321 } |
322 | 322 |
323 } // namespace media | 323 } // namespace media |
OLD | NEW |