| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 PCMQueueOutAudioOutputStream::~PCMQueueOutAudioOutputStream() { | 91 PCMQueueOutAudioOutputStream::~PCMQueueOutAudioOutputStream() { |
| 92 } | 92 } |
| 93 | 93 |
| 94 void PCMQueueOutAudioOutputStream::HandleError(OSStatus err) { | 94 void PCMQueueOutAudioOutputStream::HandleError(OSStatus err) { |
| 95 // source_ can be set to NULL from another thread. We need to cache its | 95 // source_ can be set to NULL from another thread. We need to cache its |
| 96 // pointer while we operate here. Note that does not mean that the source | 96 // pointer while we operate here. Note that does not mean that the source |
| 97 // has been destroyed. | 97 // has been destroyed. |
| 98 AudioSourceCallback* source = GetSource(); | 98 AudioSourceCallback* source = GetSource(); |
| 99 if (source) | 99 if (source) |
| 100 source->OnError(this, static_cast<int>(err)); | 100 source->OnError(this, static_cast<int>(err)); |
| 101 NOTREACHED() << "error " << GetMacOSStatusErrorString(err) | 101 LOG(ERROR) << "error " << GetMacOSStatusErrorString(err) |
| 102 << " (" << err << ")"; | 102 << " (" << err << ")"; |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool PCMQueueOutAudioOutputStream::Open() { | 105 bool PCMQueueOutAudioOutputStream::Open() { |
| 106 // Get the default device id. | 106 // Get the default device id. |
| 107 AudioObjectID device_id = 0; | 107 AudioObjectID device_id = 0; |
| 108 AudioObjectPropertyAddress property_address = { | 108 AudioObjectPropertyAddress property_address = { |
| 109 kAudioHardwarePropertyDefaultOutputDevice, | 109 kAudioHardwarePropertyDefaultOutputDevice, |
| 110 kAudioObjectPropertyScopeGlobal, | 110 kAudioObjectPropertyScopeGlobal, |
| 111 kAudioObjectPropertyElementMaster | 111 kAudioObjectPropertyElementMaster |
| 112 }; | 112 }; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 source_ = source; | 524 source_ = source; |
| 525 } | 525 } |
| 526 | 526 |
| 527 AudioOutputStream::AudioSourceCallback* | 527 AudioOutputStream::AudioSourceCallback* |
| 528 PCMQueueOutAudioOutputStream::GetSource() { | 528 PCMQueueOutAudioOutputStream::GetSource() { |
| 529 base::AutoLock lock(source_lock_); | 529 base::AutoLock lock(source_lock_); |
| 530 return source_; | 530 return source_; |
| 531 } | 531 } |
| 532 | 532 |
| 533 } // namespace media | 533 } // namespace media |
| OLD | NEW |