Index: media/audio/mac/audio_low_latency_input_mac.cc |
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc |
index afd17c90a9ae84e50553e2762853b9e36816ee36..c81c93da2d6bf016c07e56446e41b7cb4dab4440 100644 |
--- a/media/audio/mac/audio_low_latency_input_mac.cc |
+++ b/media/audio/mac/audio_low_latency_input_mac.cc |
@@ -114,13 +114,20 @@ AUAudioInputStream::~AUAudioInputStream() { |
bool AUAudioInputStream::Open() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
DVLOG(1) << "Open"; |
- // Verify that we are not already opened. |
- if (audio_unit_) |
+ |
+ // Verify that we are not already opened. Send appropriate error code to |
+ // HandleError() to ensure that the error type is added to UMA stats where |
+ // the frequency of error codes can be analyzed. |
+ if (audio_unit_) { |
+ HandleError(kAudioUnitErr_Initialized); |
tommi (sloooow) - chröme
2016/02/05 12:29:30
I'm not sure this is a good idea. HandleError()
henrika (OOO until Aug 14)
2016/02/05 12:50:51
Done.
|
return false; |
+ } |
- // Verify that we have a valid device. |
+ // Verify that we have a valid device. Send appropriate error code to |
+ // HandleError() to ensure that the error type is added to UMA stats. |
if (input_device_id_ == kAudioObjectUnknown) { |
NOTREACHED() << "Device ID is unknown"; |
+ HandleError(kAudioUnitErr_InvalidElement); |
return false; |
} |
@@ -136,6 +143,7 @@ bool AUAudioInputStream::Open() { |
UMA_HISTOGRAM_SPARSE_SLOWLY("Media.InputInvalidSampleRateMac", sample_rate); |
NOTREACHED() << "Requested sample-rate: " << format_.mSampleRate |
<< " must match the hardware sample-rate: " << sample_rate; |
+ HandleError(kAudioUnitErr_InvalidParameter); |
henrika (OOO until Aug 14)
2016/02/05 12:16:28
Adding one extra here since we can then see the re
tommi (sloooow) - chröme
2016/02/05 12:29:30
Acknowledged.
|
return false; |
} |
@@ -154,8 +162,13 @@ bool AUAudioInputStream::Open() { |
0 |
}; |
+ // Find a component that meets the description in |desc|. |
AudioComponent comp = AudioComponentFindNext(nullptr, &desc); |
DCHECK(comp); |
+ if (!comp) { |
+ HandleError(kAudioComponentErr_InstanceInvalidated); |
+ return false; |
+ } |
// Get access to the service provided by the specified Audio Unit. |
OSStatus result = AudioComponentInstanceNew(comp, &audio_unit_); |