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 "media/audio/audio_output_controller.h" | 5 #include "media/audio/audio_output_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return; | 269 return; |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 void AudioOutputController::DoReportError(int code) { | 273 void AudioOutputController::DoReportError(int code) { |
274 DCHECK(message_loop_->BelongsToCurrentThread()); | 274 DCHECK(message_loop_->BelongsToCurrentThread()); |
275 if (state_ != kClosed) | 275 if (state_ != kClosed) |
276 handler_->OnError(this, code); | 276 handler_->OnError(this, code); |
277 } | 277 } |
278 | 278 |
279 uint32 AudioOutputController::OnMoreData( | 279 uint32 AudioOutputController::OnMoreData(uint8* dest, |
280 AudioOutputStream* stream, uint8* dest, | 280 uint32 max_size, |
281 uint32 max_size, AudioBuffersState buffers_state) { | 281 AudioBuffersState buffers_state) { |
282 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData"); | 282 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData"); |
283 | 283 |
284 { | 284 { |
285 // Check state and do nothing if we are not playing. | 285 // Check state and do nothing if we are not playing. |
286 // We are on the hardware audio thread, so lock is needed. | 286 // We are on the hardware audio thread, so lock is needed. |
287 base::AutoLock auto_lock(lock_); | 287 base::AutoLock auto_lock(lock_); |
288 if (state_ != kPlaying) { | 288 if (state_ != kPlaying) { |
289 return 0; | 289 return 0; |
290 } | 290 } |
291 } | 291 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 stream_ = NULL; | 324 stream_ = NULL; |
325 weak_this_.InvalidateWeakPtrs(); | 325 weak_this_.InvalidateWeakPtrs(); |
326 } | 326 } |
327 | 327 |
328 // Should be last in the method, do not touch "this" from here on. | 328 // Should be last in the method, do not touch "this" from here on. |
329 if (done != NULL) | 329 if (done != NULL) |
330 done->Signal(); | 330 done->Signal(); |
331 } | 331 } |
332 | 332 |
333 } // namespace media | 333 } // namespace media |
OLD | NEW |