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

Side by Side Diff: media/audio/mac/audio_output_mac.cc

Issue 9235084: Add OSSTATUS_LOG API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 2011 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>
8
7 #include "base/basictypes.h" 9 #include "base/basictypes.h"
8 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "media/audio/audio_util.h" 13 #include "media/audio/audio_util.h"
12 #include "media/audio/mac/audio_manager_mac.h" 14 #include "media/audio/mac/audio_manager_mac.h"
13 15
14 // A custom data structure to store information an AudioQueue buffer. 16 // A custom data structure to store information an AudioQueue buffer.
15 struct AudioQueueUserData { 17 struct AudioQueueUserData {
16 AudioQueueUserData() : empty_buffer(false) {} 18 AudioQueueUserData() : empty_buffer(false) {}
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 PCMQueueOutAudioOutputStream::~PCMQueueOutAudioOutputStream() { 89 PCMQueueOutAudioOutputStream::~PCMQueueOutAudioOutputStream() {
88 } 90 }
89 91
90 void PCMQueueOutAudioOutputStream::HandleError(OSStatus err) { 92 void PCMQueueOutAudioOutputStream::HandleError(OSStatus err) {
91 // source_ can be set to NULL from another thread. We need to cache its 93 // source_ can be set to NULL from another thread. We need to cache its
92 // pointer while we operate here. Note that does not mean that the source 94 // pointer while we operate here. Note that does not mean that the source
93 // has been destroyed. 95 // has been destroyed.
94 AudioSourceCallback* source = GetSource(); 96 AudioSourceCallback* source = GetSource();
95 if (source) 97 if (source)
96 source->OnError(this, static_cast<int>(err)); 98 source->OnError(this, static_cast<int>(err));
97 NOTREACHED() << "error code " << err; 99 NOTREACHED() << "error " << GetMacOSStatusErrorString(err)
100 << " (" << err << ")";
98 } 101 }
99 102
100 bool PCMQueueOutAudioOutputStream::Open() { 103 bool PCMQueueOutAudioOutputStream::Open() {
101 // Get the default device id. 104 // Get the default device id.
102 AudioObjectID device_id = 0; 105 AudioObjectID device_id = 0;
103 AudioObjectPropertyAddress property_address = { 106 AudioObjectPropertyAddress property_address = {
104 kAudioHardwarePropertyDefaultOutputDevice, 107 kAudioHardwarePropertyDefaultOutputDevice,
105 kAudioObjectPropertyScopeGlobal, 108 kAudioObjectPropertyScopeGlobal,
106 kAudioObjectPropertyElementMaster 109 kAudioObjectPropertyElementMaster
107 }; 110 };
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 void PCMQueueOutAudioOutputStream::SetSource(AudioSourceCallback* source) { 520 void PCMQueueOutAudioOutputStream::SetSource(AudioSourceCallback* source) {
518 base::AutoLock lock(source_lock_); 521 base::AutoLock lock(source_lock_);
519 source_ = source; 522 source_ = source;
520 } 523 }
521 524
522 AudioOutputStream::AudioSourceCallback* 525 AudioOutputStream::AudioSourceCallback*
523 PCMQueueOutAudioOutputStream::GetSource() { 526 PCMQueueOutAudioOutputStream::GetSource() {
524 base::AutoLock lock(source_lock_); 527 base::AutoLock lock(source_lock_);
525 return source_; 528 return source_;
526 } 529 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698