| 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/mac/audio_output_mac.h" | 5 #include "media/audio/mac/audio_output_mac.h" |
| 6 | 6 |
| 7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Then the OS queue is started which will create its own thread which | 31 // Then the OS queue is started which will create its own thread which |
| 32 // periodically will call the source for more data as buffers are being | 32 // periodically will call the source for more data as buffers are being |
| 33 // consumed. | 33 // consumed. |
| 34 // 4) At some point some thread will call Stop(), which we handle by directly | 34 // 4) At some point some thread will call Stop(), which we handle by directly |
| 35 // stoping the OS queue. | 35 // stoping the OS queue. |
| 36 // 5) One more callback to the source could be delivered in in the context of | 36 // 5) One more callback to the source could be delivered in in the context of |
| 37 // the queue's own thread. Data, if any will be discared. | 37 // the queue's own thread. Data, if any will be discared. |
| 38 // 6) The same thread that called stop will call Close() where we cleanup | 38 // 6) The same thread that called stop will call Close() where we cleanup |
| 39 // and notifiy the audio manager, which likley will destroy this object. | 39 // and notifiy the audio manager, which likley will destroy this object. |
| 40 | 40 |
| 41 #if !defined(MAC_OS_X_VERSION_10_6) || \ | |
| 42 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | |
| 43 enum { | |
| 44 kAudioQueueErr_EnqueueDuringReset = -66632 | |
| 45 }; | |
| 46 #endif | |
| 47 | |
| 48 PCMQueueOutAudioOutputStream::PCMQueueOutAudioOutputStream( | 41 PCMQueueOutAudioOutputStream::PCMQueueOutAudioOutputStream( |
| 49 AudioManagerMac* manager, const AudioParameters& params) | 42 AudioManagerMac* manager, const AudioParameters& params) |
| 50 : audio_queue_(NULL), | 43 : audio_queue_(NULL), |
| 51 source_(NULL), | 44 source_(NULL), |
| 52 manager_(manager), | 45 manager_(manager), |
| 53 packet_size_(params.GetBytesPerBuffer()), | 46 packet_size_(params.GetBytesPerBuffer()), |
| 54 silence_bytes_(0), | 47 silence_bytes_(0), |
| 55 volume_(1), | 48 volume_(1), |
| 56 pending_bytes_(0), | 49 pending_bytes_(0), |
| 57 num_source_channels_(params.channels()), | 50 num_source_channels_(params.channels()), |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 source_ = source; | 536 source_ = source; |
| 544 } | 537 } |
| 545 | 538 |
| 546 AudioOutputStream::AudioSourceCallback* | 539 AudioOutputStream::AudioSourceCallback* |
| 547 PCMQueueOutAudioOutputStream::GetSource() { | 540 PCMQueueOutAudioOutputStream::GetSource() { |
| 548 base::AutoLock lock(source_lock_); | 541 base::AutoLock lock(source_lock_); |
| 549 return source_; | 542 return source_; |
| 550 } | 543 } |
| 551 | 544 |
| 552 } // namespace media | 545 } // namespace media |
| OLD | NEW |